Pictode offers various plugins to cater to diverse needs.
🕒 History Plugin
Install the @pictode/plugin-history dependency.
npm install @pictode/plugin-selector
Instantiate the historyPlugin plugin.
import { HistoryPlugin } from '@pictode/plugin-history';
const historyPlugin = new HistoryPlugin();
Use the app.use(historyPlugin) method to load the plugin.
app.use(historyPlugin);
You can now implement undo and redo functionality with the app.undo() and app.redo() methods.
✅ Selector Plugin
Install the @pictode/plugin-selector dependency.
npm install @pictode/plugin-selector
Instantiate the selectorPlugin plugin.
import { SelectorPlugin } from '@pictode/plugin-selector';
const selectorPlugin = new SelectorPlugin();
Use the app.use(selectorPlugin) method to load the plugin.
app.use(selectorPlugin);
Implement selecting and deselecting shapes using mouse clicks or the app.select(...) and app.cancelSelect(...) methods. Hold down the Shift key to enable multi-selection and deselection.
🔄 Alignment Tools
Install the @pictode/plugin-alignment dependency.
npm install @pictode/plugin-selector
Instantiate the alignmentPlugin plugin.
import { AlignmentPlugin } from '@pictode/plugin-alignment';
const alignmentPlugin = new AlignmentPlugin();
Use the app.use(alignmentPlugin) method to load the plugin.
app.use(alignmentPlugin);
You can now perform alignment operations using a range of methods, including app.alignTop, app.alignRight, app.alignBottom, app.alignLeft, app.alignCenterX, app.alignCenterY, and more.
Additionally, use app.distributeX and app.distributeY methods to achieve horizontal and vertical distribution.
推荐项目
Pictode是一个基于Konva.js开发的绘图编辑器框架,具备流畅的交互体验,面向开发者提供友好的集成方式和可扩展特点。
也许你已经在网上看到许多技术大咖分享如何实现画板或图片编辑器的方法。他们或许详细解释了编辑器的原理和代码实现,有些甚至直接使用原生Canvas构建编辑器。但你是否和我有相同的感受?
我们既敬佩技术大咖,又感到自己阅读后除了感叹:“🐮🍺!”外收获很少。原因在于我们无法将他们的代码应用到项目中。虽然阅读、点赞和收藏了这些文章,但仍感头脑空空,实际收获有限。
把图形编辑器嵌入自己的项目,有时真麻烦。比如,编辑器用React构建,你的项目用Vue;或者编辑器不够灵活。
Pictode就是你的救星,像🚀一样,解决这些问题,让你事半功倍。
亮点:基于Konva.js库、方便集成、可自定义工具、可自定义插件、与UI框架无关
示例代码:
Pictode offers various plugins to cater to diverse needs.
🕒 History Plugin
@pictode/plugin-history
dependency.✅ Selector Plugin
🔄 Alignment Tools
You can now perform alignment operations using a range of methods, including app.alignTop, app.alignRight, app.alignBottom, app.alignLeft, app.alignCenterX, app.alignCenterY, and more.
Additionally, use app.distributeX and app.distributeY methods to achieve horizontal and vertical distribution.