# OpenLayers.Popup.Anchored

#### Inherits from

- OpenLayers.Popup

Summary

OpenLayers.Popup.Anchored |
Properties |
keepInMap | {Boolean} If panMapIfOutOfView is false, and this property is true, contrain the popup such that it always fits in the available map space.
Constructor |
OpenLayers.Popup.Anchored |
Functions |
destroy |
show | Overridden from Popup since user might hide popup and then show() it in a new location (meaning we might want to update the relative position on the show)
moveTo | Since the popup is moving to a new px, it might need also to be moved relative to where the marker is.
setSize |
calculateRelativePosition |
updateRelativePosition | The popup has been moved to a new relative location, so we may want to make some cosmetic adjustments to it.
calculateNewPx |

### Properties

### keepInMap

{Boolean} If panMapIfOutOfView is false, and this property is true, contrain the popup such that it always fits in the available map space. By default, this is set. If you are creating popups that are near map edges and not allowing pannning, and especially if you have a popup which has a fixedRelativePosition, setting this to false may be a smart thing to do.

For anchored popups, default is true, since subclasses will usually want this functionality.

### Constructor

### OpenLayers.Popup.Anchored

#### Parameters

id | {String}
lonlat | {OpenLayers.LonLat}
contentSize | {OpenLayers.Size}
contentHTML | {String}
anchor | {Object} Object which must expose a ‘size’ OpenLayers.Size and ‘offset’ OpenLayers.Pixel (generally an OpenLayers.Icon).
closeBox | {Boolean}
closeBoxCallback | {Function} Function to be called on closeBox click.

### Functions

### destroy

> destroy: function()

### show

> show: function()

Overridden from Popup since user might hide popup and then show() it in a new location (meaning we might want to update the relative position on the show)

### moveTo

> moveTo: function( | px | )

Since the popup is moving to a new px, it might need also to be moved relative to where the marker is. We first calculate the new relativePosition, and then we calculate the new px where we will put the popup, based on the new relative position.

If the relativePosition has changed, we must also call updateRelativePosition() to make any visual changes to the popup which are associated with putting it in a new relativePosition.

#### Parameters

px | {OpenLayers.Pixel}

### setSize

> setSize:function( | contentSize | )

#### Parameters

contentSize | {OpenLayers.Size} the new size for the popup’s contents div (in pixels).

### calculateRelativePosition

> calculateRelativePosition:function( | px | )

#### Parameters

px | {OpenLayers.Pixel}

#### Returns

{String} The relative position (“br” “tr” “tl” “bl”) at which the popup should be placed.

### updateRelativePosition

> updateRelativePosition: function()

The popup has been moved to a new relative location, so we may want to make some cosmetic adjustments to it.

Note that in the classic Anchored popup, there is nothing to do here, since the popup looks exactly the same in all four positions. Subclasses such as the AnchoredBubble and Framed, however, will want to do something special here.

### calculateNewPx

> calculateNewPx:function( | px | )

#### Parameters

px | {OpenLayers.Pixel}

#### Returns

{OpenLayers.Pixel} The the new px position of the popup on the screen relative to the passed-in px.

> destroy: function()

> show: function()

Overridden from Popup since user might hide popup and then show() it in a new location (meaning we might want to update the relative position on the show)

> moveTo: function( | px | )

Since the popup is moving to a new px, it might need also to be moved relative to where the marker is.

> setSize:function( | contentSize | )

> calculateRelativePosition:function( | px | )

> updateRelativePosition: function()

The popup has been moved to a new relative location, so we may want to make some cosmetic adjustments to it.

> calculateNewPx:function( | px | )

A popup is a small div that can opened and closed on the map.
This class represents a longitude and latitude pair
Instances of this class represent a width/height pair
This class represents a screen coordinate, in x and y coordinates
The icon represents a graphical icon on the screen.
Close