元素监听编辑器事件没有触发
Closed this issue · 2 comments
826327700 commented
const textLayer = new Text({
fill: 'rgb(50,205,121)',
text: text,
editable: true,
fontSize: 40,
align: 'center',
visible:false,
})
this.leafer.tree.add(textLayer)
textLayer.on(EditorEvent.SELECT,(e)=>{
console.log("SELECT",e)
})
textLayer.on(EditorScaleEvent.SCALE,(e)=>{
console.log("RESIZE",e)
})
textLayer.on(EditorMoveEvent.MOVE,(e)=>{
console.log("MOVE",e)
})
textLayer.on(PointerEvent.ENTER,(e)=>{
console.log("ENTER",e)//这里可以触发 上面的都不触发
})
我希望监听到编辑器的缩放 移动等事件 用于结合自身的业务逻辑,但是不知道哪里没写对 没有触发。
另外问一下,文字元素,在编辑器缩放时,如何做到文字大小也跟着缩放?
leaferjs commented
- 得在编辑器上监听 app.editor.on(...),单个元素上没有这个事件
- 网站首页的无界云图上做了文字大小跟着缩放,可以去看看,后面我们也会计划支持这个功能
leaferjs commented
已支持文字元素,在编辑器缩放时,如何做到文字大小也跟着缩放, 等待新版本发布~