Class: FloatingElement

olympe.ui.std. FloatingElement

A FloatingElement is a class describing a popup UI element. Some subclasses are:

Usage:

  • To display it: panel.setVisible(true);
  • To hide it: panel.setVisible(false);

new FloatingElement( [dimension] [, modal] [, alternativeParent] [, nameId] [, themeClass])

Parameters:
Name Type Argument Default Description
dimension olympe.df.PVector2 <optional>

The dimension (w, h) for this element.

modal boolean <optional>
true

True if popup is modal (user can't click outside popup)

alternativeParent olympe.ui.std.Layer <optional>
RootElement

Parent container for this element.

nameId string <optional>

Optional ID name for this element. Auto-generated if omitted.

themeClass olympe.df.POString | string <optional>

The name of the theme class.

Members


<static> HorizontalAnchorAlignType :string

Type:
  • string
Properties:
Name Type Default Description
LEFT_OUT string left_out
LEFT_IN string top_in
MIDDLE string middle
RIGHT_IN string bottom_in
RIGHT_OUT string bottom_out

<static> VerticalAnchorAlignType :string

Type:
  • string
Properties:
Name Type Default Description
TOP_OUT string top_out
TOP_IN string top_in
MIDDLE string middle
BOTTOM_IN string bottom_in
BOTTOM_OUT string bottom_out

<protected, nullable> anchoredPosition :olympe.df.Vector2

Type:

<protected> attachedParent :olympe.df.Proxy.<olympe.ui.std.Layer>|olympe.ui.std.Layer

Parent of this popup.

Type:

<protected> autoHeight :olympe.df.POBoolean

Whether this popup sets its height automatically or not.

Type:

<protected> autoWidth :olympe.df.POBoolean

Whether this popup sets its width automatically or not.

Type:

<protected, non-null> container :olympe.ui.std.AbsoluteLayout

Layout used by this popup to render its content.

Type:

<protected, non-null> content :olympe.df.Proxy.<olympe.ui.std.DockableElement>

Type:

Whether this popup is modal or not.

Type:
  • boolean

<protected> visible :olympe.df.POBoolean

Whether this popup is visible or not.

Type:

Methods


anchorToAttachedParent()

Anchor to attached parent, center in the middle

Returns:

This FloatingElement.

Type
olympe.ui.std.FloatingElement

anchorToElement(element [, horizontalAlign] [, verticalAlign] [, offset])

Anchor the FloatingElement to a screen element.

Parameters:
Name Type Argument Default Description
element olympe.ui.std.DockableElement

The element to use as an anchor.

horizontalAlign olympe.ui.std.FloatingElement.HorizontalAnchorAlignType <optional>
MIDDLE

The horizontal alignment.

verticalAlign olympe.ui.std.FloatingElement.VerticalAnchorAlignType <optional>
MIDDLE

The vertical alignment.

offset olympe.df.Vector2 <optional>

The offset (dx, dy) relative to the anchor's position.

Returns:

This FloatingElement.

Type
olympe.ui.std.FloatingElement

anchorToMouse(mouseEvent [, horizontalAlign] [, verticalAlign] [, offset])

Anchor the FloatingElement to the mouse.

Parameters:
Name Type Argument Default Description
mouseEvent olympe.df.Proxy.<olympe.ui.events.MouseEvent> | olympe.ui.events.MouseEvent

Emitted by a UI element, use getEventMouseMove to follow the mouse

horizontalAlign olympe.ui.std.FloatingElement.HorizontalAnchorAlignType <optional>
MIDDLE

The horizontal alignment.

verticalAlign olympe.ui.std.FloatingElement.VerticalAnchorAlignType <optional>
MIDDLE

The vertical alignment.

offset olympe.df.Vector2 <optional>

The offset (dx, dy) relative to the mouse's position.

Returns:

This FloatingElement.

Type
olympe.ui.std.FloatingElement

applyTheme(theme)

Parameters:
Name Type Description
theme olympe.ui.std.theme.ElementTheme

getAnimateContent()

Checks whether the content is to be animated.

Returns:

true if the content is animated, false for the element itself.

Type
olympe.df.POBoolean

getAnimateOverlay()

Checks whether the overlay is to be animated.

Returns:

true if the overlay is to be animated.

Type
olympe.df.POBoolean

getAnimation()

Gets the animation associated with this FloatingElement.

Returns:

The animation.

Type
olympe.df.Proxy.<olympe.ui.std.TransitionAnimation>

getAutoHeight()

Checks whether the height of this FloatingElement is calculated automatically.

Returns:

true if height is automatically calculated.

Type
olympe.df.POBoolean

getAutoWidth()

Checks whether the width of this FloatingElement is calculated automatically.

Returns:

true if width is automatically calculated.

Type
olympe.df.POBoolean

getDimension()

Gets the dimension of this FloatingElement.

Returns:

The dimension.

Type
olympe.df.PVector2

getOverlayBackgroundColor()

Gets the background color of the overlay when this popup is modal.

Returns:

The background Color.

Type
olympe.df.Proxy.<olympe.df.Color>

getParent()

Gets the parent container of this element.

Returns:

The parent.

Type
olympe.df.Proxy.<olympe.ui.std.DockableElement>

getPosition()

Gets the position of this FloatingElement.

Returns:

Position of this element.

Type
olympe.df.PVector2

isVisible()

Checks whether this FloatingElement is visible.

Returns:

true if popup is visible

Type
olympe.df.POBoolean

onCloseAnimationEnd(callbackFunc [, key])

Registers a callback to be called when the 'close' animation ends.

Parameters:
Name Type Argument Description
callbackFunc function

The function to call back.

key string <optional>

The ID of the callback. Generated automatically if omitted.

Returns:

The ID of the callback.

Type
string

onOpenAnimationEnd(callbackFunc [, key])

Registers a callback to be called when the 'open' animation ends.

Parameters:
Name Type Argument Description
callbackFunc function

The function to call back.

key string <optional>

The ID of the callback. Generated automatically if omitted.

Returns:

The ID of the callback.

Type
string

onOverlayClick(callbackFunc [, key])

Registers a callback to be called when the user clicks in the overlay.

Parameters:
Name Type Argument Description
callbackFunc olympe.ui.events.OnMouseEventCallback

The function to call back.

key string <optional>

The ID of the callback. Generated automatically if omitted.

Returns:

The ID of the callback.

Type
string

releaseAnchor()

Unties this FloatingElement from its anchor.

See:
Returns:

This FloatingElement.

Type
olympe.ui.std.FloatingElement

restoreToAnchor()

Returns to the position set by anchorToElement.

Returns:

This FloatingElement.

Type
olympe.ui.std.FloatingElement

setAnimateContent(value)

Sets whether to animate content inside the FloatingElement, or the FloatingElement itself.

Parameters:
Name Type Description
value olympe.df.POBoolean | boolean

true to animate the content, false for the container.

Returns:

This FloatingElement.

Type
olympe.ui.std.FloatingElement

setAnimateOverlay(value)

Sets whether to animate the overlay (for modal elements).

Parameters:
Name Type Description
value olympe.df.POBoolean | boolean

true to animate the overlay.

Returns:

This FloatingElement.

Type
olympe.ui.std.FloatingElement

setAnimation(animation)

Sets the animation to use when this FloatingElement becomes visible.

Parameters:
Name Type Description
animation olympe.df.Proxy.<olympe.ui.std.TransitionAnimation> | olympe.ui.std.TransitionAnimation

The animation.

Returns:

This FloatingElement.

Type
olympe.ui.std.FloatingElement

setAutoHeight(value)

Sets whether the height of this FloatingElement should be calculated automatically.

Parameters:
Name Type Description
value olympe.df.POBoolean | boolean

true to calculate the height automatically.

Returns:

This FloatingElement.

Type
olympe.ui.std.FloatingElement

<protected> setAutoSizeLogic()

Returns:

This FloatingElement.

Type
olympe.ui.std.FloatingElement

setAutoWidth(value)

Sets whether the width of this FloatingElement should be calculated automatically.

Parameters:
Name Type Description
value olympe.df.POBoolean | boolean

true to calculate the width automatically.

Returns:

This FloatingElement.

Type
olympe.ui.std.FloatingElement

setBackgroundColor(color)

Sets the background color for this FloatingElement.

Parameters:
Name Type Description
color olympe.df.PColor

The background color.

Returns:

This FloatingElement.

Type
olympe.ui.std.FloatingElement

setBackgroundImage(url [, size] [, position] [, sizeVector] [, positionVector])

Sets the background image for this FloatingElement.

Parameters:
Name Type Argument Description
url olympe.df.POString | olympe.df.Node | string

URL to image.

size olympe.ui.common.BackgroundImageSize | olympe.df.Proxy | olympe.df.Node <optional>

The sizing model of the image.

position olympe.ui.common.BackgroundImagePosition | olympe.df.Proxy | olympe.df.Node <optional>

The position of the image inside the container.

sizeVector olympe.df.Vector2 | olympe.df.Proxy | olympe.df.Node <optional>

Size in pixel (ignored if size is not olympe.ui.common.BackgroundImageSize.MANUAL, vertical scale size automatically adjusted if imageSizeY is missing)

positionVector olympe.df.Vector2 | olympe.df.Proxy | olympe.df.Node <optional>

Position of image in pixel (ignored if position is not olympe.ui.common.BackgroundImagePosition.MANUAL)

Returns:

This FloatingElement.

Type
olympe.ui.std.FloatingElement

setBorder(width, color)

Sets the border width and color of this FloatingElement.

Parameters:
Name Type Description
width number | olympe.df.PONumber

The width, in pixels.

color olympe.df.PColor

The color.

Returns:

This FloatingElement.

Type
olympe.ui.std.FloatingElement

setClosableByClickingOut(value)

Set whether or not this element should be closed when the user clicks outside of it.

The default behaviour is to not do anything.

Parameters:
Name Type Description
value boolean

setContent(content)

Sets the content of this FloatingElement.

Parameters:
Name Type Description
content olympe.df.Proxy.<olympe.ui.std.DockableElement> | olympe.ui.std.DockableElement

The content.

Returns:

This FloatingElement.

Type
olympe.ui.std.FloatingElement

setCornerRadius(radius)

Sets the corner radius for this FloatingElement.

Parameters:
Name Type Description
radius olympe.df.PONumber | olympe.df.Node | number

The corner radius.

Returns:

This FloatingElement.

Type
olympe.ui.std.FloatingElement

setDimension(dimension)

Sets the dimension of this FloatingElement.

Parameters:
Name Type Description
dimension olympe.df.PVector2

The dimension (w, h).

Returns:

This FloatingElement.

Type
olympe.ui.std.FloatingElement

setOpacity(opacity)

Sets the opacity for this FloatingElement. It's a value between 0 & 1, 0 meaning transparent and 1 meaning opaque.

Parameters:
Name Type Description
opacity olympe.df.PONumber

The opacity, a value between 0 & 1.

Returns:

This FloatingElement.

Type
olympe.ui.std.FloatingElement

setOverlayBackgroundColor(color)

Sets the overlay background color when this popup is modal.

Parameters:
Name Type Description
color olympe.df.Color | olympe.df.Proxy.<olympe.df.Color>

The overlay background color.

Returns:

This FloatingElement.

Type
olympe.ui.std.FloatingElement

setPosition(position)

Sets the position of this FloatingElement.

Warning: This method should only be called by Layouts!

Parameters:
Name Type Description
position olympe.df.PVector2

The position of this element.

Returns:

This FloatingElement.

Type
olympe.ui.std.FloatingElement

setScale(scale)

Sets the scale for both axis (x, y) of this FloatingElement.

Parameters:
Name Type Description
scale olympe.df.PVector2

The scale (x,y).

Returns:

This FloatingElement.

Type
olympe.ui.std.FloatingElement

<protected> setVisibilityLogic()


setVisible(visible)

Displays or hides this FloatingElement.

Parameters:
Name Type Description
visible olympe.df.POBoolean | boolean

true to display, false to hide.

Returns:

This FloatingElement.

Type
olympe.ui.std.FloatingElement

unregisterOnCloseAnimationEnd(key)

Unregisters a callback set by olympe.ui.std.FloatingElement#onCloseAnimationEnd.

Parameters:
Name Type Description
key string

The ID of the callback.


unregisterOnOpenAnimationEnd(key)

Unregisters a callback set by olympe.ui.std.FloatingElement#onOpenAnimationEnd.

Parameters:
Name Type Description
key string

The ID of the callback.


unregisterOnOverlayClick(key)

Unregisters a callback set by olympe.ui.std.FloatingElement#onOverlayClick.

Parameters:
Name Type Description
key string

The ID of the callback.