-
Notifications
You must be signed in to change notification settings - Fork 229
Closed
Labels
Description
因为 #2064 的原因 ,我只能手写导出导出方法,我发现了调用setPosition的问题。示例代码如下:
import { DisplayObject } from "@antv/g";
DisplayObject.prototype.toJSON = function () {
const { x, y } = this.style;
console.log(x, y);
};
const rect = new Rect({
style: {
x: 10,
y: 10,
width: 300,
height: 200,
fill: "#1890FF",
stroke: "#F04864",
lineWidth: 4,
radius: 8,
}
});
rect.style.x = 1;
rect.setPosition(111, 222);
rect.style.y = 3;
console.log(rect.style.x); // 应该打印 111,此处打印的是 1
console.log(rect.style.y); // 打印为 3,无错误
// rect.toJSON();Reactions are currently unavailable