Interface: SideView

SideView

A single-side view without toolbars.
Source:

Methods

addOutOfBoundsChangeListener(listener)

Registers a of bounds change listener with this single-side view.
Parameters:
Name Type Description
listener SideView~outOfBoundsChangeListener listener to register
Source:

addSelectionChangeListener(listener)

Registers a selection change listener with this single-side view.
Parameters:
Name Type Description
listener SideView~selectionChangeListener listener to register
Source:

focus()

Convenience method. Sets input focus to the view's canvas element. Equivalent to getCanvasElement().focus().
Source:

getCanvasElement() → {Element}

Gets the canvas DOM element which this view uses to perform its drawing.
Source:
Returns:
the canvas element
Type
Element

getData() → {SideViewData}

Returns the complete state of this side view.
Source:
Returns:
the current view state
Type
SideViewData

getFont() → {module:TagEditor.Font}

Returns the font set by the last successful call to SideView#setFont. When a SideView is created, the font is set to ENGRAVE by default.
Source:
Returns:
the current font
Type
module:TagEditor.Font

getLines() → {Array.<string>}

Returns the text lines set by the last successful call to SideView#setLines. When a SideView is created, it has no text lines set, and this method returns an empty array.
Source:
Returns:
current text lines
Type
Array.<string>

getTag() → (nullable) {TagOptions}

Returns the tag options from the last successful call to SideView#setTag. If setTag was not previously called, or no call succeeded, returns null.
Source:
Returns:
tag options used previously by setTag
Type
TagOptions

hasSelection() → {boolean}

Checks if the side has any selected lines.
Source:
Returns:
Whether there are any selected lines on this side
Type
boolean

isPreviewEnabled()

Checks if preview is enabled for this side view. When preview is enabled, a translucent version of the tag image or (for side 1, if set) the blank tag image is displayed under the rendered tag outline and text.
Source:
Returns:
whether preview is enabled

repaint()

Repaints the single-side view.
Source:

resetSelection()

Unselects all lines on this side. Does not fire a selection change event.
Source:

resetVisibleUnits()

Resets corners that display the measurement unit switcher to defaults.
Source:

setData(data) → {Promise.<void>}

Sets the complete state of this side view. Any layout customizations are reset to default.
Parameters:
Name Type Description
data SideViewData the new view state
Source:
Returns:
promise that is resolved when the operation completes
Type
Promise.<void>

setFont(font) → {Promise.<void>}

Sets the font for the single-side view.
Parameters:
Name Type Description
font module:TagEditor.Font font identifier
Source:
Returns:
promise that is resolved when the operation completes
Type
Promise.<void>

setLines(textLines) → {Promise.<void>}

Sets the text lines for the single-side view. Any custom layout changes are reset, and the text is relaid out according to the default layout rules.
Parameters:
Name Type Description
textLines Array.<string> text lines to set
Source:
Returns:
promise that is resolved when the operation completes
Type
Promise.<void>

setOnWheel(handler)

Replaces the default mouse wheel handler with handler. The handler listens to the browser wheel event on the canvas element. Inside the handler, this refers to the side view.
Parameters:
Name Type Description
handler jQueryEventHandler the new wheel event handler
Source:

setPreviewEnabled(previewEnabled)

Sets the preview flag for this side view. Repaints the view if necessary.
Parameters:
Name Type Description
previewEnabled true to enable preview, false to disable
Source:

setSelectionEnabled(selectionEnabled)

Enables or disables line selection by user. If selection is disabled, current selection is cleared.
Parameters:
Name Type Description
selectionEnabled boolean true to enable selection, false to disable
Source:

setTag(options) → {Promise.<void>}

Sets the tag for the single-side view. If the side has text on it, and the default layout was not customized, the text is relaid out according to the default layout of the new tag. A custom layout is untouched, so the text will likely not fit the new tag. If desired, a custom layout can be manually reset afterwards using SideView#resetLayout.
Parameters:
Name Type Description
options TagOptions tag options
Source:
Returns:
promise that is resolved when the operation completes
Type
Promise.<void>

setVisibleRulers(visibleRulers)

Specifies which rulers are visible and which are hidden.
Parameters:
Name Type Description
visibleRulers RulerSides flags specifying which rulers are visible
Source:

setVisibleUnits(visibleUnits)

Specifies which corners will display the measurement unit switcher.
Parameters:
Name Type Description
visibleUnits UnitCorners flags specifying which corners show the unit switcher
Source:

showImperialUnits(imperial)

Forces the side view to use metric units (cm) or imperial units (inches) for rulers, replacing the current user selection.
Parameters:
Name Type Description
imperial boolean true to use inches, false to use centimeters
Source:

Type Definitions

outOfBoundsChangeListener(outOfBoundsLines)

Listener for out of bounds change events.
Parameters:
Name Type Description
outOfBoundsLines Array.<number> Indexes of lines that cross the tag bounds (zero-based), empty if none
Source:

selectionChangeListener(selectedLines)

Listener for selection change events.
Parameters:
Name Type Description
selectedLines Array.<number> Indexes of selected lines (zero-based), empty if no selection
Source: