Fixed reference bug.

This commit is contained in:
2020-01-09 15:14:27 +01:00
parent d5b87f23cf
commit f398fe4824
5 changed files with 128 additions and 185 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ import { Points } from '../../utils.js'
import { EventHandler } from './utils.js'
import { FlagPolygon } from '../graphics/label.js'
import { DeepZoomMap } from './map.js'
import { PIXIUtils } from '../../../../js/pixi/utils.js'
import { PIXIUtils } from './utils.js'
/**
* * GeoGraphics are graphical objects, that does not store the graphics information
+3 -3
View File
@@ -225,9 +225,9 @@ export default class MapApp extends PIXIApp {
sceneFactory() {
return new RigidScatterContainer(this.width, this.height, this.renderer, {
app: this,
showBounds: true,
showTouches: true,
showPolygon: true,
showBounds: false,
showTouches: false,
showPolygon: false,
container: this
})
}
+25
View File
@@ -258,6 +258,31 @@ export class Vector {
}
}
export class PIXIUtils {
/*
* Transform a pixi text to it's actual screensize,
* ignoring it's local transforms
*/
static toScreenFontSize(pixiText, fontSize = null) {
pixiText._recursivePostUpdateTransform();
let normalizedScale = {
x: pixiText.scale.x / pixiText.transform.worldTransform.a,
y: pixiText.scale.x / pixiText.transform.worldTransform.d
};
pixiText.scale = { x: normalizedScale.x, y: normalizedScale.y };
if (fontSize) pixiText.style.fontSize = fontSize;
}
static saveFill(graphics) {
return {
fill: graphics.fill.color,
alpha: graphics.fill.alpha
}
}
}
/**
* The EventHandler class is used to take care of a event based design
* pattern. Callbacks can subscribe to an event and these unknown sources