Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
angular-canvas-painter
Advanced tools
Angular.js directive to paint on a canvas on desktop or touch devices
Angular.js directive to paint on a canvas on desktop or touch devices
bower install angular-canvas-painter
dist/angular-canvas-painter(.min).js
from bower_components/angular-canvas-painter/dist
.pw.canvas-painter
as an angular module dependency.pw-canvas
directive in your template to create the painting canvas.pw-color-selector
directive to choose colors from.####pwCanvas
<div pw-canvas options="{width: 400, height: 300, color: '#ff0'}"></div>
{
width: 400, //px
height: 300, //px
backgroundColor: '#fff',
color: '#000',
lineWidth: 1, //px
opacity: 0.9, //0-1
undo: false // boolean or a number of versions to keep in memory
imageSrc: 'images/example.jpg', // loads the specified image and sets it as background image,
customCanvasId: 'myCustomId' // define a custom value for the id attribute of the canvas element (default: 'pwCanvasMain')
}
To enable the undo function set undo: true
in the options and provide a version
attribute:
<div pw-canvas options="{undo: true, width: 400, height: 300, color: '#ff0'}" version="model.version"></div>
The version attribute will always be set to the amount of available versions in memory. To undo a stroke just decrease the version number in your surrounding controller e.g. model.version = model.version - 1
. To jump back 3 versions set model.version = model.version - 3
.
You can set a maximum number of saved versions to prevent too much memory consumption by setting a number instead of true
in the options, e.g. {undo: 20}
####pwColorSelector
<div pw-color-selector="['#000', '#00f', '#0f0', '#f00']" color="selectedColor"></div>
To use pwColorSelector
with pwCanvas
set the color option in pwCanvas
to the color variable of the selecot:
<div pw-canvas options="{color: model.myColor}"></div>
<div pw-color-selector="['#000', '#00f', '#0f0', '#f00']" color="model.myColor"></div>
The drawing algorithm to produce clear and smooth edges is based on a great article by Rishabh
MIT
FAQs
Angular.js directive to paint on a canvas on desktop or touch devices
The npm package angular-canvas-painter receives a total of 102 weekly downloads. As such, angular-canvas-painter popularity was classified as not popular.
We found that angular-canvas-painter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.