Select to view content in your preferred language

Is it possible to control the map.panUp amount?

1107
6
02-15-2012 07:25 PM
StephenLead
Honored Contributor
The map object has a panUp method, which doesn't accept any arguments.


function north(){
  myMap.panUp();
}



How does it decide how much to pan, and can it be adjusted (without resorting to hacks)? panUp(100) doesn't seem to have any effect.

Thanks,
Steve


0 Kudos
6 Replies
derekswingley1
Deactivated User
This is hardcoded into the API ... what do you want to do?
0 Kudos
StephenLead
Honored Contributor
I just want to nudge the map up a tiny bit.

I'll do it manually by adjusting the map.extent object - but it'd be a nice enhancement request to be able to specify the amount of the pan.

Cheers,
Steve
0 Kudos
derekswingley1
Deactivated User
it'd be a nice enhancement request to be able to specify the amount of the pan.


Agreed. I'll throw it out the team. Until then, you'll need to do this manually by building a new extent and passing it to map.setExtent.
0 Kudos
StephenLead
Honored Contributor
PS don't worry, I haven't sold out and decided to include pan arrows on my map. This is for something else 🙂
0 Kudos
derekswingley1
Deactivated User
PS don't worry, I haven't sold out and decided to include pan arrows on my map. This is for something else 🙂


Glad to hear that. Hopefully you're enjoying the new superpan feature of 2.7...
0 Kudos
JoanneMcGraw
Frequent Contributor
Steve,

I'm not sure if you're still interested in this, but the ESRI JSAPI uses the Map's private method _fixedPan for the arrow keys keyboard navigation which just nudges the map in a given direction, as opposed to the big jump you get with the pan* methods.

To achieve what you seem to be asking (and I imagine this is not advocated by anyone since it's using a private/undocumented function), I simply provide a hard-coded value to indicate the amount of shift (notice it is sometimes negative, btw) in my pan functions. In my case, I just use a 0.0135 all the time. It's generally been close enough, although not exactly the same as the arrow key nudge amounts, for our purposes.

Up: map._fixedPan(0, map.height * -0.0135)
Right: map._fixedPan(map.width * 0.0135, 0)
Down: map._fixedPan(0, map.height * 0.0135)
Left: map._fixedPan(map.width * -0.0135, 0)


If anyone's aware of why this is really not a good idea (besides the fact that the _fixedPan function is undocumented and, consequently, unsupported...a risk I am willing to take but others may not be so inclined, understandably), feel free to share. I haven't noticed any issues, but that doesn't mean there aren't any.

Cheers,
jtm
0 Kudos