场景画布缩放监听
This commit is contained in:
parent
d75e16db82
commit
1d5221dffb
@ -1226,12 +1226,12 @@ class VectorGraphicUtil {
|
|||||||
const registerScaleChange = function registerScaleChange(obj) {
|
const registerScaleChange = function registerScaleChange(obj) {
|
||||||
if (!obj.scaledListenerOn) {
|
if (!obj.scaledListenerOn) {
|
||||||
obj.scaledListenerOn = true;
|
obj.scaledListenerOn = true;
|
||||||
obj.getGraphicApp().on('viewport-scaled', onScaleChange);
|
obj.getCanvas().scene.on('viewport-scaled', onScaleChange);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const unregisterScaleChange = function unregisterScaleChange(obj) {
|
const unregisterScaleChange = function unregisterScaleChange(obj) {
|
||||||
obj.scaledListenerOn = false;
|
obj.scaledListenerOn = false;
|
||||||
obj.getGraphicApp().off('viewport-scaled', onScaleChange);
|
obj.getCanvas().scene.off('viewport-scaled', onScaleChange);
|
||||||
};
|
};
|
||||||
obj.onAddToCanvas = function onAddToCanvas() {
|
obj.onAddToCanvas = function onAddToCanvas() {
|
||||||
obj.updateOnScaled();
|
obj.updateOnScaled();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "graphic-pixi",
|
"name": "graphic-pixi",
|
||||||
"version": "0.1.8",
|
"version": "0.1.9",
|
||||||
"description": "基于pixijs的图形应用、绘制应用框架",
|
"description": "基于pixijs的图形应用、绘制应用框架",
|
||||||
"productName": "Graphic-pixi",
|
"productName": "Graphic-pixi",
|
||||||
"author": "walker <shengxuqiang@joylink.club>",
|
"author": "walker <shengxuqiang@joylink.club>",
|
||||||
|
@ -18,14 +18,14 @@ export class VectorGraphicUtil {
|
|||||||
): void {
|
): void {
|
||||||
if (!obj.scaledListenerOn) {
|
if (!obj.scaledListenerOn) {
|
||||||
obj.scaledListenerOn = true;
|
obj.scaledListenerOn = true;
|
||||||
obj.getGraphicApp().on('viewport-scaled', onScaleChange);
|
obj.getCanvas().scene.on('viewport-scaled', onScaleChange);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const unregisterScaleChange = function unregisterScaleChange(
|
const unregisterScaleChange = function unregisterScaleChange(
|
||||||
obj: VectorGraphic
|
obj: VectorGraphic
|
||||||
): void {
|
): void {
|
||||||
obj.scaledListenerOn = false;
|
obj.scaledListenerOn = false;
|
||||||
obj.getGraphicApp().off('viewport-scaled', onScaleChange);
|
obj.getCanvas().scene.off('viewport-scaled', onScaleChange);
|
||||||
};
|
};
|
||||||
obj.onAddToCanvas = function onAddToCanvas() {
|
obj.onAddToCanvas = function onAddToCanvas() {
|
||||||
obj.updateOnScaled();
|
obj.updateOnScaled();
|
||||||
|
Loading…
Reference in New Issue
Block a user