ThreePipe
    Preparing search index...

    Class WidgetIconOverlay

    The icons of light and camera widgets as DOM elements, for Object3DWidgetsPlugin.iconMode = 'dom': an SVG for each widget whose AHelperWidget.iconMode is dom, in a layer over the canvas in the viewer container.

    The SVG comes from the same shapes as the sprite texture (getWidgetIconSvg), so both modes look the same; it is sharp at any pixel ratio and icon size, and never in a render, screenshot or recording of the canvas. update places the icons with transform only (called after each render, with the camera of the render; the layout is read again only after invalidateViewport), and hides an icon when its widget or a parent is hidden, AHelperWidget.hasIcon is false, or the object is behind the camera or out of its near and far range. An icon whose centre is just out of the canvas still shows the part of it that is on the canvas. Where icons overlap, the nearer one is on top (and gets the click), as with sprites.

    The pointer: a click or tap on an icon calls WidgetIconOverlayOptions.click when it is a click for the canvas too (shorter than ObjectPicker.PointerClickMaxTime, moved less than ObjectPicker.PointerClickMaxDistance), the pointer entering and leaving an icon calls WidgetIconOverlayOptions.hover, and a wheel over an icon goes on to the canvas, so the camera still zooms. An icon that cannot be clicked (WidgetIconOverlayOptions.canClick) lets the pointer through to the canvas.

    The layer has z-index 8, under the other overlays on the canvas (UI layers in CONTRIBUTING.md). Made by Object3DWidgetsPlugin.

    Index
    element: HTMLDivElement

    The layer of the icons, over the canvas

    options: WidgetIconOverlayOptions = {}
    • Adds the layer to container, over canvas (a child of the container)

      Parameters

      • container: HTMLElement
      • canvas: HTMLElement

      Returns void

    • Checks again which icons can be clicked (WidgetIconOverlayOptions.canClick) at the next update (the check is not run on each frame). Object3DWidgetsPlugin calls it on a change in the viewer (an update event: the picking plugin, its options or the selection, the widget options) and when a plugin is added or removed. A new icon is checked when it is made.

      Returns void

    • Reads the place and the size of the canvas in the container again, at the next update (the layout is not read on each frame). Call it when the canvas is resized or moved: Object3DWidgetsPlugin calls it on a resize of the viewer.

      Returns void

    • Places the icons of widgets for camera, makes the icons of new widgets and removes the icons of widgets that are no longer in the list or no longer in dom mode. Writes the DOM only where something changed.

      Parameters

      • widgets: readonly unknown[]
      • camera: Camera

      Returns void