- npm updates

- Picking.js: correct events for destop and touch devices
This commit is contained in:
Arno Kaimbacher 2021-02-18 14:19:44 +01:00
parent 486896581c
commit 4be927b82b
3 changed files with 539 additions and 470 deletions

888
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,47 +1,47 @@
{ {
"name": "geo-tief", "name": "geo-tief",
"version": "1.0.0", "version": "1.0.0",
"description": "3D geology viewer", "description": "3D geology viewer",
"main": "dist/main.js", "main": "dist/main.js",
"dependencies": { "dependencies": {
"@fortawesome/fontawesome-free": "^5.15.2", "@fortawesome/fontawesome-free": "^5.15.2",
"normalize.css": "^8.0.1", "normalize.css": "^8.0.1",
"proj4": "^2.6.3", "proj4": "^2.6.3",
"three": "^0.125.1" "three": "^0.125.1"
}, },
"author": "Arno Kaimbacher", "author": "Arno Kaimbacher",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@babel/core": "^7.12.9", "@babel/core": "^7.12.9",
"@babel/plugin-proposal-class-properties": "^7.12.1", "@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-transform-runtime": "^7.12.1", "@babel/plugin-transform-runtime": "^7.12.1",
"@babel/preset-env": "^7.12.7", "@babel/preset-env": "^7.12.7",
"babel-loader": "^8.2.1", "babel-loader": "^8.2.1",
"concurrently": "^5.3.0", "concurrently": "^5.3.0",
"css-loader": "^5.0.1", "css-loader": "^5.0.1",
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
"img-loader": "^3.0.2", "img-loader": "^3.0.2",
"mini-css-extract-plugin": "^1.3.1", "mini-css-extract-plugin": "^1.3.1",
"node-sass": "^5.0.0", "node-sass": "^5.0.0",
"resolve-url-loader": "^3.1.2", "resolve-url-loader": "^3.1.2",
"sass-loader": "^11.0.1", "sass-loader": "^11.0.1",
"style-loader": "^2.0.0", "style-loader": "^2.0.0",
"terser-webpack-plugin": "^5.0.3", "terser-webpack-plugin": "^5.0.3",
"url-loader": "^4.1.1", "url-loader": "^4.1.1",
"webpack": "^5.7.0", "webpack": "^5.7.0",
"webpack-cli": "^4.2.0", "webpack-cli": "^4.2.0",
"webpack-merge": "^5.4.0" "webpack-merge": "^5.4.0"
}, },
"scripts": { "scripts": {
"babel": "babel --presets es2015 js/main.js -o build/main.bundle.js", "babel": "babel --presets es2015 js/main.js -o build/main.bundle.js",
"serve": "http-server", "serve": "http-server",
"prod": "rm -rf dist && webpack --progress --mode=production", "prod": "rm -rf dist && webpack --progress --mode=production",
"watch": "concurrently \"npm run serve\" \"npx webpack --progress --mode=development --watch\" " "watch": "concurrently \"npm run serve\" \"npx webpack --progress --mode=development --watch\" "
}, },
"keywords": [ "keywords": [
"3D", "3D",
"geology", "geology",
"GeoTief" "GeoTief"
] ]
} }

View File

@ -43,12 +43,10 @@ export class Picking {
simulation.scene.add(this.plane); simulation.scene.add(this.plane);
this.domElement = simulation.renderer.domElement; this.domElement = simulation.renderer.domElement;
domEvent.on(this.domElement, 'mousemove', this.mouseMove, this);
if (this.touchCapable) { if (this.touchCapable == true) {
domEvent.on(this.domElement, 'mousemove', this.mouseMove, this);
domEvent.on(this.domElement, 'touchstart', this.beginDrag, this); domEvent.on(this.domElement, 'touchstart', this.beginDrag, this);
} else { } else {
domEvent.on(this.domElement, 'mousemove', this.mouseMove, this);
domEvent.on(this.domElement, 'mousedown', this.beginDrag, this); domEvent.on(this.domElement, 'mousedown', this.beginDrag, this);
} }
} }
@ -188,20 +186,25 @@ export class Picking {
}; };
let endDrag = function (event) { let endDrag = function (event) {
event.preventDefault();
event.stopPropagation();
this.isDraging = false; this.isDraging = false;
this.simulation.map.enabled = true; this.simulation.map.enabled = true;
this.simulation.renderer.domElement.style.cursor = 'pointer'; this.simulation.renderer.domElement.style.cursor = 'pointer';
domEvent.off(this.domElement, "mousemove", continueDrag, this);
domEvent.off(this.domElement, "touchmove", continueDrag, this);
domEvent.off(this.domElement, "mouseup", endDrag, this); if (this.touchCapable == true) {
domEvent.off(this.domElement, 'mouseleave', endDrag, this); domEvent.off(this.domElement, 'touchmove', continueDrag, this);
domEvent.off(this.domElement, 'touchend', endDrag, this); domEvent.off(this.domElement, 'touchend', endDrag, this);
domEvent.off(this.domElement, 'touchcancel', endDrag, this); domEvent.off(this.domElement, 'touchcancel', endDrag, this);
domEvent.off(this.domElement, 'touchleave', endDrag, this); domEvent.off(this.domElement, 'touchleave', endDrag, this);
} else {
domEvent.off(this.domElement, 'mousemove', continueDrag, this);
domEvent.off(this.domElement, 'mouseup', endDrag, this);
domEvent.off(this.domElement, 'mouseleave', endDrag, this);
}
}; };
if (this.touchCapable) { if (this.touchCapable == true) {
domEvent.on(this.domElement, 'touchmove', continueDrag, this); domEvent.on(this.domElement, 'touchmove', continueDrag, this);
domEvent.on(this.domElement, 'touchend', endDrag, this); domEvent.on(this.domElement, 'touchend', endDrag, this);
domEvent.on(this.domElement, 'touchcancel', endDrag, this); domEvent.on(this.domElement, 'touchcancel', endDrag, this);