← Back to Docs
  • index.html
  • Clayground
  • Clayground.Lab
  • WorldLabel
  • Clayground 2026.7
  • WorldLabel QML Type

    A 2D chip pinned to a point in a 3D scene. More...

    Import Statement: import Clayground.Lab
    Inherits:

    Rectangle

    Properties

    Detailed Description

    The overlay every 3D lab grows by hand: project a world point to the window, park a small paper panel next to it, keep it inside the viewport and hide it when it goes behind the camera. Put one in the same parent as the View3D (not inside it - this is a QtQuick item, not a 3D node).

    Use text for a one-line readout, or give it children for anything richer; the chip sizes itself either way.

    Note: The projection lists camera.scenePosition and camera.sceneRotation as explicit dependencies. Without them the binding never re-evaluates when the camera moves and every label freezes in place - invisible with a static camera, which is exactly why this is easy to get wrong.

    Example usage:

    import Clayground.Lab
    
    Item {
        View3D { id: view; anchors.fill: parent; camera: cam }
    
        WorldLabel {
            view: view
            camera: cam
            worldPosition: Qt.vector3d(0, 4, 0)
            text: "12.4 A"
            accent: LabTheme.forest
        }
    }

    See also LabTheme and Plot2D.

    Property Documentation

    accent : color

    Border colour - use it to carry meaning.


    active : bool

    Set false to hide without unloading.


    camera : var

    The camera that View3D renders with.


    contentItem : var [read-only]

    The item children are parented to.


    gap : real

    Pixels between the point and the chip.


    keepInView : bool

    Keeps the chip inside its parent instead of letting it leave.

    Zoom in far enough and the anchor point sits well outside the window; a readout that vanished then would look like a bug rather than a viewpoint.


    margin : real

    Closest the chip may come to the window edge.


    offset : point

    Extra pixel nudge, applied after placement.


    onScreen : bool [read-only]

    Whether the anchor point is in front of the camera.


    placement : int

    See Placement.


    text : string

    Convenience one-line content.


    view : var

    The View3D to project through.

    Deliberately var, not View3D: typing it would make Clayground.Lab import QtQuick3D for one property, and the kernel should not need a 3D dependency to draw a paper chip.


    worldPosition : vector3d

    The scene point to pin to.