leafer-ui
leafer-ui copied to clipboard
提问:toJSON或者 export 操作之后,交互操作好像都失去了响应
得上复现代码才能排查到原因
const json = box.toJSON();
let rectList = json.children;
rectList = rectList.map(item => {
item.stroke = undefined
return item
})
const leaferSave = new Leafer({
width: this.data.mainBoxSize,
height: this.data.mainBoxSize
}, json)
let nowTime = new Date().getTime()
leaferSave.export(`pixelVerse_${nowTime}.png`).then(res => {
console.log(res)
wx.showToast({
title: '保存成功',
})
})
已经确定就是 export 操作之后导致原来的 leafer 无法交互
之前的版本的leafer传入json会有这个问题,最新版已经修复了
const json = box.toJSON();
let rectList = json.children;
rectList = rectList.map(item => {
item.stroke = undefined
return item
})
let leaferSave = new Leafer({
width: this.data.mainBoxSize,
height: this.data.mainBoxSize
})
const group = new Group(json)
leaferSave.add(group)
let nowTime = new Date().getTime()
leaferSave.export(`custom_${nowTime}.png`,{}).then(res => {
wx.showToast({
title: '保存成功',
})
})
通过注释代码排查 只要我创建了第二个 leafer(离屏画布) 就会导致页面上的 canvans 所创建的 leafer 无法操作
收到,谢谢反馈~, 后面修复下