A two-side view without toolbars.
Methods
addChangeListener(listener)
Registers a data change listener with this two-side view.
Parameters:
Name | Type | Description |
---|---|---|
listener |
TwoSideView~changeListener | listener to register |
addOutOfBoundsChangeListener(listener)
Registers an out of bounds change listener with this two-side view.
Parameters:
Name | Type | Description |
---|---|---|
listener |
TwoSideView~outOfBoundsChangeListener | listener to register |
addSelectionChangeListener(listener)
Registers a selection change listener with this two-side view.
Parameters:
Name | Type | Description |
---|---|---|
listener |
TwoSideView~selectionChangeListener | listener to register |
getData() → {TwoSideViewData}
Returns the complete state of this two-side view.
Returns:
the current view state
- Type
- TwoSideViewData
getFont() → {module:TagEditor.Font}
Returns the font set by the last successful call to TwoSideView#setFont. When a
TwoSideView
is created, the font is set to ENGRAVE
by default.
Returns:
the current font
- Type
- module:TagEditor.Font
getLines() → {TwoSideLines}
Returns the text lines set by the last successful call to TwoSideView#setLines. When a
TwoSideView
is created, it has no text lines set, and this method returns an empty array.
Returns:
current text lines
- Type
- TwoSideLines
getSide1() → {SideView}
Gets the side 1 view used by this two-side view.
Returns:
the side 1 view
- Type
- SideView
getSide2() → {SideView}
Gets the side 2 view used by this two-side view.
Returns:
the side 1 view
- Type
- SideView
getTag() → (nullable) {TagOptions}
Returns the tag options from the last successful call to TwoSideView#setTag. If
setTag
was not previously called, or no call succeeded, returns null
.
Returns:
tag options used previously by
setTag
- Type
- TagOptions
getZoomer() → {Zoomer}
Gets the zoomer associated with this two-side view.
Returns:
the zoomer
- Type
- Zoomer
hasSelection() → {boolean}
Checks if the view has any selected lines.
Returns:
Whether there are any selected lines on either side of the view
- Type
- boolean
isAutoHideSide2() → {boolean}
Returns whether side 2 should be automatically hidden upon when this tag view displays a single-side tag.
Returns:
whether to automatically hide side 2
- Type
- boolean
isPreviewEnabled() → {boolean}
Checks if preview is enabled for this two-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.
Returns:
whether preview is enabled
- Type
- boolean
repaint()
Repaints the two-side view.
resetSelection()
Unselects all lines on both sides of the view. Does not fire a selection change event.
resetVisibleUnits()
Resets corners that display the measurement unit switcher to defaults.
setAutoHideSide2(autoHideSide2)
Sets a flag specifying whether side 2 should be automatically hidden upon when this tag view displays a
single-side tag. If necessary, shows or hides side 2 depending on the current tag and the new setting.
By default, side 2 is not automatically hidden.
Parameters:
Name | Type | Description |
---|---|---|
autoHideSide2 |
boolean | whether to automatically hide side 2 |
setData(data) → {Promise.<void>}
Asynchronously sets the complete state of this two-side view.
Parameters:
Name | Type | Description |
---|---|---|
data |
SideViewData | the new view state |
Returns:
promise that is resolved when the operation completes
- Type
- Promise.<void>
setFont(font) → {Promise.<void>}
Asynchronously sets the font for the two-side view. Arguments are identical to single-side.
Parameters:
Name | Type | Description |
---|---|---|
font |
module:TagEditor.Font | the font to set (e.g. "ENGRAVE" or "UNICODE") |
Returns:
promise resolved after the operation completes
- Type
- Promise.<void>
setLines(textLines) → {Promise.<void>}
Asynchronously sets the text for the two-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 |
TwoSideLines | text lines to set |
Returns:
promise resolved after 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
two-side view.
Parameters:
Name | Type | Description |
---|---|---|
handler |
jQueryEventHandler | the new wheel event handler |
setPreviewEnabled(previewEnabled)
Sets the preview flag for this two-side view. Repaints the view if necessary.
Parameters:
Name | Type | Description |
---|---|---|
previewEnabled |
true to enable preview, false to disable |
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 |
setTag(options) → {Promise.<void>}
Asynchronously sets the tag for the two-side view. Arguments are identical to single-side.
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 TwoSideView#resetLayout.
Parameters:
Name | Type | Description |
---|---|---|
options |
TagOptions | tag options |
Returns:
promise resolved after the operation completes
- Type
- Promise.<void>
setVisibleRulers(visibleRulers)
Specifies which rulers are visible and which are hidden.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
visibleRulers |
object | flags specifying which rulers are visible
Properties
|
setVisibleUnits(visibleUnits)
Specifies which corners will display the measurement unit switcher.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
visibleUnits |
object | flags specifying which corners show the unit switcher
Properties
|
showImperialUnits(imperial)
Forces the two-side view to use metric units (cm) or imperial units (inches) for rulers on both sides,
replacing the current user selection (which can be different for each side).
Parameters:
Name | Type | Description |
---|---|---|
imperial |
true to use inches, false to use centimeters |
Type Definitions
changeListener(side, otherSide)
Listener for data change events.
Parameters:
Name | Type | Description |
---|---|---|
side |
SideView | the side the event was fired for |
otherSide |
SideView | the side the event was not fired for |
outOfBoundsChangeListener(outOfBoundsLines, side, otherSide)
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 |
side |
SideView | the side the event was fired for |
otherSide |
SideView | the side the event was not fired for |
selectionChangeListener(selectedLines, side, otherSide)
Listener for selection change events.
Parameters:
Name | Type | Description |
---|---|---|
selectedLines |
Array.<number> | Indexes of selected lines (zero-based), empty if no selection |
side |
SideView | the side the event was fired for |
otherSide |
SideView | the side the event was not fired for |