diff --git a/lib/index.js b/lib/index.js index 0497a97..ad87389 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1226,12 +1226,12 @@ class VectorGraphicUtil { const registerScaleChange = function registerScaleChange(obj) { if (!obj.scaledListenerOn) { obj.scaledListenerOn = true; - obj.getGraphicApp().on('viewport-scaled', onScaleChange); + obj.getCanvas().scene.on('viewport-scaled', onScaleChange); } }; const unregisterScaleChange = function unregisterScaleChange(obj) { obj.scaledListenerOn = false; - obj.getGraphicApp().off('viewport-scaled', onScaleChange); + obj.getCanvas().scene.off('viewport-scaled', onScaleChange); }; obj.onAddToCanvas = function onAddToCanvas() { obj.updateOnScaled(); diff --git a/package.json b/package.json index 81147b5..71f8088 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "graphic-pixi", - "version": "0.1.8", + "version": "0.1.9", "description": "基于pixijs的图形应用、绘制应用框架", "productName": "Graphic-pixi", "author": "walker ", diff --git a/src/graphic/VectorGraphic.ts b/src/graphic/VectorGraphic.ts index d6c057c..d479182 100644 --- a/src/graphic/VectorGraphic.ts +++ b/src/graphic/VectorGraphic.ts @@ -18,14 +18,14 @@ export class VectorGraphicUtil { ): void { if (!obj.scaledListenerOn) { obj.scaledListenerOn = true; - obj.getGraphicApp().on('viewport-scaled', onScaleChange); + obj.getCanvas().scene.on('viewport-scaled', onScaleChange); } }; const unregisterScaleChange = function unregisterScaleChange( obj: VectorGraphic ): void { obj.scaledListenerOn = false; - obj.getGraphicApp().off('viewport-scaled', onScaleChange); + obj.getCanvas().scene.off('viewport-scaled', onScaleChange); }; obj.onAddToCanvas = function onAddToCanvas() { obj.updateOnScaled();