Class: FixedPopup

ol.Overlay. FixedPopup

A popup element to be displayed over the map and attached to a single map location. The popup are customized using CSS.


new FixedPopup(options)

Parameters:
Name Type Description
options

Extend Overlay options

Properties
Name Type Description
popupClass String

the a class of the overlay to style the popup.

style ol.style.Style

a style to style the link on the map.

minScale number

min scale for the popup, default .5

maxScale number

max scale for the popup, default 2

closeBox bool

popup has a close box, default false.

onclose: function | undefined

callback function when popup is closed

onshow function | undefined

callback function when popup is shown

offsetBox Number | Array.<number>

an offset box

positioning ol.OverlayPositioning | string | undefined

the 'auto' positioning var the popup choose its positioning to stay on the map.

Fires:
  • event:show
  • event:hide

Extends

Methods


addPopupClass(c)

Add a CSS class to the popup.

Parameters:
Name Type Description
c string

class name.

Inherited From:
Overrides:

getLinkStyle()

Get link style

Returns:

style

Type
ol.style.Style

getPixelPosition()

Set pixel position

Returns:
Type
ol.pixel

getVisible()

Check if popup is visible

Inherited From:
Overrides:
Returns:
Type
boolean

hide()

Hide the popup

Inherited From:
Overrides:

removePopupClass(c)

Remove a CSS class to the popup.

Parameters:
Name Type Description
c string

class name.

Inherited From:
Overrides:

setClosebox(b)

Set a close box to the popup.

Parameters:
Name Type Description
b bool
Inherited From:
Overrides:

setLinkStyle(style)

Set link style

Parameters:
Name Type Description
style ol.style.Style

setMap(map)

Set the map instance the control is associated with and add its controls associated to this map.

Parameters:
Name Type Description
map _ol_Map_

The map instance.


setPixelPosition(pix, position)

Set pixel position

Parameters:
Name Type Description
pix ol.pixel
position string

top/bottom/middle-left/right/center


setPopupClass(c)

Set the CSS class of the popup.

Parameters:
Name Type Description
c string

class name.

Overrides:

setPositioning(pos)

Set positionning of the popup

Parameters:
Name Type Description
pos ol.OverlayPositioning | string | undefined

an ol.OverlayPositioning or 'auto' to var the popup choose the best position

Inherited From:
Overrides:

setRotation(angle, update)

Set poppup rotation

Parameters:
Name Type Description
angle number
update booelan

update popup, default true


setScale(scale, update)

Set poppup scale

Parameters:
Name Type Description
scale number
update booelan

update popup, default true


show(coordinate, html)

Set the position and the content of the popup.

Parameters:
Name Type Description
coordinate ol.Coordinate | string

the coordinate of the popup or the HTML content.

html string | undefined

the HTML content (undefined = previous content).

Inherited From:
Overrides:
Example
var popup = new ol.Overlay.Popup();
  // Show popup
  popup.show([166000, 5992000], "Hello world!");
  // Move popup at coord with the same info
  popup.show([167000, 5990000]);
  // set new info
  popup.show("New informations");