
Changing the Behavior of the Map When Clicked On
If you want to change what happens when the user clicks in a map, you can override the "MouseDown", "MouseUp", "MouseMove", and/or "MouseWheel" functions within the CMView class. The view recieves the standard "event" object from the browser but can then convert the x and y value in the event to reference coordinates within the map as shown in the example below.
TheView.MouseDown=function(TheEvent) { if (!TheEvent) { TheEvent=window.event; } CanvasMap.HidePopupWindow(); var Coordinate=CMUtilities.GetElementCoordinate(TheEvent.clientX,TheEvent.clientY,this.TheCanvas); var PixelX=Coordinate.x; var PixelY=Coordinate.y; var RefX=this.GetRefXFromPixelX(PixelX); var RefY=this.GetRefYFromPixelY(PixelY); alert("RefX="+RefX); }