Body, Mind & Soul — API Reference
    Preparing search index...

    Function nameplateWorldPosition

    • Compute the world-space position of a token's nameplate. Mirrors Foundry's token-local placement (_refreshSize): horizontally centred under the token, with the top edge offset pixels below the bottom edge of the token.

      Pure function so it can be unit tested without a canvas.

      Parameters

      • params: { height: number; offset: number; width: number; x: number; y: number }

        Placement inputs, all in pixels.

        • height: number

          Token height from document.getSize().

        • offset: number

          Gap between token bottom and nameplate top (CONFIG.Canvas.objectBorderThickness * 0.75 * uiScale).

        • width: number

          Token width from document.getSize().

        • x: number

          Token world x (its position.x).

        • y: number

          Token world y (its position.y).

      Returns { x: number; y: number }

      World coordinates for the nameplate anchor. The nameplate uses anchor (0.5, 0), so this is its top-centre point.