Preparing search index...

    Base class for implementing an overlay plugin, initialized with a plugin system and optional descriptor.

    // The OverlayPlugin class (from LensStudio:OverlayPlugin) extends Editor.IPlugin
    // for floating overlay panels in the editor viewport.
    //
    // Constructor: constructor(pluginSystem, descriptor?)
    // Methods: createWidget(parent), requestShow(), requestHide(), deinit()
    // Properties: pluginSystem (readonly)

    export class OverlayPluginOverlayPluginExampleOverlay extends OverlayPlugin {
    connections: any[];
    root: Widget | null;
    statusLabel: Label | null;
    static descriptor() {
    const d = new Descriptor();
    d.id = 'com.docs.OverlayPluginOverlayPluginExample';
    d.name = 'OverlayPlugin Class Example';
    d.description = 'Shows OverlayPlugin lifecycle with show/hide';
    return d;
    }
    constructor(pluginSystem: Editor.PluginSystem, descriptor?: Descriptor) {
    super(pluginSystem, descriptor);
    this.connections = [];
    this.root = null;
    this.statusLabel = null;
    }
    createWidget(parent: Widget): Widget {
    this.root = new Widget(parent);
    const layout = new BoxLayout();
    layout.setDirection(Direction.TopToBottom);
    layout.spacing = 8;
    this.root.layout = layout;

    this.statusLabel = new Label(this.root);
    this.statusLabel.text = 'Overlay active';
    this.statusLabel.wordWrap = true;
    layout.addWidget(this.statusLabel);

    const showBtn = new PushButton(this.root);
    showBtn.text = 'Show';
    this.connections.push(showBtn.onClick.connect(() => this.requestShow()));
    layout.addWidget(showBtn);

    const hideBtn = new PushButton(this.root);
    hideBtn.text = 'Hide';
    this.connections.push(hideBtn.onClick.connect(() => this.requestHide()));
    layout.addWidget(hideBtn);

    return this.root;
    }
    deinit(): void {
    this.connections.forEach((c: any) => c?.disconnect());
    this.connections = [];
    if (this.root) { this.root.deleteLater(); this.root = null; }
    this.statusLabel = null;
    }
    }

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    id: string
    pluginSystem: PluginSystem

    The plugin system instance this plugin is registered with.

    Methods

    • Creates and returns the overlay widget attached to the given parent widget.

      Parameters

      Returns Widget

    • Cleans up and releases resources held by the overlay plugin.

      Returns void

    • Returns the name of this object's type.

      Returns string

    • Returns true if the object is of the specified type.

      Parameters

      • type: string

      Returns boolean

    • Returns true if this object refers to the same instance as the given object.

      Parameters

      Returns boolean

    • Requests that the overlay be hidden.

      Returns void

    • Requests that the overlay be shown.

      Returns void