Merge branch 'master' of gitea.iwm-tuebingen.de:IWMBrowser/iwmlib

This commit is contained in:
Severin Opel 2019-11-20 16:06:01 +01:00
commit 4d6d2f1df0
6 changed files with 7424 additions and 5276 deletions

6931
dist/iwmlib.3rdparty.js vendored

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

52
dist/iwmlib.js vendored
View File

@ -608,19 +608,6 @@
static toLine(event) { static toLine(event) {
return `${event.type} #${event.target.id} ${event.clientX} ${event.clientY}` 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() { static compareExtractedWithSimulated() {
@ -2640,25 +2627,6 @@
result[id] = this.getPosition(event); result[id] = this.getPosition(event);
break 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 return result
} }
@ -5754,8 +5722,6 @@
let bottom = parseFloat(this.element.style.bottom); let bottom = parseFloat(this.element.style.bottom);
this.element.style.bottom = bottom - delta.y + 'px'; this.element.style.bottom = bottom - delta.y + 'px';
break break
default:
break
} }
//console.log("onResize", this.onResize) //console.log("onResize", this.onResize)
if (this.onResize) { if (this.onResize) {
@ -6178,8 +6144,6 @@
x = bbRight; x = bbRight;
if (!this.useEventPosWithBoundingBox) y = (bbTop + bbBottom) / 2; if (!this.useEventPosWithBoundingBox) y = (bbTop + bbBottom) / 2;
break break
default:
break
} }
} }
@ -6235,8 +6199,6 @@
x += this.notchSize * 2; x += this.notchSize * 2;
x += this.posOffset; x += this.posOffset;
break break
default:
break
} }
this.placeOrigin(x, y); this.placeOrigin(x, y);
} }
@ -11101,20 +11063,6 @@
} }
speak() { 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(); this._updateText();
} }

99
dist/iwmlib.pixi.js vendored
View File

