positioning

Classes

goog.positioning.AbsolutePosition
Encapsulates a popup position where the popup absolutely positioned by setting the left/top style elements directly to the specified values. The position is generally relative to the element's offsetParent. Normally, this is the document body, but can be another element if the popup element is scoped by an element with relative position.
goog.positioning.AbstractPosition
Abstract position object. Encapsulates position and overflow handling.
goog.positioning.AnchoredPosition
Encapsulates a popup position where the popup is anchored at a corner of an element. When using AnchoredPosition, it is recommended that the popup element specified in the Popup constructor or Popup.setElement be absolutely positioned.
goog.positioning.AnchoredViewportPosition
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.
goog.positioning.ClientPosition
Encapsulates a popup position where the popup is positioned relative to the window (client) coordinates. This calculates the correct position to use even if the element is relatively positioned to some other element. This is for trying to position an element at the spot of the mouse cursor in a MOUSEMOVE event. Just use the event.clientX and event.clientY as the parameters.
goog.positioning.MenuAnchoredPosition
Encapsulates a popup position where the popup is anchored at a corner of an element. The positioning behavior changes based on the values of opt_adjust and opt_resize. When using this positioning object it's recommended that the movable element be absolutely positioned.
goog.positioning.ViewportClientPosition
Encapsulates a popup position where the popup is positioned relative to the window (client) coordinates, and made to stay within the viewport.
goog.positioning.ViewportPosition
Encapsulates a popup position where the popup is positioned according to coordinates relative to the element's viewport (page). This calculates the correct position to use even if the element is relatively positioned to some other element.

Public Protected Private

Enumerations

goog.positioning.Corner :
Enum for representing an element corner for positioning the popup. The START constants map to LEFT if element directionality is left to right and RIGHT if the directionality is right to left. Likewise END maps to RIGHT or LEFT depending on the directionality.
Constants:
BOTTOM_END
No description.
BOTTOM_LEFT
No description.
BOTTOM_RIGHT
No description.
BOTTOM_START
No description.
TOP_END
No description.
TOP_LEFT
No description.
TOP_RIGHT
No description.
TOP_START
No description.
Code »
goog.positioning.CornerBit :
Enum for bits in the
Constants:
BOTTOM
No description.
FLIP_RTL
No description.
RIGHT
No description.
Code »
goog.positioning.Overflow :
Enum for representing position handling in cases where the element would be positioned outside the viewport.
Constants:
ADJUST_X
No description.
ADJUST_X_EXCEPT_OFFSCREEN
No description.
ADJUST_Y
No description.
ADJUST_Y_EXCEPT_OFFSCREEN
No description.
FAIL_X
No description.
FAIL_Y
No description.
IGNORE
No description.
RESIZE_HEIGHT
No description.
RESIZE_WIDTH
No description.
Code »
goog.positioning.OverflowStatus :
Enum for representing the outcome of a positioning call.
Constants:
ADJUSTED_X
No description.
ADJUSTED_Y
No description.
FAILED
No description.
FAILED_BOTTOM
No description.
FAILED_HORIZONTAL
No description.
FAILED_LEFT
No description.
FAILED_OUTSIDE_VIEWPORT
No description.
FAILED_RIGHT
No description.
FAILED_TOP
No description.
FAILED_VERTICAL
No description.
HEIGHT_ADJUSTED
No description.
NONE
No description.
WIDTH_ADJUSTED
No description.
Code »

Global Functions

