SiteWatch API Help

panDir

panDir

Previous topic Next topic  

panDir

Previous topic Next topic  

A method that pans the map to the direction relative to the current map center location.

 

Parameter

Value

x: number

Direction left or right in half-screens.

y: number

Direction up or down in half-screens.

 

Image below shows an example of a half-screen in two half's:

When pan=0 then the center of the map is currently displayed.

When pan=1 then the map slides half-screen of the current map view to the left and becomes the new center of the map.

Half of the map was not displayed before (white box on the left) and half of the map was displayed before (light blue box in the middle).

When pan=2 then the map slides half-screen of the current map view to the left and becomes the new center of the map.

Nothing of the map was displayed before (white box on the left and another box on the left (not shown)) when pan=0.

 

 

Example:

map.panDir(1, 0); //Pans the center 1 left.

map.panDir(-1, 0); //Pans the center 1 right.

map.panDir(0, -1); //Pans the center 1 up.

map.panDir(0, 1); //Pans the center 1 down.

 

Or

 

var point = SWPoint.create(359583, 406481);

 

map.setCenter(point, map.getZoom());

 

map.panDir(1, 0); //Pans the center 1 left.