leafer-ui icon indicating copy to clipboard operation
leafer-ui copied to clipboard

Text editor 实现 左右拖动改文本框大小,四个角拖动改文字大小,效果与GD的文本框类似。

Open wuchao288 opened this issue 11 months ago • 4 comments

如题。

wuchao288 avatar Feb 06 '25 06:02 wuchao288

收到,会增加自定义配置功能

leaferjs avatar Feb 06 '25 06:02 leaferjs

可以监听鼠标按下事件,再通过app.editor.editBox.enterPoint.direction 来判断

hbalxzdl avatar Feb 14 '25 02:02 hbalxzdl

可以监听鼠标按下事件,再通过app.editor.editBox.enterPoint.direction 来判断

你实现了吗?可以看看参考代码吗?

wuchao288 avatar Feb 25 '25 02:02 wuchao288

this.app.editor.on(PointerEvent.DOWN, (e) => { if (this.app.editor.list.some(item => item.tag !== 'Text')) return const isDirection = [1, 3, 5, 7].includes(this.app.editor.editBox.enterPoint?.direction) if (isDirection) Text.setEditConfig({ editSize: 'size' }) else Text.setEditConfig({ editSize : 'font-size' }) })

hbalxzdl avatar Feb 25 '25 08:02 hbalxzdl