npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@kba/xrx-vue

v0.0.22

Published

Draw shapes on canvases with semtonotes in Vue

Downloads

27

Readme

canvas-editor

Draw shapes on a canvas using SemToNotes

DEMO

Build Setup

npm install
webpack

API

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 img URL of the image. Defaults to this.imageBackground which defaults to initialImage

setMode(mode, ...args)

Sets the mode, passing further args to setXXXMode

zoom(amount)

Change the zoom level of the viewbox.

amount can be

  • in to zoom in
  • out to zoom out
  • fit to make the image fit the canvas
  • width to make the image width fit the canvas
  • height to make the image height fit the canvas
  • a number between 0 and zoomFactorMax to 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:

  • Polygon
  • Polyline
  • Line
  • Rect
  • Circle
  • Ellipse

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