Skip to content
On this page

Vext Settings Store

Pinia store that holds settings for different VEXT tools (brush & shape).

State

NameDescriptionTypeValuesDefault
pointerMenuwhether the pointer menu is openboolean-false
onActionwhether to open the pointer menu after an annotation actionboolean-true
onGesturewhether to open the pointer menu after with a specific gestureboolean-true
closeOnClickwhether to close the pointer menu after clicking one of its itemsboolean-true
historyLimithow many interactions to store in the history lognumber-50
activeColorcurrently active color (primary or secondary)number[0,1]0
color0primary colorstring-"#ffffff"
color1secondary colorstring-"#000000"
brushSizesize of the drawing brushnumber-1
brushDecimationhow much to decimate drawn linesnumber-5
shapeselected shape in the shape modestring["text", "circle", "rectangle", "triangle"]"text"
shapeDim0size of the first dimension for the new shapenumber-10
shapeDim1size of the second dimension for the new shapenumber-10
defaultColorsarray of colors to use for layersnumber-["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"]

Getters

color

Returns the currently selected color string.

Methods

emit

Emit an event from the note event handler.
@param {String} name - event name
@param {*} data - event payload

on

Register an event handler.
@param {String} name - event name
@param {Function} hadler - event callback handler
@returns handle id

off

Remove an event handler for the given event.
@param {String} name - event name
@param {Number} handler - event handle
@returns true if the event was removed

defaultColorAt

Returns the default color at a specific index. Colors are wrapped -> starts at the beginning in index is out of bounds.
@param {Number} index - color index
@returns {String} the color

setHistoryLimit

Sets the history interaction limit (minimum value of 1 is enforced)
@param {Number} limit

setBrushSize

Sets the brush size to use for drawing.
@param {Number} size - brush size in pixels
@param {Boolean} record - whether to record this action (default true)

setBrushDecimation

Sets the brush decimation value.
@param {Number} value - value in pixels
@param {Boolean} record - whether to record this action (default true)

selectColor

Select a color by id (either primary = 0 or secondary = 1). If the passed id is not 0 or 1, the selected color is toggled.
@param {Number} id - color id
@param {Boolean} record - whether to record this action (default true)

setColor

Sets the color to use for the currently active color.
@param {String} color - color value
@param {Boolean} record - whether to record this action (default true)

setColorPrimary

Sets the color to use for the primary color.
@param {String} color - color value
@param {Boolean} record - whether to record this action (default true)

setColorSecondary

Sets the color to use for the secondary color.
@param {String} color - color value
@param {Boolean} record - whether to record this action (default true)

setShape

Sets the shape to use in the shape mode
@param {String} shape - shape type
@param {Boolean} record - whether to record this action (default true)