gpt4 book ai didi

fabricjs - 如何禁用文本框中文本的编辑,但仍然能够选择它。织物 1.6

转载 作者:行者123 更新时间:2023-12-04 17:17:28 34 4
gpt4 key购买 nike

我希望用户能够选择一个 fabric.Textbox 并进行旋转、移动、调整大小等,但不能编辑文本。要编辑文本,用户必须选择文本框对象,然后激活文本编辑(不是在结构中)。
所以我想要的是避免用户可以编辑fabric 中的文本(如fabric.Text)。
有没有办法做到这一点?

最佳答案

canvas = new fabric.Canvas('canvas');
var shape = new fabric.Textbox('i m an not editable textbox', {width: 200, top:0, left:0, editable: false, cursorWidth: 0});
canvas.add(shape);
<script src="http://www.deltalink.it/andreab/fabric/fabric.js"></script>
<canvas id='canvas' width="500" height="400" style="border:#000 1px solid;"></canvas>


fabricjs 文本框子类 itext。
从 iText 文档中您可以看到:
/**
* Indicates whether a text can be edited
* @type Boolean
* @default
*/
editable: true,

为什么仍然出现 te cursors 对我来说是个谜。所以我应用了一个 cursorWidth = 0 来临时修补这个问题。
可能是图书馆本身的问题。

关于fabricjs - 如何禁用文本框中文本的编辑,但仍然能够选择它。织物 1.6,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33215469/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com