diff --git a/lib/index.js b/lib/index.js index ad87389..4b49821 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1242,9 +1242,11 @@ class VectorGraphicUtil { unregisterScaleChange(obj); }; obj.on('added', (container) => { - if (container.isInCanvas()) { - obj.onAddToCanvas(container.getCanvas()); - } + setTimeout(() => { + if (container.isInCanvas()) { + obj.onAddToCanvas(container.getCanvas()); + } + }, 0); }); } } diff --git a/package.json b/package.json index 71f8088..f692b74 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "graphic-pixi", - "version": "0.1.9", + "version": "0.1.10", "description": "基于pixijs的图形应用、绘制应用框架", "productName": "Graphic-pixi", "author": "walker ", diff --git a/src/graphic/VectorGraphic.ts b/src/graphic/VectorGraphic.ts index d479182..4e89597 100644 --- a/src/graphic/VectorGraphic.ts +++ b/src/graphic/VectorGraphic.ts @@ -37,9 +37,11 @@ export class VectorGraphicUtil { }; obj.on('added', (container) => { - if (container.isInCanvas()) { - obj.onAddToCanvas(container.getCanvas()); - } + setTimeout(() => { + if (container.isInCanvas()) { + obj.onAddToCanvas(container.getCanvas()); + } + }, 0); }); } }