Mark a spot with box in Google Maps Street View
-
07-06-2023 - |
سؤال
i want to mark a spot in google street view with transparent box and it needs to be fixed with image as it rotates around. like marking a plant or house.
I have tried to implement it but my equation needs refinement.
I would really appreciate if anyone could help me with it. Link is below.
google.maps.event.addListener(panorama, 'pov_changed', function (cluster) {
var newHeading = panorama.getPov().heading % 360;
var newPitch = panorama.getPov().pitch;
changeXY($("#box-1"), newHeading, newPitch);
});
function changeXY(ctrl, heading, pitch) {
var w = $("#map-canvas").width() / 2;
var h = $("#map-canvas").height() / 2;
var pos = {
left: (w * Math.sin(d2r(heading))),
top: (h * Math.cos(d2r(pitch)))
}
$(ctrl).css("left", pos.left);
//$(ctrl).css("top", pos.top);
}
function d2r(t) {
return t / 180 * Math.PI
}
لا يوجد حل صحيح
لا تنتمي إلى StackOverflow