Interfact with the current view of the editor.

Hierarchy

  • View

Properties

OpenPreview: (() => void)

Type declaration

    • (): void
    • Opens the preview mode. Would not do anything if the editor is already in preview mode or if there is no preview available.

      Returns void

Preview: {
    GetCurrentPage(callback) => void;
    RegisterCommand(command, callback) => void;
    RunCommand(command, parameter) => void;
    SetCurrentPage(index) => void;
}

This sub interface will allow to interact with the preview mode of the editor. All communication calls to the preview go through a message queue and are executed asynchronously.

Type declaration

  • GetCurrentPage:function
    • Get the page currently displayed within the preview. Note that this will only work for previews which support the page information. Installed previews:

      • standard: supports page information
      • 3D: does not support page information
      • flip: does not support page information

      Parameters

      • callback: ((pageIndex) => void)

        The callback will be triggered once the page information is available. The callback will receive the page index as parameter.

          • (pageIndex): void
          • Parameters

            • pageIndex: number

            Returns void

      Returns void

  • RegisterCommand:function
    • Registers a script command. This allows to trigger actions in the editor from the preview.

      Parameters

      • command: string

        The command name to register.

      • callback: ((parameter) => void)

        The callback will be triggered if the preview triggers the command. The callback will receive the parameter passed from the preview.

          • (parameter): void
          • Parameters

            • parameter: unknown

            Returns void

      Returns void

  • RunCommand:function
    • Runs a command in the preview. The list of supported commands depends on the preview implementation. This allows to trigger actions in the preview from the editor.

      Installed previews:

      • standard: "pageUpdate" - will update the page with the latest appearance changes
      • 3D: "pageUpdate" - will update full page textures with the latest appearance changes "fieldUpdate" - will update field textures with the latest appearance changes "changeView" - will update the 3D camera as well as the mesh position/rotation all with an animated transition

      Parameters

      • command: string

        The command name to trigger.

      • parameter: unknown

        The parameter to pass to the command.

      Returns void

  • SetCurrentPage:function
    • Sets the page currently displayed within the preview. Note that this will only work for previews which support the page information. Installed previews:

      • standard: supports page information
      • 3D: does not support page information
      • flip: does not support page information

      Parameters

      • index: number

        The page index to display.

      Returns void

SetCurrentPage: ((pageOrIndexOrId) => boolean)

Type declaration

    • (pageOrIndexOrId): boolean
    • Changes the current page.

      Parameters

      • pageOrIndexOrId: string | number | Page

        The page to change to. Can be either the page index, the page id or the page object.

      Returns boolean

      Flag indicating if the page was changed.

Methods

  • Closes the preview mode. Would not do anything if the editor is not in preview mode or if there is no preview available.

    Returns void

  • Get the currently active page by index:

    Returns number

    The current page index.

  • Get the current view port information. Can be used to save and restore the view port later or to manipulate the view port based on the current context.

    Returns ViewPortInfo

    The current view port information.

  • Test if the editor is currently in preview mode and showing the preview instead of the editor.

    Returns boolean

    True if the editor is currently in preview mode.

  • Redraw will enforce the canvas to be redrawn with the content the page has currently. It will not reinitialize the page nor change the viewport. It has a minimal impact on performance and has not visible artifacts, but not all changes on the contents may be reflected.

    Returns void

  • Refreshes the current page. This will reload the entire page and re-render all objects. This is useful to ensure any update on the fields is being reflected in the editor. The viewport will be reset to the default view and it has a noticable impact on the user experience.

    Returns void

  • Causes text and image fields to be redrawn. Based on the flag, the redraw will be forced to be asap or it can be queued up. This will also ensure for image fields that the positioning for auto fit is being recalculated.

    Parameters

    • force: boolean

      Flag to control if the redraw should be forced to be asap or if it can be queued up.

    Returns void

  • Updates the current view port to the specified values. All parameters are optional. If a parameter is not specified, the current value will be used.

    Parameters

    • Optional zoom: number

      The new zoom value.

    • Optional x: number

      The new horizontal translation value.

    • Optional y: number

      The new vertical translation value.

    Returns void

  • Toggles the full screen mode of the editor. Full screen mode is using the operating system to display the page in full screen.

    Returns boolean

    True if the editor is showing in full screen after the call to this method.

  • Toggles the current preview mode. If we are in the preview it will show the editor. If we are in the editor it will show the preview.

    Returns void

    True if the editor is showing the preview after the call to this method.

  • Adjust the zoom by adding the given amount to the current zoom factor. Note that the min/max zoom levels are being maintained. This can be used to increase or decrease the zoom by a given quantity.

    Parameters

    • amount: number

      Positive or negative number to adjust the zoom level by adding/substracting the given amount to the current zoom scale.

    Returns void

  • Zooms to a specific area on the page. This will adjust the scale factor and translate the view port to the center of the given area.

    Parameters

    • x: number

      The x coordinate of the area (top left corner) to zoom to.

    • y: number

      The y coordinate of the area (top left corner) to zoom to.

    • w: number

      The width of the area to zoom to.

    • h: number

      The height of the area to zoom to.

    • padding: number

      The padding to add to the zoomed area. Use 0 to zoom to the exact size of the area.

    Returns void

  • Adjusts the view by zooming to the given field. This will adjust the scale factor and translate the view port to the center of the field. Note: the method will not change the page. If the field is not on the current page, the method will still zoom to the area where the field would be.

    Parameters

    • field: BaseField

      The field object to zoom to.

    • padding: number

      The mandatory padding parameter adds the given amount of points on all 4 sides of the field to the zoomed area. Use 0 to zoom to the exact size of the field.

    Returns void

Generated using TypeDoc