ThreePresenter API Documentation - v0.1.2
    Preparing search index...

    Class DefaultUI

    DefaultUI - Standard UI overlay for ThreePresenter

    Provides a ready-to-use UI control panel with buttons for common 3D viewer operations. This class demonstrates how to build a UI on top of ThreePresenter without tight coupling.

    Features:

    • Home/Reset button - returns camera to default view
    • Light toggle - enable/disable head lighting
    • Light position control - adjust light direction relative to camera
    • Environment lighting - toggle HDRI/environment map
    • Annotation toggle - enable/disable picking mode
    • Camera mode switch - toggle between perspective and orthographic
    • Screenshot capture - save current view as image
    • Fullscreen toggle - enter/exit fullscreen mode (bottom-right corner)

    All buttons are hidden by default and must be enabled individually using setButtonVisible(id, true). Available button IDs: 'home', 'light', 'lightPosition', 'env', 'screenshot', 'camera', 'annotation', 'fullscreen'.

    The UI responds to state changes via callbacks, keeping it in sync with the presenter's internal state.

    const presenter = new ThreePresenter(container);
    const ui = new DefaultUI(presenter, {
    container: {
    position: 'top-left',
    gap: 12
    }
    });

    // Show only specific buttons
    ui.setButtonVisible('home', true);
    ui.setButtonVisible('screenshot', true);
    ui.setButtonVisible('fullscreen', true);
    Index

    Constructors

    Methods

    • Parameters

      • enabled: boolean

      Returns void

    • Parameters

      • isOrthographic: boolean

      Returns void

    • Parameters

      • id: string
      • visible: boolean

      Returns void

    Properties

    container: HTMLDivElement
    fullscreenContainer: HTMLDivElement
    buttons: Map<string, HTMLButtonElement>
    envLightingEnabled: boolean = true
    presenter: ThreePresenter