Removed overdoscaling from SubmapScatter.

This commit is contained in:
Severin Opel 2019-11-21 09:48:14 +01:00
parent 4d6d2f1df0
commit 88048f14ec
3 changed files with 127 additions and 37 deletions

52
dist/iwmlib.js vendored
View File

@ -608,6 +608,19 @@
static toLine(event) {
return `${event.type} #${event.target.id} ${event.clientX} ${event.clientY}`
let result = event.type;
let selector = this.selector(event.target);
result += ' selector: ' + selector;
if (event.target != document.querySelector(selector)) console.log('Cannot resolve', selector);
let keys = ['layerX', 'layerY', 'pageX', 'pageY', 'clientX', 'clientY'];
for (let key of keys) {
try {
result += ' ' + key + ':' + event[key];
} catch (e) {
console.log('Invalid key: ' + key);
}
}
return result
}
static compareExtractedWithSimulated() {
@ -2627,6 +2640,25 @@
result[id] = this.getPosition(event);
break
}
// case 'TouchEvent':
// // Needs to be observed: Perhaps changedTouches are all we need. If so
// // we can remove the touchEventKey default parameter
// if (touchEventKey == 'all') {
// for(let t of event.targetTouches) {
// result[t.identifier.toString()] = this.getPosition(t)
// }
// for(let t of event.changedTouches) {
// result[t.identifier.toString()] = this.getPosition(t)
// }
// }
// else {
// for(let t of event.changedTouches) {
// result[t.identifier.toString()] = this.getPosition(t)
// }
// }
// break
default:
break
}
return result
}
@ -5722,6 +5754,8 @@
let bottom = parseFloat(this.element.style.bottom);
this.element.style.bottom = bottom - delta.y + 'px';
break
default:
break
}
//console.log("onResize", this.onResize)
if (this.onResize) {
@ -6144,6 +6178,8 @@
x = bbRight;
if (!this.useEventPosWithBoundingBox) y = (bbTop + bbBottom) / 2;
break
default:
break
}
}
@ -6199,6 +6235,8 @@
x += this.notchSize * 2;
x += this.posOffset;
break
default:
break
}
this.placeOrigin(x, y);
}
@ -11063,6 +11101,20 @@
}
speak() {
/**
* This is a little bit ugly, but imho the most elegant of all dirty solutions.
*
5ht * Within the plugins we have no knowledge of other cards and such. But must differentiate the
* clicks by their corresponding owner. The SpeechUtterance just takes a text and has no knowledge
* about the node that is currently read to the user.
*
* This means, that we can identify same text, but not differentiate same text on different nodes.
* To account for that, we add the node to the speechSynthesis object (#benefitsOfJavaScript) and
* have access to the node, by - let's say - expanding the functionality of the SpeechSynthesis object.
*
* SO -17.07.19
*/
this._updateText();
}

103
dist/iwmlib.pixi.js vendored
View File