@ -1335,19 +1335,6 @@
static toLine(event) { static toLine(event) {
return `${event.type} #${event.target.id} ${event.clientX} ${event.clientY}` 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() { static compareExtractedWithSimulated() {
@ -6185,25 +6172,6 @@
result[id] = this.getPosition(event); result[id] = this.getPosition(event);
break 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 return result
} }
@ -16997,7 +16965,7 @@
let interactionManager = this.renderer.plugins.interaction; let interactionManager = this.renderer.plugins.interaction;
let displayObject = interactionManager.hitTest(local, this); let displayObject = interactionManager.hitTest(local, this);
if (displayObject != null) {
if (displayObject.dontBlockScatter && displayObject.parent != null) { if (displayObject.dontBlockScatter && displayObject.parent != null) {
displayObject = interactionManager.hitTest(local, displayObject.parent); displayObject = interactionManager.hitTest(local, displayObject.parent);
} }
@ -17006,6 +16974,7 @@
if (this.claimEvents) event.claimedByScatter = this.hitScatter; if (this.claimEvents) event.claimedByScatter = this.hitScatter;
} }
return this.hitScatter return this.hitScatter
} }
} }
@ -18299,7 +18268,7 @@
let containerCenter; let containerCenter;
if (this.frame) { if (this.frame) {
containerCenter = this.getFrame().localCenter; containerCenter = this.getFrame().center;
} else { } else {
containerCenter = { containerCenter = {
x: this.image.parent.width / 2, x: this.image.parent.width / 2,
@ -19104,6 +19073,7 @@
this.drawEndHandler = new EventHandler('onDrawEnd', { listeners: onDrawEnd }); this.drawEndHandler = new EventHandler('onDrawEnd', { listeners: onDrawEnd });
this._points = null; this._points = null;
this._position = null; this._position = null;
this.map = null;
} }
clone() { clone() {
@ -19169,6 +19139,7 @@
* Called by the containing geo layer, when the map changes. * Called by the containing geo layer, when the map changes.
*/ */
adaptTo(map) { adaptTo(map) {
this.map = map;
this._points = this._adaptCoordinates(map); this._points = this._adaptCoordinates(map);
this._updatePosition(); this._updatePosition();
this.draw(); this.draw();
@ -19211,6 +19182,19 @@
this._layer = layer; 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() { get map() {
let map = null; let map = null;
if (this.mapLayer) { if (this.mapLayer) {
@ -19615,7 +19599,7 @@
} }
class MapList { class MapList {
constructor(active = null, maps = {}) { constructor(active, maps) {
this.maps = maps; this.maps = maps;
this.active = active; this.active = active;
@ -19656,16 +19640,6 @@
return map 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) { add(key, map) {
if (this.maps[key] != null) consol.warn('Key already in mapList. The existing key was overwritten.'); if (this.maps[key] != null) consol.warn('Key already in mapList. The existing key was overwritten.');
map.name = key; map.name = key;
@ -19673,14 +19647,15 @@
} }
get map() { get map() {
return this.maps && this.maps[this.active] ? this.maps[this.active] : null console.log(this.maps, this.active);
return this.maps[this.active]
} }
next() { next() {
let keys = Object.keys(this.maps); let keys = Object.keys(this.maps);
let idx = keys.indexOf(this.active); let idx = keys.indexOf(this.active);
let next = idx + 1 < keys.length ? keys[idx + 1] : keys[0]; let next = idx + 1 < key.length ? keys[idx + 1] : keys[0];
console.log(keys, idx, next); console.log(keys, idx, next);
return next return next
} }
@ -19828,19 +19803,6 @@
} else console.warn('Tried to remove layer that was not set.', this, layer); } 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) { set parent(parent) {
this._parent = parent; this._parent = parent;
} }
@ -19907,7 +19869,7 @@
mapList, mapList,
scatterContainer, scatterContainer,
displayObject, displayObject,
{ onTransform = null, onChange = null, focus = null, zoom = null, viewport = null } = {} { onTransform = null, onChange = null, focus = null, zoom = null, viewport = null, mapList = null } = {}
) { ) {
super(displayObject); super(displayObject);
@ -19928,16 +19890,12 @@
}); });
this.mapList = mapList; this.mapList = mapList;
this._map = null;
// //TODO Implement error handling here. // //TODO Implement error handling here.
// this.maps = maps // this.maps = maps
// if (opts.map) this.placeMap(opts.map) // if (opts.map) this.placeMap(opts.map)
this.dynamicElements = new Map(); this.dynamicElements = new Map();
// Binds the transformed callback beforehand.
this.transformed = this.transformed.bind(this);
this.changeMap(mapList.active);
} }
adapt() { adapt() {
@ -19987,10 +19945,10 @@
/* map , /* 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.*/ 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.*/
) { ) {
console.log('Change map to: ', name); if (map instanceof GeoMap) {
console.log('Change map to: ', map);
let oldMap = this.map; let oldMap = this.map;
if (oldMap) oldMap.unload();
this.mapList.select(name);
if (oldMap) { if (oldMap) {
oldMap.unload(); oldMap.unload();
@ -20005,7 +19963,7 @@
console.log(this, this.scatterContainer); console.log(this, this.scatterContainer);
this.scatterContainer.addChild(map.image); this.scatterContainer.addChild(map.image);
this.mapview.apply(map); this.mapview.apply(this.map);
map.image.addChild(this.displayObject); map.image.addChild(this.displayObject);
// A geolayer's displayObject is on the parent layer. // A geolayer's displayObject is on the parent layer.
@ -20371,6 +20329,7 @@
} }
get map() { get map() {
console.log(this.mapList);
return this.mapList.map return this.mapList.map
} }

2158
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -34,12 +34,12 @@
"fs-extra": "^8.0.1", "fs-extra": "^8.0.1",
"gulp": "^4.0.2", "gulp": "^4.0.2",
"gulp-concat": "^2.6.1", "gulp-concat": "^2.6.1",
"gulp-prettier": "^2.2.0", "gulp-prettier": "^2.3.0",
"gulp-rename": "^1.4.0", "gulp-rename": "^1.4.0",
"gulp-replace": "^1.0.0", "gulp-replace": "^1.0.0",
"gulp-uglify": "^3.0.2", "gulp-uglify": "^3.0.2",
"htmlhint": "^0.11.0", "htmlhint": "^0.11.0",
"prettier": "^1.18.2", "prettier": "^1.19.1",
"puppeteer": "^1.20.0", "puppeteer": "^1.20.0",
"stylelint": "^11.1.1", "stylelint": "^11.1.1",
"stylelint-config-standard": "^19.0.0" "stylelint-config-standard": "^19.0.0"
@ -54,7 +54,7 @@
"pixi-particles": "^4.2.0", "pixi-particles": "^4.2.0",
"pixi-projection": "^0.3.5", "pixi-projection": "^0.3.5",
"pixi-viewport": "^4.3.3", "pixi-viewport": "^4.3.3",
"pixi.js": "^5.1.5", "pixi.js": "^5.2.0",
"propagating-hammerjs": "^1.4.7" "propagating-hammerjs": "^1.4.7"
} }
} }