Fixed overlay example to work with restructured GeoLayers.
This commit is contained in:
parent
87727d28b9
commit
0a30712e31
18
dist/iwmlib.pixi.js
vendored
18
dist/iwmlib.pixi.js
vendored
@ -17809,7 +17809,6 @@
|
||||
* @param {ScatterEvent}[e] - Contains informations on how the element was transformed.
|
||||
*/
|
||||
transformed(e) {
|
||||
console.log(this.name);
|
||||
this.onTransform.call(this, e);
|
||||
}
|
||||
|
||||
@ -18023,7 +18022,6 @@
|
||||
y: frame.height / 2
|
||||
};
|
||||
|
||||
console.log(frame);
|
||||
frame.center = {
|
||||
x: frame.x + frame.localCenter.x,
|
||||
y: frame.y + frame.localCenter.y
|
||||
@ -18574,7 +18572,6 @@
|
||||
|
||||
get zoomFactor() {
|
||||
let factor = this.baseZoomHeight / this.sprite.texture.height;
|
||||
console.log(factor);
|
||||
return factor
|
||||
}
|
||||
}
|
||||
@ -18611,7 +18608,6 @@
|
||||
}
|
||||
|
||||
transformed(map) {
|
||||
console.log('MAPVIEW RECEIVED TRANSFORM');
|
||||
this.updateZoom(map);
|
||||
this.updateFocusPoint(map);
|
||||
}
|
||||
@ -18634,7 +18630,6 @@
|
||||
if (map instanceof DeepZoomMap) this._zoom = map.floatingLevelForScale(map.image.scatter.scale);
|
||||
else {
|
||||
this._zoom = map.zoom;
|
||||
console.warn('Zoom is not yet correctly implemented in this Map type: ' + map);
|
||||
}
|
||||
}
|
||||
|
||||
@ -19681,6 +19676,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
addChild(element) {
|
||||
this.displayObject.addChild(element);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adapts to a map. If the maplayer should adapt to the parent maplayer,
|
||||
* no parameter must be specified.
|
||||
@ -19888,8 +19887,10 @@
|
||||
this.adapt();
|
||||
|
||||
this.changeHandler.call(this, map, oldMap);
|
||||
this.map.onTransform.add(this.transformed.bind(this));
|
||||
|
||||
//Call transform one time manually.
|
||||
this.transformed();
|
||||
this.map.onTransform.add(this.transformed.bind(this));
|
||||
} else {
|
||||
console.error("Could not set map, it's not of type GeoMap.", map);
|
||||
}
|
||||
@ -20757,7 +20758,6 @@
|
||||
}
|
||||
|
||||
this.mapList = new MapList(opts.startmap ? opts.startmap : null, opts.maps ? opts.maps : {});
|
||||
console.log(this.mapList);
|
||||
|
||||
this._setupKeyboardUtils();
|
||||
}
|
||||
@ -20910,7 +20910,6 @@
|
||||
// }
|
||||
// })
|
||||
|
||||
console.log(this.map);
|
||||
this.map.onTransform.add(this.transformed.bind(this));
|
||||
|
||||
this.transformed();
|
||||
@ -20920,7 +20919,6 @@
|
||||
const parent = this.ui.parent;
|
||||
parent.removeChild(this.ui);
|
||||
parent.addChild(this.ui);
|
||||
console.log('BRING TO FRONT!');
|
||||
}
|
||||
}
|
||||
|
||||
@ -21755,7 +21753,7 @@
|
||||
adjustItems = null
|
||||
} = {}) {
|
||||
const name = this.name[0].toUpperCase() + this.name.slice(1).toLowerCase() + ' Overlay';
|
||||
let geoLayer = new GeoLayer({ name });
|
||||
let geoLayer = new GeoLayer(new PIXI.Container(), { name });
|
||||
if (this.rescale) geoLayer.rescale = this.rescale;
|
||||
this.items.forEach(item => {
|
||||
if (!excludeItems(item)) {
|
||||
|
@ -41,6 +41,10 @@ export class GeoLayer {
|
||||
}
|
||||
}
|
||||
|
||||
addChild(element) {
|
||||
this.displayObject.addChild(element)
|
||||
}
|
||||
|
||||
/**
|
||||
* Adapts to a map. If the maplayer should adapt to the parent maplayer,
|
||||
* no parameter must be specified.
|
||||
@ -248,8 +252,10 @@ export class MapLayer extends GeoLayer {
|
||||
this.adapt()
|
||||
|
||||
this.changeHandler.call(this, map, oldMap)
|
||||
this.map.onTransform.add(this.transformed.bind(this))
|
||||
|
||||
//Call transform one time manually.
|
||||
this.transformed()
|
||||
this.map.onTransform.add(this.transformed.bind(this))
|
||||
} else {
|
||||
console.error("Could not set map, it's not of type GeoMap.", map)
|
||||
}
|
||||
|
@ -148,7 +148,6 @@ export class GeoMap {
|
||||
* @param {ScatterEvent}[e] - Contains informations on how the element was transformed.
|
||||
*/
|
||||
transformed(e) {
|
||||
console.log(this.name)
|
||||
this.onTransform.call(this, e)
|
||||
}
|
||||
|
||||
@ -362,7 +361,6 @@ export class GeoMap {
|
||||
y: frame.height / 2
|
||||
}
|
||||
|
||||
console.log(frame)
|
||||
frame.center = {
|
||||
x: frame.x + frame.localCenter.x,
|
||||
y: frame.y + frame.localCenter.y
|
||||
@ -913,7 +911,6 @@ export class ImageMap extends GeoMap {
|
||||
|
||||
get zoomFactor() {
|
||||
let factor = this.baseZoomHeight / this.sprite.texture.height
|
||||
console.log(factor)
|
||||
return factor
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,6 @@ export default class MapApp extends PIXIApp {
|
||||
}
|
||||
|
||||
this.mapList = new MapList(opts.startmap ? opts.startmap : null, opts.maps ? opts.maps : {})
|
||||
console.log(this.mapList)
|
||||
|
||||
this._setupKeyboardUtils()
|
||||
}
|
||||
@ -238,7 +237,6 @@ export default class MapApp extends PIXIApp {
|
||||
// }
|
||||
// })
|
||||
|
||||
console.log(this.map)
|
||||
this.map.onTransform.add(this.transformed.bind(this))
|
||||
|
||||
this.transformed()
|
||||
@ -248,7 +246,6 @@ export default class MapApp extends PIXIApp {
|
||||
const parent = this.ui.parent
|
||||
parent.removeChild(this.ui)
|
||||
parent.addChild(this.ui)
|
||||
console.log('BRING TO FRONT!')
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,6 @@ export default class MapView {
|
||||
}
|
||||
|
||||
transformed(map) {
|
||||
console.log('MAPVIEW RECEIVED TRANSFORM')
|
||||
this.updateZoom(map)
|
||||
this.updateFocusPoint(map)
|
||||
}
|
||||
@ -55,7 +54,6 @@ export default class MapView {
|
||||
if (map instanceof DeepZoomMap) this._zoom = map.floatingLevelForScale(map.image.scatter.scale)
|
||||
else {
|
||||
this._zoom = map.zoom
|
||||
console.warn('Zoom is not yet correctly implemented in this Map type: ' + map)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,6 @@
|
||||
new PIXI.Sprite(textures.get(osmworld)),
|
||||
worlOSMData,
|
||||
{
|
||||
cover: false,
|
||||
onLoaded: () => {
|
||||
worldOSMMap.setFrame(frame)
|
||||
}
|
||||
@ -237,7 +236,7 @@
|
||||
// When placed on the mapLayer, the PIXI Graphic elements, that
|
||||
// reside inside GeoGraphic Objects are placed automatically at the
|
||||
// correct coordinates of the map.
|
||||
pointApp.mapLayer.place(exampleOverlayGeoLayer)
|
||||
pointApp.mapLayer.addLayer(exampleOverlayGeoLayer)
|
||||
|
||||
|
||||
// Just a helper function that clears the popups and removes
|
||||
|
@ -186,7 +186,7 @@ export default class Overlay {
|
||||
adjustItems = null
|
||||
} = {}) {
|
||||
const name = this.name[0].toUpperCase() + this.name.slice(1).toLowerCase() + ' Overlay'
|
||||
let geoLayer = new GeoLayer({ name })
|
||||
let geoLayer = new GeoLayer(new PIXI.Container(), { name })
|
||||
if (this.rescale) geoLayer.rescale = this.rescale
|
||||
this.items.forEach(item => {
|
||||
if (!excludeItems(item)) {
|
||||
|
Loading…
Reference in New Issue
Block a user