I have tried to simulate this behavior with the code above, but
dragging is "jumpy":
var drag={};
function rightclickdown(event){
if(!
drag.event)drag.event=google.maps.event.addListener(map,"mousemove",function(e)
{
var lat=e.latLng.lat(),lng=e.latLng.lng();
if(!drag.startLat)drag.startLat=lat;
if(!drag.startLng)drag.startLng=lng;
if(!drag.center)drag.center=map.getCenter();
if(!drag.incLat)drag.incLat=0;
if(!drag.incLng)drag.incLng=0;
drag.incLat=lat-drag.startLat;
drag.incLng=lng-drag.startLng;
var newCenter=new google.maps.LatLng(drag.center.lat()-
drag.incLat,drag.center.lng()-drag.incLng)
map.setCenter(newCenter);
});
}
function rightclickup(event){
google.maps.event.removeListener(drag.event);
delete drag.event;
delete drag.incLat;
delete drag.incLng;
delete drag.center;
delete drag.startLat;
delete drag.startLng;
}
Another way of doing this could be by setting the map to draggable and
triggering the "drag" behavior...but I'm not sure on how to achieve
this.
Thanks in advance.
On 18 nov, 14:11, Pil <wolf...@gmail.com> wrote:
> Why do want to 'simulate' a functionality that is already provided by
> the Maps API?
> Would be a good idea to describe what you want to achieve - but
> without posting code.
>
> On Nov 18, 1:41 pm, 4dllmg <adelol...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Is itpossibletosimulatemap dragging when holding the right click
> > and moving the mouse?
>
> > I have tried tosimulatethis behavior with the code above, but
Doesn't seem clear to me what you mean by "selecting", and which
elements should be selected?
On 21 nov, 11:11, Pil <wolf...@gmail.com> wrote:
> What do you mean by "select elements in themap" and
> > > > Another way of doing this could be by setting themapto draggable and