OpenLayers JavaScript Mapping Library |
OpenLayers. PopupA popup is a small div that can opened and closed on the map. Typically opened in response to clicking on a marker. See OpenLayers.Marker. Popup’s don’t require their own layer and are added the the map using the OpenLayers.Map.addPopup method. Examplepopup = new OpenLayers.Popup("chicken", Summary
events{OpenLayers.Events} custom event manager lonlat{OpenLayers.LonLat} the position of this popup on the map size{OpenLayers.Size} the width and height of the popup. groupDiv{DOMElement} the parent of OpenLayers.Popup.contentDiv map{OpenLayers.Map} this gets set in Map.js when the popup is added to the map OpenLayers. PopupCreate a popup. Parameters
draw
Constructs the elements that make up the popup. Parameters
Returns{DOMElement} Reference to a div that contains the drawn popup setSize
Used to adjust the size of the popup. Parameters
registerEvents
Registers events on the popup. Do this in a separate function so that subclasses can choose to override it if they wish to deal differently with mouse events Note in the following handler functions that some special care is needed to deal correctly with mousing and popups. Because the user might select the zoom-rectangle option and then drag it over a popup, we need a safe way to allow the mousemove and mouseup events to pass through the popup when they are initiated from outside. Otherwise, we want to essentially kill the event propagation for all other events, though we have to do so carefully, without disabling basic html functionality, like clicking on hyperlinks or drag-selecting text. |
nullify references to prevent circular references and memory leaks
destroy: function()
Constructs the elements that make up the popup.
draw: function( px )
if the popup has a lonlat and its map members set, then have it move itself to its proper position
updatePosition: function()
moveTo: function( px )
{Boolean} Boolean indicating whether or not the popup is visible
visible: function()
Toggles visibility of the popup.
toggle: function()
Makes the popup visible.
show: function()
Makes the popup invisible.
hide: function()
Used to adjust the size of the popup.
setSize:function( size )
Sets the background color of the popup.
setBackgroundColor:function( color )
Sets the opacity of the popup.
setOpacity:function( opacity )
Sets the border style of the popup.
setBorder:function( border )
Allows the user to set the HTML content of the popup.
setContentHTML:function( contentHTML )
Registers events on the popup.
registerEvents:function()
When mouse goes down within the popup, make a note of it locally, and then do not propagate the mousedown (but do so safely so that user can select text inside)
onmousedown: function ( evt )
If the drag was started within the popup, then do not propagate the mousemove (but do so safely so that user can select text inside)
onmousemove: function ( evt )
When mouse comes up within the popup, after going down in it, reset the flag, and then (once again) do not propagate the event, but do so safely so that user can select text inside
onmouseup: function ( evt )
Ignore clicks, but allowing default browser handling
onclick: function ( evt )
When mouse goes out of the popup set the flag to false so that if they let go and then drag back in, we won’t be confused.
onmouseout: function ( evt )
Ignore double-clicks, but allowing default browser handling
ondblclick: function ( evt )
addPopup: function( popup, exclusive )