leaferjs / leafer-ui

一款好用的 Canvas 引擎,革新的开发体验,用于高效绘图 、UI 交互、图形编辑。A user-friendly Canvas engine with a revolutionary development experience, for efficient drawing, UI interactions, and graphic editing.
https://www.leaferjs.com
MIT License
2.52k stars 89 forks source link

使用交互状态插件(@leafer-in/state)时, 在画布销毁(destroy)时会报错 #229

Closed daLeiStrive closed 1 month ago

daLeiStrive commented 1 month ago

报错: image

重现链接: https://cloudstudio.net/a/22120760675344384?channel=share&sharetype=URL 重现代码:

import { App, Rect } from 'leafer-ui'
// 放开这句话等待5秒页面销毁的时候会报错
// import '@leafer-in/state'
import 'leafer-editor'

const app = new App({ view: window, tree: {},  editor: {},})

const rect = new Rect({
    x: 100,
    y: 100,
    width: 200,
    height: 200,
    fill: '#32cd79',
    cornerRadius: [50, 80, 0, 80],
    draggable: true,
    hoverStyle: {
        fill: 'rgba(50,205,121, 0.8)',
        cornerRadius: [0, 0, 0, 0],
    }
})

app.tree.add(rect)

setTimeout(() => {

    console.log('开始销毁')
    app.destroy()
    console.log('销毁完成')
}, 1000 * 5)
leaferjs commented 1 month ago

收到,谢谢反馈~

leaferjs commented 1 month ago

已修复,需要更新到新版本~