Select to view content in your preferred language

how to trigger map pan event in programmatically?

5318
9
Jump to solution
11-03-2012 11:37 AM
XintaoLiu
Deactivated User
I add a feature layer to map. Instead of listening for click, I listen for mouse down and mouse move. In the down handler, I add a listener for mouse up. In the move handler, remove the listener for mouse up. In the mouse up handler do what I want to do. This way if they mouse down and then move before the mouse up, my up handler won't be called.

Now the problem is: after mouse down and then move, there is nothing will happen. If I want to trigger the map pan event as normal, how can I do it? Thanks in advance!
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
9 Replies
XintaoLiu
Deactivated User
Any of your reply and suggestion is highly anticipated and appreciated!
0 Kudos
IvanBespalov
Frequent Contributor
All functions and events you need are in Map class:

panDown()
panLeft()
panRight()
panUp()
+ 4  pan functions...

event: panStart - com.esri.ags.events.PanEvent.PAN_START
Fires when a user commences panning.

event: panUpdate - com.esri.ags.events.PanEvent.PAN_UPDATE
Fires during the pan process.

event: panEnd - com.esri.ags.events.PanEvent.PAN_END
Fires when the pan is complete.
0 Kudos
XintaoLiu
Deactivated User
Thanks for your reply! My problem is: after mouse down and then move, how to trigger the PanEvent of map, not just pan up/down/left/right. That is, how to start pan map in a freehand manner. Thank you again.
0 Kudos
IvanBespalov
Frequent Contributor
hmmm...

just set new map center map.centerAt()
0 Kudos
XintaoLiu
Deactivated User
hmmm...

just set new map center map.centerAt()


Thank you so much for your help and patience! What I mean is, when you click on map and move your mouse, the map is being panned continuously, not just CenterAt somewhere. I want to trigger the PanEvent in a freehand manner. I am not sure whether I am clear, but if not, I can explain again. I really appreciate your reply.
0 Kudos
DasaPaddock
Esri Regular Contributor
I'm not sure what you're trying to do exactly, but could you just listen for the mapClick event since it also doesn't fire if you start panning the map:
http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/Map.html#event:mapClick
0 Kudos
XintaoLiu
Deactivated User
I'm not sure what you're trying to do exactly, but could you just listen for the mapClick event since it also doesn't fire if you start panning the map:
http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/Map.html#event:mapClick


It is my privilege to have your suggestions! I appreciate that! Finally I got an online live example showing what my question is:
http://resources.esri.com/help/9.3/arcgisserver/apis/flex/samples/index.html?sample=QueryClickInfoWi...

If you click on map, you will see a highlighted red area. If you click on the area, you will get an info window. BUT, if you click on the area and move your mouse, there is no response at all! What I am trying to do is: when you click on the area and move your mouse, then you can pan the map! Just like you pan the map on other un-clicked areas! Thank you for your patience.
0 Kudos
DasaPaddock
Esri Regular Contributor
0 Kudos
XintaoLiu
Deactivated User
See:
http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/Graphic.html#checkForMouseListeners


Thank all you guys and your kind help! I think it is the right thing I am looking for. I will try it and get back! Thank you!
0 Kudos