场景画布缩放监听
This commit is contained in:
parent
d75e16db82
commit
1d5221dffb
@ -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();
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "graphic-pixi",
|
||||
"version": "0.1.8",
|
||||
"version": "0.1.9",
|
||||
"description": "基于pixijs的图形应用、绘制应用框架",
|
||||
"productName": "Graphic-pixi",
|
||||
"author": "walker <shengxuqiang@joylink.club>",
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user