Class: Position

Guacamole.Position(templateopt)

new Position(templateopt)

A position in 2-D space.
Parameters:
Name Type Attributes Default Description
template Guacamole.Position | object <optional>
{} The object whose properties should be copied within the new Guacamole.Position.
Source:

Members

(non-null) x :number

The current X position, in pixels.
Type:
  • number
Default Value:
  • 0
Source:

(non-null) y :number

The current Y position, in pixels.
Type:
  • number
Default Value:
  • 0
Source:

Methods

(static) fromClientPosition(elementnon-null, clientXnon-null, clientYnon-null) → (non-null) {Guacamole.Position}

Returns a new Guacamole.Position representing the relative position of the given clientX/clientY coordinates within the given element. The clientX and clientY coordinates are relative to the browser viewport and are commonly available within JavaScript event objects. The final position is translated to coordinates that are relative the given element.
Parameters:
Name Type Description
element Element The element the coordinates should be relative to.
clientX number The viewport-relative X coordinate to translate.
clientY number The viewport-relative Y coordinate to translate.
Source:
Returns:
A new Guacamole.Position representing the relative position of the given client coordinates.
Type
Guacamole.Position

fromClientPosition(elementnon-null, clientXnon-null, clientYnon-null)

Assigns the position represented by the given element and clientX/clientY coordinates. The clientX and clientY coordinates are relative to the browser viewport and are commonly available within JavaScript event objects. The final position is translated to coordinates that are relative the given element.
Parameters:
Name Type Description
element Element The element the coordinates should be relative to.
clientX number The viewport-relative X coordinate to translate.
clientY number The viewport-relative Y coordinate to translate.
Source: