
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
canvas-palette
Advanced tools
@ 0.0.4
基于Canavs封装画画简单的工具库
ES6 module风格
npm i canvas-palette
import {Palette} from 'canvas-palette'
var palette=new Palette({canavs:'canvasId'})
Palette构造函数参数说明:(支持的参数配置)
canvas设置canavs元素的id
onReady当鼠标在画布上按下时的回调函数
onMove当鼠标在画布上移动时的回调函数
onStop当鼠标在画布上抬起时的回调函数
onClear当画布清空的时候、执行的回调函数
onReady,onMove,onStop三个回调函数、所以依次执行的,onMove不会单独执行、只有onReady之后才会执行!三个回调函数、传回以下信息:
onReadylocation[位置信息]、type[画笔动作类型]、style[当前画笔样式]
onMovelocation[位置信息]、type[画笔动作类型]、style[当前画笔样式]
onStoptype[画笔动作类型]
返回canavs对象
返回当前canvas上下文对象、也就是画笔对象
设置画笔样式
- 支持canvas上下文所有的属性
用于直接在画布上显示画笔动作路径
type画笔动作:move,line,stop
lcaotion画笔位置:x,y
style画笔样式:context所有样式属性
设置为显示模式、即当前画布不能操作
设置为绘制模式、可以进行鼠标绘制操作
清空画布
FAQs
基于Canvas制作画板工具库、用于canvas画画功能
The npm package canvas-palette receives a total of 2 weekly downloads. As such, canvas-palette popularity was classified as not popular.
We found that canvas-palette 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.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.