leaferjs / ui

一款好用的 Canvas 渲染引擎,革新的体验。高效绘图 、UI 交互(小游戏、互动应用、组态)、图形编辑。
https://www.leaferjs.com
MIT License
2.33k stars 81 forks source link

原生微信小程序用path实现画笔 在android正常 ios 少部分手机正常 大部分直接闪退 #202

Open nws123045088 opened 1 week ago

nws123045088 commented 1 week ago
801bd896fb501e950381711d035a1b1

//1.画笔ios add闪退 let brush = null; let lastPoint = undefined; this.canvas.tree.on(DragEvent.START, (e) => { if (this.currentTab !== 4) { return; } lastPoint = undefined; brush = new Path({ zIndex: 99, windingRule: "nonzero", fill: this.brush_color || "rgb(7,193,96)", data: { radius: (this.brush_size || 10) / 2, }, }); this.canvas.tree.add(brush); });

//2.橡皮擦 ios add 画布内容直接不见了 let eraser = null; let lastPoint = undefined; this.canvas.tree.on(DragEvent.START, (e) => { if (this.currentTab !== 3) { return; } lastPoint = undefined; eraser = new Path({ zIndex: 99, windingRule: "nonzero", fill: "rgb(255,255,255,0)", eraser: "path", data: { radius: (this.eraser_size || 10) / 2, }, }); this.canvas.tree.add(eraser); });

leaferjs commented 1 week ago

收到,谢谢反馈~, path去掉windingRule属性试试,橡皮擦用'path'类型可以: eraser: 'path'

nws123045088 commented 1 week ago

第一个问题 path去掉windingRule属性可以了 第二个问题无效 我排查下

nws123045088 commented 1 week ago

eraser = new Path({ zIndex: 99, fill: "rgb(255,255,255,1)", // eraser: "path", data: { radius: (this.eraser_size || 10) / 2, }, }); this.canvas.tree.add(eraser); 加了这个eraser: "path", 画布内容就全部没了

nws123045088 commented 1 week ago
1caaff832503ae63e2b6254cda90689