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

【Bug】: 使用resizeWidth和resizeHeight设置0的时候,坐标信息会丢失。

Open xhq2025 opened this issue 8 months ago • 2 comments

// #调整 Group 大小,不使用 scale 属性 import { Leafer, Group, Rect, Ellipse } from 'leafer-ui' import '@leafer-in/resize' // 导入 resize 插件

const leafer = new Leafer({ view: window })

const group = new Group({ children: [ new Rect({ width: 100, height: 100, fill: '#32cd79', draggable: true }), new Ellipse({ x: 500, y: 500, width: 100, height: 100, innerRadius: 0.5, fill: "#FEB027" }) ] })

leafer.add(group)

setTimeout(() => { // resize group group.resizeWidth(0)
group.resizeHeight(0) setTimeout(() => {

    // resize group
    group.resizeWidth(200)  
    group.resizeHeight(200)
}, 200)

}, 1000)

快速入口:https://www.leaferjs.com/examples/#official%2Fproperty%2Fresize%2Fgroup.ts 出现的问题: 给group设置resizeWidth和resizeHeight为0后 Ellipse图形 的 x和y 由500变成 0了 控制台抛出NaN的警告。

xhq2025 avatar Apr 24 '25 01:04 xhq2025

谢谢反馈~

leaferjs avatar Apr 24 '25 01:04 leaferjs

已修复,设置为0不生效,防止产生异常

leaferjs avatar Apr 25 '25 07:04 leaferjs