OpenLayers. Popup

Summary
{DOMElement}
{String}
{String}
{float}
{String}
{DOMElement}
{DOMElement}
{int}
{OpenLayers.Map} this gets set in Map.js when the popup is added to the map
Create a popup.
nullify references to prevent circular references and memory leaks
if the popup has a lonlat and its map members set, then have it move itself to its proper position
{Boolean} Boolean indicating whether or not the popup is visible
Registers events on the popup.
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)
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)
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
Ignore clicks, but allowing default browser handling
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.
Ignore double-clicks, but allowing default browser handling

Properties

div

{DOMElement}

contentHTML

{String}

backgroundColor

{String}

opacity

{float}

border

{String}

contentDiv

{DOMElement}

groupDiv

{DOMElement}

padding

{int}

map

{OpenLayers.Map} this gets set in Map.js when the popup is added to the map

Functions

OpenLayers. Popup

Create a popup.

Parameters

id{String}
lonlat{OpenLayers.LonLat}
size{OpenLayers.Size}
contentHTML{String}
closeBox{Boolean}

destroy

destroy: function()

nullify references to prevent circular references and memory leaks

draw

draw: function(px)

Parameters

px{OpenLayers.Pixel}

Return

{DOMElement} Reference to a div that contains the drawn popup

updatePosition

updatePosition: function()

if the popup has a lonlat and its map members set, then have it move itself to its proper position

moveTo

moveTo: function(px)

Parameters

px{OpenLayers.Pixel}

visible

visible: function()

Returns

{Boolean} Boolean indicating whether or not the popup is visible

toggle

toggle: function()

show

show: function()

hide

hide: function()

setSize

setSize:function(size)

Parameters

size{OpenLayers.Size}

setBackgroundColor

setBackgroundColor:function(color)

Parameters

color{String}

setOpacity

setOpacity:function(opacity)

Parameters

opacity{float}

setBorder

setBorder:function(border)

Parameters

border{int}

setContentHTML

setContentHTML:function(contentHTML)

Parameters

contentHTML{String}

registerEvents

registerEvents:function()

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.

onmousedown

onmousedown: function (evt)

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)

Parameters

evt{Event}

onmousemove

onmousemove: 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)

Parameters

evt{Event}

onmouseup

onmouseup: 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

Parameters

evt{Event}

onclick

onclick: function (evt)

Ignore clicks, but allowing default browser handling

Parameters

evt{Event}

onmouseout

onmouseout: 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.

Parameters

evt{Event}

ondblclick

ondblclick: function (evt)

Ignore double-clicks, but allowing default browser handling

Parameters

evt{Event}
This class represents a longitude and latitude pair
Instances of this class represent a width/height pair
Instances of OpenLayers.Map are interactive maps embedded in a web page.
destroy: function()
nullify references to prevent circular references and memory leaks
draw: function(px)
updatePosition: function()
if the popup has a lonlat and its map members set, then have it move itself to its proper position
moveTo: function(px)
visible: function()
{Boolean} Boolean indicating whether or not the popup is visible
toggle: function()
show: function()
hide: function()
setSize:function(size)
setBackgroundColor:function(color)
setOpacity:function(opacity)
setBorder:function(border)
setContentHTML:function(contentHTML)
registerEvents:function()
Registers events on the popup.
onmousedown: function (evt)
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)
onmousemove: 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)
onmouseup: 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
onclick: function (evt)
Ignore clicks, but allowing default browser handling
onmouseout: 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.
ondblclick: function (evt)
Ignore double-clicks, but allowing default browser handling
This class represents a screen coordinate, in x and y coordinates