@ -1335,6 +1335,19 @@
static toLine(event) {
return `${event.type} #${event.target.id} ${event.clientX} ${event.clientY}`
let result = event.type;
let selector = this.selector(event.target);
result += ' selector: ' + selector;
if (event.target != document.querySelector(selector)) console.log('Cannot resolve', selector);
let keys = ['layerX', 'layerY', 'pageX', 'pageY', 'clientX', 'clientY'];
for (let key of keys) {
try {
result += ' ' + key + ':' + event[key];
} catch (e) {
console.log('Invalid key: ' + key);
}
}
return result
}
static compareExtractedWithSimulated() {
@ -6172,6 +6185,25 @@
result[id] = this.getPosition(event);
break
}
// case 'TouchEvent':
// // Needs to be observed: Perhaps changedTouches are all we need. If so
// // we can remove the touchEventKey default parameter
// if (touchEventKey == 'all') {
// for(let t of event.targetTouches) {
// result[t.identifier.toString()] = this.getPosition(t)
// }
// for(let t of event.changedTouches) {
// result[t.identifier.toString()] = this.getPosition(t)
// }
// }
// else {
// for(let t of event.changedTouches) {
// result[t.identifier.toString()] = this.getPosition(t)
// }
// }
// break
default:
break
}
return result
}
@ -9944,8 +9976,6 @@
* @param {Tiles} tiles - the tile layer object
**/
addTiles(key, tiles) {
console.error("ADD TILES", this.tileContainer);
if (key in this.tileLayers) {
console.warn('Tiles already availabl', key);
}
@ -9954,7 +9984,6 @@
}
destroyTiles(key) {
console.error("DESTROY TILES");
let tiles = this.tileLayers[key];
this.tileContainer.removeChild(tiles);
tiles.destroy();
@ -10484,7 +10513,6 @@
* @memberof DeepZoomImage
*/
activate() {
console.log(this.parent);
this.active = true;
this.destroyTilesAboveLevel(this.currentLevel);
this.ensureTiles(this.currentLevel, null);
@ -16965,7 +16993,7 @@
let interactionManager = this.renderer.plugins.interaction;
let displayObject = interactionManager.hitTest(local, this);
if (displayObject != null) {
if (displayObject.dontBlockScatter && displayObject.parent != null) {
displayObject = interactionManager.hitTest(local, displayObject.parent);
}
@ -16974,7 +17002,6 @@
if (this.claimEvents) event.claimedByScatter = this.hitScatter;
}
return this.hitScatter
}
}
@ -18268,7 +18295,7 @@
let containerCenter;
if (this.frame) {
containerCenter = this.getFrame().center;
containerCenter = this.getFrame().localCenter;
} else {
containerCenter = {
x: this.image.parent.width / 2,
@ -19073,7 +19100,6 @@
this.drawEndHandler = new EventHandler('onDrawEnd', { listeners: onDrawEnd });
this._points = null;
this._position = null;
this.map = null;
}
clone() {
@ -19139,7 +19165,6 @@
* Called by the containing geo layer, when the map changes.
*/
adaptTo(map) {
this.map = map;
this._points = this._adaptCoordinates(map);
this._updatePosition();
this.draw();
@ -19182,19 +19207,6 @@
this._layer = layer;
}
// get map() {
// if (
// this.graphics.layer &&
// (this.graphics.layer instanceof GeoLayer || this.graphics.layer instanceof MapLayer)
// ) {
// return this.graphics.layer.map
// } else return null
// }
setLayer(layer) {
this._layer = layer;
}
get map() {
let map = null;
if (this.mapLayer) {
@ -19599,7 +19611,7 @@
}
class MapList {
constructor(active, maps) {
constructor(active = null, maps = {}) {
this.maps = maps;
this.active = active;
@ -19640,6 +19652,16 @@
return map
}
clone() {
let maps = {};
for (let name of Object.keys(this.maps)) {
maps[name] = this.maps[name].clone();
}
return new MapList(this.active, maps)
}
add(key, map) {
if (this.maps[key] != null) consol.warn('Key already in mapList. The existing key was overwritten.');
map.name = key;
@ -19647,15 +19669,14 @@
}
get map() {
console.log(this.maps, this.active);
return this.maps[this.active]
return this.maps && this.maps[this.active] ? this.maps[this.active] : null
}
next() {
let keys = Object.keys(this.maps);
let idx = keys.indexOf(this.active);
let next = idx + 1 < key.length ? keys[idx + 1] : keys[0];
let next = idx + 1 < keys.length ? keys[idx + 1] : keys[0];
console.log(keys, idx, next);
return next
}
@ -19803,6 +19824,19 @@
} else console.warn('Tried to remove layer that was not set.', this, layer);
}
remove(graphics) {
if (graphics instanceof GeoGraphics) {
let index = this.geographics.indexOf(geographics);
if (index != -1) {
this.displayObject.removeChild(geographics);
} else {
console.error('Could not remove geographics from geolayer.', this, geographics);
}
} else {
this.displayObject.removeChild(graphics);
}
}
set parent(parent) {
this._parent = parent;
}
@ -19869,7 +19903,7 @@
mapList,
scatterContainer,
displayObject,
{ onTransform = null, onChange = null, focus = null, zoom = null, viewport = null, mapList = null } = {}
{ onTransform = null, onChange = null, focus = null, zoom = null, viewport = null } = {}
) {
super(displayObject);
@ -19890,12 +19924,16 @@
});
this.mapList = mapList;
this._map = null;
// //TODO Implement error handling here.
// this.maps = maps
// if (opts.map) this.placeMap(opts.map)
this.dynamicElements = new Map();
// Binds the transformed callback beforehand.
this.transformed = this.transformed.bind(this);
this.changeMap(mapList.active);
}
adapt() {
@ -19945,10 +19983,10 @@
/* map ,
useScatterAsContainer = true // If set to false, the normal container is used. This is necessary when using submaps and the container need to be a RigidContainer.*/
) {
if (map instanceof GeoMap) {
console.log('Change map to: ', map);
console.log('Change map to: ', name);
let oldMap = this.map;
if (oldMap) oldMap.unload();
this.mapList.select(name);
if (oldMap) {
oldMap.unload();
@ -19963,7 +20001,7 @@
console.log(this, this.scatterContainer);
this.scatterContainer.addChild(map.image);
this.mapview.apply(this.map);
this.mapview.apply(map);
map.image.addChild(this.displayObject);
// A geolayer's displayObject is on the parent layer.
@ -20329,7 +20367,6 @@
}
get map() {
console.log(this.mapList);
return this.mapList.map
}

View File

@ -266,6 +266,7 @@ export class SubmapScatter extends DisplayObjectScatter {
minScale: 1,
maxScale: 1,
startScale: 1,
overdoScaling: 1,
scalable: false
})