goog.positioning.adjustForViewport_(possizeviewportoverflow) goog.positioning.OverflowStatus
Adjusts the position and/or size of an element, identified by its position and size, to fit inside the viewport. If the position or size of the element is adjusted the pos or size objects, respectively, are modified.
Arguments:
pos : goog.math.Coordinate
Position of element, updated if the position is adjusted.
size : goog.math.Size
Size of element, updated if the size is adjusted.
viewport : goog.math.Box
Bounding box describing the viewport.
overflow : number
Overflow handling mode, .
Returns: goog.positioning.OverflowStatus  Status bitmap, .
code »
goog.positioning.flipCorner(corner) goog.positioning.Corner
Returns the corner opposite the given one horizontally and vertically.
Arguments:
corner : goog.positioning.Corner
The popup corner used to flip.
Returns: goog.positioning.Corner  The opposite corner horizontally and vertically.
code »
goog.positioning.flipCornerHorizontal(corner) goog.positioning.Corner
Returns the corner opposite the given one horizontally.
Arguments:
corner : goog.positioning.Corner
The popup corner used to flip.
Returns: goog.positioning.Corner  The opposite corner horizontally.
code »
goog.positioning.flipCornerVertical(corner) goog.positioning.Corner
Returns the corner opposite the given one vertically.
Arguments:
corner : goog.positioning.Corner
The popup corner used to flip.
Returns: goog.positioning.Corner  The opposite corner vertically.
code »
goog.positioning.getEffectiveCorner(elementcorner) goog.positioning.Corner
Returns an absolute corner (top/bottom left/right) given an absolute or relative (top/bottom start/end) corner and the direction of an element. Absolute corners remain unchanged.
Arguments:
element : Element
DOM element to test for RTL direction.
corner : goog.positioning.Corner
The popup corner used for positioning.
Returns: goog.positioning.Corner  Effective corner.
code »
goog.positioning.getOffsetParentPageOffset(movableElement) !goog.math.Coordinate
Calculates the page offset of the given element's offsetParent. This value can be used to translate any x- and y-offset relative to the page to an offset relative to the offsetParent, which can then be used directly with as position coordinate for positionWithCoordinate.
Arguments:
movableElement : !Element
The element to calculate.
Returns: !goog.math.Coordinate  The page offset, may be (0, 0).
code »
goog.positioning.getVisiblePart_(el) !goog.math.Rect
Returns intersection of the specified element and goog.style.getVisibleRectForElement for it.
Arguments:
el : Element
The target element.
Returns: !goog.math.Rect  Intersection of getVisibleRectForElement and the current bounding rectangle of the element. If the intersection is empty, returns the bounding rectangle.
code »
goog.positioning.positionAtAnchor(anchorElementanchorElementCornermovableElementmovableElementCorneropt_offsetopt_marginopt_overflowopt_preferredSizeopt_viewport) goog.positioning.OverflowStatus
Positions a movable element relative to an anchor element. The caller specifies the corners that should touch. This functions then moves the movable element accordingly.
Arguments:
anchorElement : Element
The element that is the anchor for where the movable element should position itself.
anchorElementCorner : goog.positioning.Corner
The corner of the anchorElement for positioning the movable element.
movableElement : Element
The element to move.
movableElementCorner : goog.positioning.Corner
The corner of the movableElement that that should be positioned adjacent to the anchor element.
opt_offset : goog.math.Coordinate=
An offset specified in pixels. After the normal positioning algorithm is applied, the offset is then applied. Positive coordinates move the popup closer to the center of the anchor element. Negative coordinates move the popup away from the center of the anchor element.
opt_margin : goog.math.Box=
A margin specified in pixels. After the normal positioning algorithm is applied and any offset, the margin is then applied. Positive coordinates move the popup away from the spot it was positioned towards its center. Negative coordinates move it towards the spot it was positioned away from its center.
opt_overflow : ?number=
Overflow handling mode. Defaults to IGNORE if not specified. Bitmap, .
opt_preferredSize : goog.math.Size=
The preferred size of the movableElement.
opt_viewport : goog.math.Box=
Box object describing the dimensions of the viewport. The viewport is specified relative to offsetParent of movableElement. In other words, the viewport can be thought of as describing a "position: absolute" element contained in the offsetParent. It defaults to visible area of nearest scrollable ancestor of movableElement (see goog.style.getVisibleRectForElement).
Returns: goog.positioning.OverflowStatus  Status bitmap, .
code »
goog.positioning.positionAtCoordinate(absolutePosmovableElementmovableElementCorneropt_marginopt_viewportopt_overflowopt_preferredSize) goog.positioning.OverflowStatus
Positions the specified corner of the movable element at the specified coordinate.
Arguments:
absolutePos : goog.math.Coordinate
The coordinate to position the element at.
movableElement : Element
The element to be positioned.
movableElementCorner : goog.positioning.Corner
The corner of the movableElement that that should be positioned.
opt_margin : goog.math.Box=
A margin specified in pixels. After the normal positioning algorithm is applied and any offset, the margin is then applied. Positive coordinates move the popup away from the spot it was positioned towards its center. Negative coordinates move it towards the spot it was positioned away from its center.
opt_viewport : goog.math.Box=
Box object describing the dimensions of the viewport. Required if opt_overflow is specified.
opt_overflow : ?number=
Overflow handling mode. Defaults to IGNORE if not specified, .
opt_preferredSize : goog.math.Size=
The preferred size of the movableElement. Defaults to the current size.
Returns: goog.positioning.OverflowStatus  Status bitmap.
code »

Global Properties

goog.positioning.AnchoredPositionTest :
No description.
Code »
goog.positioning.AnchoredViewportPositionTest :
No description.
Code »
goog.positioning.MenuAnchoredPositionTest :
No description.
Code »
goog.positioning.ViewportClientPositionTest :
No description.
Code »
goog.positioning.clientPositionTest :
No description.
Code »

Package positioning

Package Reference