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
addText(content = "Hello, world!", options = {}) { this.viewer.setMouseNavEnabled(false); // 获取 fabric canvas 实例 const canvas = this.overlay.fabricCanvas(); // 定义默认的文本配置,文本将显示在画布中央 const defaultOptions = { left: canvas.getWidth() / 2, top: canvas.getHeight() / 2, fill: 'black', fontSize: 20, fontWeight: 'normal', selectable: true, // 允许选中以拖动 lockScalingX: false, // 允许水平方向缩放 lockScalingY: false, // 允许垂直方向缩放 lockRotation: false, // 允许旋转 hasControls: true, // 显示控制点(缩放、旋转) }; // 合并用户传入的配置项 const config = { ...defaultOptions, ...options }; // 创建 Fabric 文本对象(确保已引入 fabric 库) const textObj = new Text(content, config); // 将文本对象添加到 canvas 中 canvas.add(textObj); canvas.renderAll(); // 刷新画布 }
Unable to select handles for zoom and rotation
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Unable to select handles for zoom and rotation
The text was updated successfully, but these errors were encountered: