We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
创建的自定义类型的元素,复制时候空白
1、使用createClass创建了一个自定义类(半圆)
export let Semicircle = fabric.util.createClass(fabric.Object, { // 初始化 initialize(options) { this.callSuper('initialize', options); this.width = 100; this.height = 50; }, // 渲染 _render(ctx) { ctx.strokeStyle = this.stroke || '#333'; // 初始化描边颜色 ctx.lineWidth = this.strokeWidth || 1; // 初始化描边宽度 ctx.fillStyle = this.fill || '#333'; // 初始化填充色 ctx.beginPath(); // 开始绘制路径 ctx.arc(0, -25, 50, 0, (180 * Math.PI) / 180); // 绘制半圆 ctx.closePath(); // 结束绘制路径 ctx.stroke(); // 描边 ctx.fill(); // 填充 }, });
2、创建元素
const createBarCodeElement = () => { let semicircle = new Semicircle({ top: 10, left: 10, stroke: '#7bcfa6', // 描边色 fill: '#ed5736', // 填充色 strokeWidth: 10, // 描边宽度 }); // 将半圆添加到画布里 canvasEditor.canvas.add(semicircle); canvasEditor.canvas.setActiveObject(semicircle); };
3、复制这个半圆
The text was updated successfully, but these errors were encountered:
No branches or pull requests
创建的自定义类型的元素,复制时候空白
1、使用createClass创建了一个自定义类(半圆)
2、创建元素
3、复制这个半圆
The text was updated successfully, but these errors were encountered: