Foundry Virtual Tabletop - API Documentation - Version 14
    Preparing search index...

    The default implementation of the Ruler.

    Hierarchy (View Summary)

    Index

    Properties

    renderFlags: RenderFlags

    Status flags which are applied at render-time to update the PlaceableObject. If an object defines RenderFlags, it should at least include flags for "redraw" and "refresh".

    RENDER_FLAG_PRIORITY: string = "OBJECTS"

    The ticker priority when RenderFlags of this class are handled. Valid values are OBJECTS or PERCEPTION.

    RENDER_FLAGS: { refresh: {} } = ...
    WAYPOINT_LABEL_TEMPLATE: string = "templates/hud/waypoint-label.hbs"

    A handlebars template used to render each waypoint label.

    Accessors

    • get active(): boolean

      Is this Ruler active? True, if the path of the Ruler is nonempty.

      Returns boolean

    • get destination(): ElevatedPoint | undefined

      The last point of the path, or undefined if the path is empty.

      Returns ElevatedPoint | undefined

    • get hidden(): boolean

      Is this Ruler hidden? If true, only the User of the Ruler can see it.

      Returns boolean

      false
      
    • get origin(): ElevatedPoint | undefined

      The first point of the path, or undefined if the path is empty.

      Returns ElevatedPoint | undefined

    • get path(): readonly Readonly<ElevatedPoint>[]

      The sequence of points that the Ruler measures.

      Returns readonly Readonly<ElevatedPoint>[]

      []
      
    • set path(value: readonly Readonly<ElevatedPoint>[]): void

      Set the sequence of points that the Ruler measures.

      Parameters

      Returns void

    • get visible(): boolean

      The Ruler is visible if it is active and either not hidden or its User is the current User.

      Returns boolean

    • get canMeasure(): boolean

      Is the Ruler ready to measure?

      Returns boolean

    Methods

    • Returns Promise<void>

    • Reset the path and the hidden state of the Ruler.

      Returns void

    • Protected

      Add a waypoint.

      Parameters

      • point: Point

        The (unsnapped) waypoint

      • Optionaloptions: { snap?: boolean } = {}

        Additional options

        • Optionalsnap?: boolean

          Snap the added waypoint?

      Returns void

    • Protected

      Change the elevation of the destination.

      Parameters

      • delta: number

        The number vertical steps

      • Optionaloptions: { precise?: boolean } = {}

        Additional options

        • Optionalprecise?: boolean

          Round elevations to multiples of the grid distance divided by CONFIG.Canvas.elevationSnappingPrecision? If false, rounds to multiples of the grid distance.

      Returns void

    • Protected

      Configure the properties of the outline. Called in Ruler#draw.

      Returns { color: ColorSource; thickness: number }

      The thickness in pixels and the color

    • Protected

      Get the style of the segment from the previous to the given waypoint.

      Parameters

      Returns { alpha?: number; color?: ColorSource; width: number }

      The line width, color, and alpha of the segment

    • Protected

      Get the context used to render a ruler waypoint label.

      Parameters

      Returns void | object

    • Protected

      Get the style of the waypoint at the given waypoint.

      Parameters

      Returns { alpha?: number; color?: ColorSource; radius: number }

      The radius, color, and alpha of the waypoint

    • Protected

      Handle left-click events on the Canvas during Ruler measurement.

      Parameters

      • event: FederatedEvent<UIEvent | PixiTouch>

        The pointer-down event

      Returns void

    • Protected

      Handle right-click events on the Canvas during Ruler measurement.

      Parameters

      • event: FederatedEvent<UIEvent | PixiTouch>

        The pointer-down event

      Returns void

    • Protected

      Handle the end of the Ruler measurement workflow

      Parameters

      • event: FederatedEvent<UIEvent | PixiTouch>

        The drag cancel event

      Returns boolean | void

      If false, the cancellation of the drag workflow is prevented

    • Protected

      Handle the beginning of a new Ruler measurement workflow.

      Parameters

      • event: FederatedEvent<UIEvent | PixiTouch>

        The drag start event

      Returns void

    • Protected

      Called when the Ruler becomes hidden or unhidden.

      Returns void

    • Protected

      Continue a Ruler measurement workflow for left-mouse movements on the Canvas.

      Parameters

      • event: FederatedEvent<UIEvent | PixiTouch>

        The mouse move event

      Returns void

    • Protected

      Conclude a Ruler measurement workflow by releasing the left-mouse button.

      Parameters

      • event: FederatedEvent<UIEvent | PixiTouch>

        The pointer-up event

      Returns void

    • Protected

      Adjust the elevation of Ruler waypoints by scrolling up/down.

      Parameters

      • event: WheelEvent

        The mousewheel event

      Returns void

    • Protected

      Called when the Ruler's path has changed.

      Returns void