positioning.AnchoredViewportPosition Extends goog.positioning.AnchoredPosition
Encapsulates a popup position where the popup is anchored at a corner of an element. The corners are swapped if dictated by the viewport. For instance if a popup is anchored with its top left corner to the bottom left corner of the anchor the popup is either displayed below the anchor (as specified) or above it if there's not enough room to display it below. When using this positioning object it's recommended that the movable element be absolutely positioned.

Inheritance

Constructor

goog.positioning.AnchoredViewportPosition(anchorElementcorneropt_adjustopt_overflowConstraint)

Parameters

anchorElement : Element
Element the movable element should be anchored against.
corner : goog.positioning.Corner
Corner of anchored element the movable element should be positioned at.
opt_adjust : boolean=
Whether the positioning should be adjusted until the element fits inside the viewport even if that means that the anchored corners are ignored.
opt_overflowConstraint : goog.math.Box=
Box object describing the dimensions in which the movable element could be shown.

Instance Methods

Public Protected Private
adjustCorner(statuscorner) goog.positioning.Corner
Adjusts the corner if X or Y positioning failed.
Arguments:
status : number
The status of the last positionAtAnchor call.
corner : goog.positioning.Corner
The corner to adjust.
Returns: goog.positioning.Corner  The adjusted corner.
code »
getLastResortOverflow() number
No description.
Returns: number  A bitmask for the "last resort" overflow.
code »
getOverflowConstraint() goog.math.Box | undefined
No description.
Returns: goog.math.Box | undefined  The box object describing the dimensions in which the movable element will be shown.
code »
reposition(movableElementmovableCorneropt_marginopt_preferredSize)
Repositions the movable element.
Arguments:
movableElement : Element
Element to position.
movableCorner : goog.positioning.Corner
Corner of the movable element that should be positioned adjacent to the anchored element.
opt_margin : goog.math.Box=
A margin specified in pixels.
opt_preferredSize : goog.math.Size=
The preferred size of the movableElement.
code »
setLastResortOverflow(lastResortOverflow)
No description.
Arguments:
lastResortOverflow : number
A bitmask for the "last resort" overflow, if we fail to fit the element on-screen.
code »
setOverflowConstraint(overflowConstraint)
No description.
Arguments:
overflowConstraint : goog.math.Box | undefined
Box object describing the dimensions in which the movable element could be shown.
code »
reposition(movableElementmovableCorneropt_marginopt_preferredSize)
Repositions the movable element.
Arguments:
movableElement : Element
Element to position.
movableCorner : goog.positioning.Corner
Corner of the movable element that should be positioned adjacent to the anchored element.
opt_margin : goog.math.Box=
A margin specifin pixels.
opt_preferredSize : goog.math.Size=
PreferredSize of the movableElement (unused in this class).
code »
reposition(movableElementcorneropt_marginopt_preferredSize)
Repositions the element. Abstract method, should be overloaded.
Arguments:
movableElement : Element
Element to position.
corner : goog.positioning.Corner
Corner of the movable element that should be positioned adjacent to the anchored element.
opt_margin : goog.math.Box=
A margin specified in pixels.
opt_preferredSize : goog.math.Size=
PreferredSize of the movableElement.
code »

Instance Properties

constructor :
No description.
Code »
lastResortOverflow_ :
The last resort algorithm to use if the algorithm can't fit inside the viewport. IGNORE = do nothing, just display at the preferred position. ADJUST_X | ADJUST_Y = Adjust until the element fits, even if that means that the anchored corners are ignored.
Code »
overflowConstraint_ : goog.math.Box
The dimensions in which the movable element could be shown.
Code »
constructor :
No description.
Code »
corner :
Corner of anchored element the movable element should be positioned at.
Code »
element :
Element the movable element should be anchored against.
Code »
overflow_ :
Overflow handling mode. Defaults to IGNORE if not specified. Bitmap, .
Code »

Static Properties

goog.positioning.AnchoredViewportPosition.superClass_ :
No description.
Code »

Package positioning

Package Reference