@kba/xrx-vue v0.0.22
canvas-editor
Draw shapes on a canvas using SemToNotes
- Build Setup
- API
Properties
widthheightenable-thumbthumb-widththumb-backgroundthumb-heightthumb-timeoutshow-toolbarshow-toolbar-modesshow-toolbar-mode-listshow-toolbar-modesshow-toolbar-shapesshow-toolbar-fileshow-toolbar-zoomshow-toolbar-rotatezoom-factor-maxinitial-zoominitial-svginitial-imageinitia-modexrx-stylethumb-xrx-styleEventsviewbox-changedshape-modified(shape)shape-created(shape)shape-selected(shape)shape-activated(shape)shape-hover-in(shape)shape-hover-out(shape)mode-changed(from, to)svg-changed(svg)zoom-changed(now, before)MethodsloadImage(img)setMode(mode, ...args)zoom(amount)rotate(amount)applyStyles()drawShape(shapeName)removeSelectedcopySelected()showImport()showExport()loadSvg(svg)exportSvg()showImageModal()*showThumb()
Build Setup
npm install
webpackAPI
Properties
width
Width of the canvas (not the image). Default: 600
height
Height of the canvas (not the image). Default: 400
enable-thumb
Whether the thumb navigation is enabled. Defaut: true
thumb-width
Width of the nav thumb (not the thumbnail image). Default: 120
thumb-background
Fixed thumbnail image. Default: '' (none, use current canvas image)
thumb-height
Height of the nav thumb (not the thumbnail image). Default: 120
thumb-timeout
Time in ms after which to hide the thumb. Default: 1000
show-toolbar
Whether to show or hide the complete toolbar. Default: true
show-toolbar-modes
Whether to show the modes toolbar. Default: true
show-toolbar-mode-list
Whether to show the list of modes. Default: false
show-toolbar-modes
Whether to show the modes toolbar. Default: true
show-toolbar-shapes
Whether to show the shapes toolbar. Default: true
show-toolbar-file
Whether to show the file toolbar. Default: true
show-toolbar-zoom
Whether to show the zoom toolbar. Default: true
show-toolbar-rotate
Whether to show the rotate toolbar. Default: true
zoom-factor-max
Maximum zoom factor. Default: 4
initial-zoom
Initial zoom. Default: 1 (== 100%)
initial-svg
Initial SVG value
initial-image
Initial background image to load.
initia-mode
Initial mode. Default HoverMult
xrx-style
Styles to use for shapes in image. Default: [see source]
thumb-xrx-style
Styles to use for thumb shapes. Default: {}
Events
viewbox-changed
The viewbox (visible layer) has changed.
shape-modified(shape)
An existing shape shape was changed.
shape-created(shape)
A new shape shape was created.
shape-selected(shape)
A shape shape has been selected by the user.
shape-activated(shape)
Shape shape is modifiable and has been activated
shape-hover-in(shape)
mouseenter on the shape.
shape-hover-out(shape)
mouseleave on the shape.
mode-changed(from, to)
The mode changed, it was from, now it is to.
svg-changed(svg)
The SVG changed to svg
zoom-changed(now, before)
Zoom value changed from before to now
Methods
loadImage(img)
@param String imgURL of the image. Defaults tothis.imageBackgroundwhich defaults toinitialImage
setMode(mode, ...args)
Sets the mode, passing further args to setXXXMode
zoom(amount)
Change the zoom level of the viewbox.
amount can be
into zoom inoutto zoom outfitto make the image fit the canvaswidthto make the image width fit the canvasheightto make the image height fit the canvas- a number between
0andzoomFactorMaxto zoom to that value
rotate(amount)
Rotate the canvas Left or Right.
applyStyles()
Apply the defined style to all the shapes
drawShape(shapeName)
shapeName can be one of:
PolygonPolylineLineRectCircleEllipse
removeSelected
Remove the currently selected shape
copySelected()
Copy the currently selected shape
showImport()
Show the import modal
showExport()
Show the export modal
loadSvg(svg)
Load the SVG
exportSvg()
Export the SVG
showImageModal()
Show the modal that allows changing the image url
showThumb()
Show the navigation thumbnail and hide it again after
thumbTimeout
8 years ago
8 years ago
8 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
