HTMLMicrioElement state controller

The State.Main constructor is used as HTMLMicrioElement.state, and offers:

  • Reading and setting the active tour and marker
  • Loading and saving the entire current state as a minimal independent JSON object

Properties

marker: Writable<Marker> = ...

The current shown image's opened Models.ImageData.Marker store SvelteStore.Writable

markerHoverId: Writable<string> = ...

The current hovered marker

popover: Writable<PopoverType> = ...

The current opened custom content page

popup: Writable<Marker> = ...

The current opened popup

ui: {
    controls: Writable<boolean>;
    hidden: Writable<boolean>;
    zoom: Writable<boolean>;
} = ...

UI controls settings

Type declaration

  • controls: Writable<boolean>

    Show/hide main controls

  • hidden: Writable<boolean>

    Hide all UI elements

  • zoom: Writable<boolean>

    Show zoom buttons if applicable

Accessors

Methods

  • Gets the current state as an independent, minimal JSON object. This includes the currently open image(s), marker(s), and actively playing media (video, audio, tour) and its state. You can use this object in any other environment to immediately replicate this state (neat!).

    Example:

    // Save the current state in Browser 1
    const state = micrio.state.get();

    // Save or sync this object to Browser 2 and load it there..

    // This makes the <micr-io> session state identical to Browser 1.
    micrio.state.set(state);

    Returns MicrioStateJSON

  • Sets the state from a MicrioStateJSON object, output by the function above here. This works on any Micrio instance!

    Parameters

    Returns Promise<void>