@realsee/dnalogel 2.0.0-alpha.6 → 2.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/README.md +44 -5
- package/dist/dnalogel.cjs.js +7 -2
- package/dist/dnalogel.es.js +3516 -159
- package/dist/dnalogel.umd.js +7 -2
- package/libs/PanoCompassPlugin/index.d.ts +3 -3
- package/libs/PanoCompassPlugin/index.js +56 -44
- package/libs/PanoMeasurePlugin/Controller/BaseController.d.ts +36 -0
- package/libs/PanoMeasurePlugin/Controller/BaseController.js +69 -0
- package/libs/PanoMeasurePlugin/Controller/EditController.d.ts +52 -0
- package/libs/PanoMeasurePlugin/Controller/EditController.js +216 -0
- package/libs/PanoMeasurePlugin/Controller/ShortcutKeyController.d.ts +12 -0
- package/libs/PanoMeasurePlugin/Controller/ShortcutKeyController.js +44 -0
- package/libs/PanoMeasurePlugin/Controller/WatchController.d.ts +25 -0
- package/libs/PanoMeasurePlugin/Controller/WatchController.js +223 -0
- package/libs/PanoMeasurePlugin/Controller/index.d.ts +61 -0
- package/libs/PanoMeasurePlugin/Controller/index.js +176 -0
- package/libs/PanoMeasurePlugin/Model/index.d.ts +38 -0
- package/libs/PanoMeasurePlugin/Model/index.js +114 -0
- package/libs/PanoMeasurePlugin/Model/line.d.ts +30 -0
- package/libs/PanoMeasurePlugin/Model/line.js +64 -0
- package/libs/PanoMeasurePlugin/Model/point.d.ts +16 -0
- package/libs/PanoMeasurePlugin/Model/point.js +28 -0
- package/libs/PanoMeasurePlugin/Model/polyline.d.ts +16 -0
- package/libs/PanoMeasurePlugin/Model/polyline.js +48 -0
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.d.ts +2 -0
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete.svg.js +15 -0
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.d.ts +2 -0
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_bg.png.js +2 -0
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.d.ts +2 -0
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/_Assets/delete_hover_bg.png.js +2 -0
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.d.ts +22 -0
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.js +108 -0
- package/libs/PanoMeasurePlugin/Modules/FiveHelper.d.ts +11 -0
- package/libs/PanoMeasurePlugin/Modules/FiveHelper.js +33 -0
- package/libs/PanoMeasurePlugin/Modules/GuideController.d.ts +18 -0
- package/libs/PanoMeasurePlugin/Modules/GuideController.js +75 -0
- package/libs/PanoMeasurePlugin/Modules/Magnifier.d.ts +24 -0
- package/libs/PanoMeasurePlugin/Modules/Magnifier.js +103 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/HTML.d.ts +6 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/HTML.js +117 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.d.ts +18 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +102 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/Revoke/index.d.ts +12 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/Revoke/index.js +35 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/index.d.ts +16 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/index.js +69 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/style.d.ts +17 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/style.js +78 -0
- package/libs/PanoMeasurePlugin/index.d.ts +7 -0
- package/libs/PanoMeasurePlugin/index.js +5 -0
- package/libs/PanoMeasurePlugin/typings/data.d.ts +28 -0
- package/libs/PanoMeasurePlugin/typings/data.js +1 -0
- package/libs/PanoMeasurePlugin/typings/event.type.d.ts +28 -0
- package/libs/PanoMeasurePlugin/typings/event.type.js +1 -0
- package/libs/PanoMeasurePlugin/typings/utils.type.d.ts +1 -0
- package/libs/PanoMeasurePlugin/typings/utils.type.js +1 -0
- package/libs/PanoMeasurePlugin/utils/clearGroup.d.ts +2 -0
- package/libs/PanoMeasurePlugin/utils/clearGroup.js +3 -0
- package/libs/PanoMeasurePlugin/utils/constants.d.ts +4 -0
- package/libs/PanoMeasurePlugin/utils/constants.js +31 -0
- package/libs/PanoMeasurePlugin/utils/distanceDom.d.ts +28 -0
- package/libs/PanoMeasurePlugin/utils/distanceDom.js +114 -0
- package/libs/PanoMeasurePlugin/utils/findAssociatedLines.d.ts +2 -0
- package/libs/PanoMeasurePlugin/utils/findAssociatedLines.js +21 -0
- package/libs/PanoMeasurePlugin/utils/findClosestPoint.d.ts +10 -0
- package/libs/PanoMeasurePlugin/utils/findClosestPoint.js +27 -0
- package/libs/PanoMeasurePlugin/utils/getIntersectionFromEvent.d.ts +4 -0
- package/libs/PanoMeasurePlugin/utils/getIntersectionFromEvent.js +9 -0
- package/libs/PanoMeasurePlugin/utils/getPointFromHammerEvent.d.ts +10 -0
- package/libs/PanoMeasurePlugin/utils/getPointFromHammerEvent.js +14 -0
- package/libs/PanoMeasurePlugin/utils/ironbox.d.ts +1 -0
- package/libs/PanoMeasurePlugin/utils/ironbox.js +1 -0
- package/libs/PanoMeasurePlugin/utils/isNDCPointInScreen.d.ts +2 -0
- package/libs/PanoMeasurePlugin/utils/isNDCPointInScreen.js +6 -0
- package/libs/PanoMeasurePlugin/utils/line.d.ts +17 -0
- package/libs/PanoMeasurePlugin/utils/line.js +32 -0
- package/libs/PanoMeasurePlugin/utils/math.d.ts +17 -0
- package/libs/PanoMeasurePlugin/utils/math.js +44 -0
- package/libs/PanoMeasurePlugin/utils/mouseGroup.d.ts +2 -0
- package/libs/PanoMeasurePlugin/utils/mouseGroup.js +21 -0
- package/libs/PanoMeasurePlugin/utils/ndc2Screen.d.ts +5 -0
- package/libs/PanoMeasurePlugin/utils/ndc2Screen.js +6 -0
- package/libs/index.d.ts +2 -0
- package/libs/index.js +1 -0
- package/package.json +1 -1
- package/docs/.nojekyll +0 -1
- package/docs/assets/highlight.css +0 -29
- package/docs/assets/icons.css +0 -1043
- package/docs/assets/icons.png +0 -0
- package/docs/assets/icons@2x.png +0 -0
- package/docs/assets/main.js +0 -52
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1413
- package/docs/assets/widgets.png +0 -0
- package/docs/assets/widgets@2x.png +0 -0
- package/docs/classes/ModelRoomLabelController.html +0 -20
- package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +0 -1
- package/docs/enums/ModelFloorplanErrorType.html +0 -1
- package/docs/index.html +0 -10
- package/docs/interfaces/ModelChassisCompassPluginData.html +0 -1
- package/docs/interfaces/ModelChassisCompassPluginExportType.html +0 -1
- package/docs/interfaces/ModelChassisCompassPluginParameterType.html +0 -1
- package/docs/interfaces/ModelEntryDoorGuidePluginData.html +0 -1
- package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +0 -1
- package/docs/interfaces/ModelFloorplanParameterType.html +0 -1
- package/docs/interfaces/ModelFloorplanViewEvent.html +0 -5
- package/docs/interfaces/ModelRoomLabelPluginData.html +0 -1
- package/docs/interfaces/PanoCompassPluginData.html +0 -1
- package/docs/interfaces/PanoCompassPluginParameterType.html +0 -1
- package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +0 -11
- package/docs/interfaces/PanoRulerPluginExportType.html +0 -1
- package/docs/interfaces/PanoRulerPluginOptions.html +0 -1
- package/docs/interfaces/PanoRulerPluginParameterType.html +0 -1
- package/docs/interfaces/RoomLabel.html +0 -13
- package/docs/interfaces/TopviewFloorplanPluginParameterType.html +0 -1
- package/docs/modules.html +0 -26
package/dist/dnalogel.es.js
CHANGED
|
@@ -22,9 +22,9 @@ var __publicField = (obj, key, value) => {
|
|
|
22
22
|
return value;
|
|
23
23
|
};
|
|
24
24
|
import * as THREE from "three";
|
|
25
|
-
import { Vector3 as Vector3$1, Scene as Scene$1, Group as Group$2, Raycaster as Raycaster$1, Vector2 as Vector2$1, MeshBasicMaterial as MeshBasicMaterial$1, CanvasTexture as CanvasTexture$1, AnimationMixer as AnimationMixer$1 } from "three";
|
|
25
|
+
import { Vector3 as Vector3$1, Scene as Scene$1, Group as Group$2, Raycaster as Raycaster$1, Vector2 as Vector2$1, MeshBasicMaterial as MeshBasicMaterial$1, CanvasTexture as CanvasTexture$1, AnimationMixer as AnimationMixer$1, Color as Color$1, TextureLoader as TextureLoader$1, PlaneGeometry as PlaneGeometry$1, sRGBEncoding as sRGBEncoding$1, Mesh as Mesh$1, CurvePath as CurvePath$1, LineCurve3 as LineCurve3$1, TubeGeometry as TubeGeometry$1, DoubleSide as DoubleSide$1, SphereGeometry as SphereGeometry$1 } from "three";
|
|
26
26
|
import { CSS3DRenderer, CSS3DObject } from "three/examples/jsm/renderers/CSS3DRenderer";
|
|
27
|
-
import { Line as Line$
|
|
27
|
+
import { Line as Line$2 } from "@realsee/five/line";
|
|
28
28
|
import { Five, Subscribe } from "@realsee/five";
|
|
29
29
|
const ModelViewPlugin = (five) => {
|
|
30
30
|
let needsRender = true;
|
|
@@ -349,7 +349,7 @@ const CSS3DRenderPlugin = (five) => {
|
|
|
349
349
|
};
|
|
350
350
|
};
|
|
351
351
|
function createLine(point1, point2, color = new Vector3$1(1, 1, 1), dashed = false) {
|
|
352
|
-
const line = new Line$
|
|
352
|
+
const line = new Line$2(point1, point2);
|
|
353
353
|
line.setMaterial({ dashed, color, linewidth: 1 });
|
|
354
354
|
line.remove(line.points);
|
|
355
355
|
return line;
|
|
@@ -3233,7 +3233,7 @@ function create_if_block$4(ctx) {
|
|
|
3233
3233
|
};
|
|
3234
3234
|
}
|
|
3235
3235
|
function create_each_block$2(ctx) {
|
|
3236
|
-
let
|
|
3236
|
+
let svg2;
|
|
3237
3237
|
let current_block_type_index;
|
|
3238
3238
|
let if_block;
|
|
3239
3239
|
let current;
|
|
@@ -3250,13 +3250,13 @@ function create_each_block$2(ctx) {
|
|
|
3250
3250
|
if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
|
|
3251
3251
|
return {
|
|
3252
3252
|
c() {
|
|
3253
|
-
|
|
3253
|
+
svg2 = svg_element("svg");
|
|
3254
3254
|
if_block.c();
|
|
3255
|
-
attr(
|
|
3255
|
+
attr(svg2, "class", "svelte-1b0icjc");
|
|
3256
3256
|
},
|
|
3257
3257
|
m(target, anchor) {
|
|
3258
|
-
insert(target,
|
|
3259
|
-
if_blocks[current_block_type_index].m(
|
|
3258
|
+
insert(target, svg2, anchor);
|
|
3259
|
+
if_blocks[current_block_type_index].m(svg2, null);
|
|
3260
3260
|
current = true;
|
|
3261
3261
|
},
|
|
3262
3262
|
p(ctx2, dirty) {
|
|
@@ -3278,7 +3278,7 @@ function create_each_block$2(ctx) {
|
|
|
3278
3278
|
if_block.p(ctx2, dirty);
|
|
3279
3279
|
}
|
|
3280
3280
|
transition_in(if_block, 1);
|
|
3281
|
-
if_block.m(
|
|
3281
|
+
if_block.m(svg2, null);
|
|
3282
3282
|
}
|
|
3283
3283
|
},
|
|
3284
3284
|
i(local) {
|
|
@@ -3293,7 +3293,7 @@ function create_each_block$2(ctx) {
|
|
|
3293
3293
|
},
|
|
3294
3294
|
d(detaching) {
|
|
3295
3295
|
if (detaching)
|
|
3296
|
-
detach(
|
|
3296
|
+
detach(svg2);
|
|
3297
3297
|
if_blocks[current_block_type_index].d();
|
|
3298
3298
|
}
|
|
3299
3299
|
};
|
|
@@ -3509,7 +3509,7 @@ function create_each_block$1(key_1, ctx) {
|
|
|
3509
3509
|
}
|
|
3510
3510
|
function create_fragment$6(ctx) {
|
|
3511
3511
|
let div;
|
|
3512
|
-
let
|
|
3512
|
+
let svg2;
|
|
3513
3513
|
let each_blocks = [];
|
|
3514
3514
|
let each_1_lookup = /* @__PURE__ */ new Map();
|
|
3515
3515
|
let div_resize_listener;
|
|
@@ -3526,19 +3526,19 @@ function create_fragment$6(ctx) {
|
|
|
3526
3526
|
return {
|
|
3527
3527
|
c() {
|
|
3528
3528
|
div = element("div");
|
|
3529
|
-
|
|
3529
|
+
svg2 = svg_element("svg");
|
|
3530
3530
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
3531
3531
|
each_blocks[i].c();
|
|
3532
3532
|
}
|
|
3533
|
-
attr(
|
|
3533
|
+
attr(svg2, "class", "svelte-1aais5l");
|
|
3534
3534
|
attr(div, "class", "floorplan-plugin__room-highlight svelte-1aais5l");
|
|
3535
3535
|
add_render_callback(() => ctx[10].call(div));
|
|
3536
3536
|
},
|
|
3537
3537
|
m(target, anchor) {
|
|
3538
3538
|
insert(target, div, anchor);
|
|
3539
|
-
append(div,
|
|
3539
|
+
append(div, svg2);
|
|
3540
3540
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
3541
|
-
each_blocks[i].m(
|
|
3541
|
+
each_blocks[i].m(svg2, null);
|
|
3542
3542
|
}
|
|
3543
3543
|
ctx[9](div);
|
|
3544
3544
|
div_resize_listener = add_resize_listener(div, ctx[10].bind(div));
|
|
@@ -3552,7 +3552,7 @@ function create_fragment$6(ctx) {
|
|
|
3552
3552
|
if (dirty & 7) {
|
|
3553
3553
|
each_value = ctx2[2].floorDatas[ctx2[1]].rooms;
|
|
3554
3554
|
group_outros();
|
|
3555
|
-
each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx2, each_value, each_1_lookup,
|
|
3555
|
+
each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx2, each_value, each_1_lookup, svg2, outro_and_destroy_block, create_each_block$1, null, get_each_context$1);
|
|
3556
3556
|
check_outros();
|
|
3557
3557
|
}
|
|
3558
3558
|
},
|
|
@@ -6016,8 +6016,8 @@ var MathUtils = {
|
|
|
6016
6016
|
var d1 = Math.random() * 4294967295 | 0;
|
|
6017
6017
|
var d2 = Math.random() * 4294967295 | 0;
|
|
6018
6018
|
var d3 = Math.random() * 4294967295 | 0;
|
|
6019
|
-
var
|
|
6020
|
-
return
|
|
6019
|
+
var uuid2 = _lut[d0 & 255] + _lut[d0 >> 8 & 255] + _lut[d0 >> 16 & 255] + _lut[d0 >> 24 & 255] + "-" + _lut[d1 & 255] + _lut[d1 >> 8 & 255] + "-" + _lut[d1 >> 16 & 15 | 64] + _lut[d1 >> 24 & 255] + "-" + _lut[d2 & 63 | 128] + _lut[d2 >> 8 & 255] + "-" + _lut[d2 >> 16 & 255] + _lut[d2 >> 24 & 255] + _lut[d3 & 255] + _lut[d3 >> 8 & 255] + _lut[d3 >> 16 & 255] + _lut[d3 >> 24 & 255];
|
|
6020
|
+
return uuid2.toUpperCase();
|
|
6021
6021
|
},
|
|
6022
6022
|
clamp: function(value, min, max) {
|
|
6023
6023
|
return Math.max(min, Math.min(max, value));
|
|
@@ -6614,22 +6614,22 @@ Object.assign(Matrix3.prototype, {
|
|
|
6614
6614
|
});
|
|
6615
6615
|
var _canvas;
|
|
6616
6616
|
var ImageUtils = {
|
|
6617
|
-
getDataURL: function(
|
|
6617
|
+
getDataURL: function(image2) {
|
|
6618
6618
|
var canvas;
|
|
6619
6619
|
if (typeof HTMLCanvasElement == "undefined") {
|
|
6620
|
-
return
|
|
6621
|
-
} else if (
|
|
6622
|
-
canvas =
|
|
6620
|
+
return image2.src;
|
|
6621
|
+
} else if (image2 instanceof HTMLCanvasElement) {
|
|
6622
|
+
canvas = image2;
|
|
6623
6623
|
} else {
|
|
6624
6624
|
if (_canvas === void 0)
|
|
6625
6625
|
_canvas = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
|
|
6626
|
-
_canvas.width =
|
|
6627
|
-
_canvas.height =
|
|
6626
|
+
_canvas.width = image2.width;
|
|
6627
|
+
_canvas.height = image2.height;
|
|
6628
6628
|
var context = _canvas.getContext("2d");
|
|
6629
|
-
if (
|
|
6630
|
-
context.putImageData(
|
|
6629
|
+
if (image2 instanceof ImageData) {
|
|
6630
|
+
context.putImageData(image2, 0, 0);
|
|
6631
6631
|
} else {
|
|
6632
|
-
context.drawImage(
|
|
6632
|
+
context.drawImage(image2, 0, 0, image2.width, image2.height);
|
|
6633
6633
|
}
|
|
6634
6634
|
canvas = _canvas;
|
|
6635
6635
|
}
|
|
@@ -6641,11 +6641,11 @@ var ImageUtils = {
|
|
|
6641
6641
|
}
|
|
6642
6642
|
};
|
|
6643
6643
|
var textureId = 0;
|
|
6644
|
-
function Texture(
|
|
6644
|
+
function Texture(image2, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding) {
|
|
6645
6645
|
Object.defineProperty(this, "id", { value: textureId++ });
|
|
6646
6646
|
this.uuid = MathUtils.generateUUID();
|
|
6647
6647
|
this.name = "";
|
|
6648
|
-
this.image =
|
|
6648
|
+
this.image = image2 !== void 0 ? image2 : Texture.DEFAULT_IMAGE;
|
|
6649
6649
|
this.mipmaps = [];
|
|
6650
6650
|
this.mapping = mapping !== void 0 ? mapping : Texture.DEFAULT_MAPPING;
|
|
6651
6651
|
this.wrapS = wrapS !== void 0 ? wrapS : ClampToEdgeWrapping;
|
|
@@ -6737,26 +6737,26 @@ Texture.prototype = Object.assign(Object.create(EventDispatcher.prototype), {
|
|
|
6737
6737
|
unpackAlignment: this.unpackAlignment
|
|
6738
6738
|
};
|
|
6739
6739
|
if (this.image !== void 0) {
|
|
6740
|
-
var
|
|
6741
|
-
if (
|
|
6742
|
-
|
|
6740
|
+
var image2 = this.image;
|
|
6741
|
+
if (image2.uuid === void 0) {
|
|
6742
|
+
image2.uuid = MathUtils.generateUUID();
|
|
6743
6743
|
}
|
|
6744
|
-
if (!isRootObject && meta.images[
|
|
6744
|
+
if (!isRootObject && meta.images[image2.uuid] === void 0) {
|
|
6745
6745
|
var url;
|
|
6746
|
-
if (Array.isArray(
|
|
6746
|
+
if (Array.isArray(image2)) {
|
|
6747
6747
|
url = [];
|
|
6748
|
-
for (var i = 0, l2 =
|
|
6749
|
-
url.push(ImageUtils.getDataURL(
|
|
6748
|
+
for (var i = 0, l2 = image2.length; i < l2; i++) {
|
|
6749
|
+
url.push(ImageUtils.getDataURL(image2[i]));
|
|
6750
6750
|
}
|
|
6751
6751
|
} else {
|
|
6752
|
-
url = ImageUtils.getDataURL(
|
|
6752
|
+
url = ImageUtils.getDataURL(image2);
|
|
6753
6753
|
}
|
|
6754
|
-
meta.images[
|
|
6755
|
-
uuid:
|
|
6754
|
+
meta.images[image2.uuid] = {
|
|
6755
|
+
uuid: image2.uuid,
|
|
6756
6756
|
url
|
|
6757
6757
|
};
|
|
6758
6758
|
}
|
|
6759
|
-
output.image =
|
|
6759
|
+
output.image = image2.uuid;
|
|
6760
6760
|
}
|
|
6761
6761
|
if (!isRootObject) {
|
|
6762
6762
|
meta.textures[this.uuid] = output;
|
|
@@ -18029,36 +18029,36 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
18029
18029
|
function createCanvas(width, height) {
|
|
18030
18030
|
return useOffscreenCanvas ? new OffscreenCanvas(width, height) : document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
|
|
18031
18031
|
}
|
|
18032
|
-
function resizeImage(
|
|
18032
|
+
function resizeImage(image2, needsPowerOfTwo, needsNewCanvas, maxSize) {
|
|
18033
18033
|
var scale = 1;
|
|
18034
|
-
if (
|
|
18035
|
-
scale = maxSize / Math.max(
|
|
18034
|
+
if (image2.width > maxSize || image2.height > maxSize) {
|
|
18035
|
+
scale = maxSize / Math.max(image2.width, image2.height);
|
|
18036
18036
|
}
|
|
18037
18037
|
if (scale < 1 || needsPowerOfTwo === true) {
|
|
18038
|
-
if (typeof HTMLImageElement !== "undefined" &&
|
|
18038
|
+
if (typeof HTMLImageElement !== "undefined" && image2 instanceof HTMLImageElement || typeof HTMLCanvasElement !== "undefined" && image2 instanceof HTMLCanvasElement || typeof ImageBitmap !== "undefined" && image2 instanceof ImageBitmap) {
|
|
18039
18039
|
var floor = needsPowerOfTwo ? MathUtils.floorPowerOfTwo : Math.floor;
|
|
18040
|
-
var width = floor(scale *
|
|
18041
|
-
var height = floor(scale *
|
|
18040
|
+
var width = floor(scale * image2.width);
|
|
18041
|
+
var height = floor(scale * image2.height);
|
|
18042
18042
|
if (_canvas2 === void 0)
|
|
18043
18043
|
_canvas2 = createCanvas(width, height);
|
|
18044
18044
|
var canvas = needsNewCanvas ? createCanvas(width, height) : _canvas2;
|
|
18045
18045
|
canvas.width = width;
|
|
18046
18046
|
canvas.height = height;
|
|
18047
18047
|
var context = canvas.getContext("2d");
|
|
18048
|
-
context.drawImage(
|
|
18049
|
-
console.warn("THREE.WebGLRenderer: Texture has been resized from (" +
|
|
18048
|
+
context.drawImage(image2, 0, 0, width, height);
|
|
18049
|
+
console.warn("THREE.WebGLRenderer: Texture has been resized from (" + image2.width + "x" + image2.height + ") to (" + width + "x" + height + ").");
|
|
18050
18050
|
return canvas;
|
|
18051
18051
|
} else {
|
|
18052
|
-
if ("data" in
|
|
18053
|
-
console.warn("THREE.WebGLRenderer: Image in DataTexture is too big (" +
|
|
18052
|
+
if ("data" in image2) {
|
|
18053
|
+
console.warn("THREE.WebGLRenderer: Image in DataTexture is too big (" + image2.width + "x" + image2.height + ").");
|
|
18054
18054
|
}
|
|
18055
|
-
return
|
|
18055
|
+
return image2;
|
|
18056
18056
|
}
|
|
18057
18057
|
}
|
|
18058
|
-
return
|
|
18058
|
+
return image2;
|
|
18059
18059
|
}
|
|
18060
|
-
function isPowerOfTwo(
|
|
18061
|
-
return MathUtils.isPowerOfTwo(
|
|
18060
|
+
function isPowerOfTwo(image2) {
|
|
18061
|
+
return MathUtils.isPowerOfTwo(image2.width) && MathUtils.isPowerOfTwo(image2.height);
|
|
18062
18062
|
}
|
|
18063
18063
|
function textureNeedsPowerOfTwo(texture) {
|
|
18064
18064
|
if (isWebGL2)
|
|
@@ -18187,10 +18187,10 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
18187
18187
|
if (texture.isVideoTexture)
|
|
18188
18188
|
updateVideoTexture(texture);
|
|
18189
18189
|
if (texture.version > 0 && textureProperties.__version !== texture.version) {
|
|
18190
|
-
var
|
|
18191
|
-
if (
|
|
18190
|
+
var image2 = texture.image;
|
|
18191
|
+
if (image2 === void 0) {
|
|
18192
18192
|
console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");
|
|
18193
|
-
} else if (
|
|
18193
|
+
} else if (image2.complete === false) {
|
|
18194
18194
|
console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");
|
|
18195
18195
|
} else {
|
|
18196
18196
|
uploadTexture(textureProperties, texture, slot);
|
|
@@ -18237,7 +18237,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
18237
18237
|
cubeImage[i] = isDataTexture ? texture.image[i].image : texture.image[i];
|
|
18238
18238
|
}
|
|
18239
18239
|
}
|
|
18240
|
-
var
|
|
18240
|
+
var image2 = cubeImage[0], supportsMips = isPowerOfTwo(image2) || isWebGL2, glFormat = utils.convert(texture.format), glType = utils.convert(texture.type), glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType);
|
|
18241
18241
|
setTextureParameters(34067, texture, supportsMips);
|
|
18242
18242
|
var mipmaps;
|
|
18243
18243
|
if (isCompressed) {
|
|
@@ -18278,7 +18278,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
18278
18278
|
textureProperties.__maxMipLevel = mipmaps.length;
|
|
18279
18279
|
}
|
|
18280
18280
|
if (textureNeedsGenerateMipmaps(texture, supportsMips)) {
|
|
18281
|
-
generateMipmap(34067, texture,
|
|
18281
|
+
generateMipmap(34067, texture, image2.width, image2.height);
|
|
18282
18282
|
}
|
|
18283
18283
|
textureProperties.__version = texture.version;
|
|
18284
18284
|
if (texture.onUpdate)
|
|
@@ -18362,8 +18362,8 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
18362
18362
|
_gl.pixelStorei(37441, texture.premultiplyAlpha);
|
|
18363
18363
|
_gl.pixelStorei(3317, texture.unpackAlignment);
|
|
18364
18364
|
var needsPowerOfTwo = textureNeedsPowerOfTwo(texture) && isPowerOfTwo(texture.image) === false;
|
|
18365
|
-
var
|
|
18366
|
-
var supportsMips = isPowerOfTwo(
|
|
18365
|
+
var image2 = resizeImage(texture.image, needsPowerOfTwo, false, maxTextureSize);
|
|
18366
|
+
var supportsMips = isPowerOfTwo(image2) || isWebGL2, glFormat = utils.convert(texture.format), glType = utils.convert(texture.type), glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType);
|
|
18367
18367
|
setTextureParameters(textureType, texture, supportsMips);
|
|
18368
18368
|
var mipmap, mipmaps = texture.mipmaps;
|
|
18369
18369
|
if (texture.isDepthTexture) {
|
|
@@ -18398,7 +18398,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
18398
18398
|
glType = utils.convert(texture.type);
|
|
18399
18399
|
}
|
|
18400
18400
|
}
|
|
18401
|
-
state.texImage2D(3553, 0, glInternalFormat,
|
|
18401
|
+
state.texImage2D(3553, 0, glInternalFormat, image2.width, image2.height, 0, glFormat, glType, null);
|
|
18402
18402
|
} else if (texture.isDataTexture) {
|
|
18403
18403
|
if (mipmaps.length > 0 && supportsMips) {
|
|
18404
18404
|
for (var i = 0, il = mipmaps.length; i < il; i++) {
|
|
@@ -18408,7 +18408,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
18408
18408
|
texture.generateMipmaps = false;
|
|
18409
18409
|
textureProperties.__maxMipLevel = mipmaps.length - 1;
|
|
18410
18410
|
} else {
|
|
18411
|
-
state.texImage2D(3553, 0, glInternalFormat,
|
|
18411
|
+
state.texImage2D(3553, 0, glInternalFormat, image2.width, image2.height, 0, glFormat, glType, image2.data);
|
|
18412
18412
|
textureProperties.__maxMipLevel = 0;
|
|
18413
18413
|
}
|
|
18414
18414
|
} else if (texture.isCompressedTexture) {
|
|
@@ -18426,10 +18426,10 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
18426
18426
|
}
|
|
18427
18427
|
textureProperties.__maxMipLevel = mipmaps.length - 1;
|
|
18428
18428
|
} else if (texture.isDataTexture2DArray) {
|
|
18429
|
-
state.texImage3D(35866, 0, glInternalFormat,
|
|
18429
|
+
state.texImage3D(35866, 0, glInternalFormat, image2.width, image2.height, image2.depth, 0, glFormat, glType, image2.data);
|
|
18430
18430
|
textureProperties.__maxMipLevel = 0;
|
|
18431
18431
|
} else if (texture.isDataTexture3D) {
|
|
18432
|
-
state.texImage3D(32879, 0, glInternalFormat,
|
|
18432
|
+
state.texImage3D(32879, 0, glInternalFormat, image2.width, image2.height, image2.depth, 0, glFormat, glType, image2.data);
|
|
18433
18433
|
textureProperties.__maxMipLevel = 0;
|
|
18434
18434
|
} else {
|
|
18435
18435
|
if (mipmaps.length > 0 && supportsMips) {
|
|
@@ -18440,12 +18440,12 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
|
|
|
18440
18440
|
texture.generateMipmaps = false;
|
|
18441
18441
|
textureProperties.__maxMipLevel = mipmaps.length - 1;
|
|
18442
18442
|
} else {
|
|
18443
|
-
state.texImage2D(3553, 0, glInternalFormat, glFormat, glType,
|
|
18443
|
+
state.texImage2D(3553, 0, glInternalFormat, glFormat, glType, image2);
|
|
18444
18444
|
textureProperties.__maxMipLevel = 0;
|
|
18445
18445
|
}
|
|
18446
18446
|
}
|
|
18447
18447
|
if (textureNeedsGenerateMipmaps(texture, supportsMips)) {
|
|
18448
|
-
generateMipmap(textureType, texture,
|
|
18448
|
+
generateMipmap(textureType, texture, image2.width, image2.height);
|
|
18449
18449
|
}
|
|
18450
18450
|
textureProperties.__version = texture.version;
|
|
18451
18451
|
if (texture.onUpdate)
|
|
@@ -19914,10 +19914,10 @@ function WebGLRenderer(parameters) {
|
|
|
19914
19914
|
renderer.setMode(4);
|
|
19915
19915
|
}
|
|
19916
19916
|
} else if (object.isLine) {
|
|
19917
|
-
var
|
|
19918
|
-
if (
|
|
19919
|
-
|
|
19920
|
-
state.setLineWidth(
|
|
19917
|
+
var lineWidth2 = material.linewidth;
|
|
19918
|
+
if (lineWidth2 === void 0)
|
|
19919
|
+
lineWidth2 = 1;
|
|
19920
|
+
state.setLineWidth(lineWidth2 * getTargetPixelRatio());
|
|
19921
19921
|
if (object.isLineSegments) {
|
|
19922
19922
|
renderer.setMode(1);
|
|
19923
19923
|
} else if (object.isLineLoop) {
|
|
@@ -21293,7 +21293,7 @@ var _end = new Vector3();
|
|
|
21293
21293
|
var _inverseMatrix$1 = new Matrix4();
|
|
21294
21294
|
var _ray$1 = new Ray();
|
|
21295
21295
|
var _sphere$2 = new Sphere();
|
|
21296
|
-
function Line(geometry, material, mode) {
|
|
21296
|
+
function Line$1(geometry, material, mode) {
|
|
21297
21297
|
if (mode === 1) {
|
|
21298
21298
|
console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead.");
|
|
21299
21299
|
}
|
|
@@ -21303,8 +21303,8 @@ function Line(geometry, material, mode) {
|
|
|
21303
21303
|
this.material = material !== void 0 ? material : new LineBasicMaterial();
|
|
21304
21304
|
this.updateMorphTargets();
|
|
21305
21305
|
}
|
|
21306
|
-
Line.prototype = Object.assign(Object.create(Object3D.prototype), {
|
|
21307
|
-
constructor: Line,
|
|
21306
|
+
Line$1.prototype = Object.assign(Object.create(Object3D.prototype), {
|
|
21307
|
+
constructor: Line$1,
|
|
21308
21308
|
isLine: true,
|
|
21309
21309
|
computeLineDistances: function() {
|
|
21310
21310
|
var geometry = this.geometry;
|
|
@@ -21455,10 +21455,10 @@ Line.prototype = Object.assign(Object.create(Object3D.prototype), {
|
|
|
21455
21455
|
var _start$1 = new Vector3();
|
|
21456
21456
|
var _end$1 = new Vector3();
|
|
21457
21457
|
function LineSegments(geometry, material) {
|
|
21458
|
-
Line.call(this, geometry, material);
|
|
21458
|
+
Line$1.call(this, geometry, material);
|
|
21459
21459
|
this.type = "LineSegments";
|
|
21460
21460
|
}
|
|
21461
|
-
LineSegments.prototype = Object.assign(Object.create(Line.prototype), {
|
|
21461
|
+
LineSegments.prototype = Object.assign(Object.create(Line$1.prototype), {
|
|
21462
21462
|
constructor: LineSegments,
|
|
21463
21463
|
isLineSegments: true,
|
|
21464
21464
|
computeLineDistances: function() {
|
|
@@ -21491,10 +21491,10 @@ LineSegments.prototype = Object.assign(Object.create(Line.prototype), {
|
|
|
21491
21491
|
}
|
|
21492
21492
|
});
|
|
21493
21493
|
function LineLoop(geometry, material) {
|
|
21494
|
-
Line.call(this, geometry, material);
|
|
21494
|
+
Line$1.call(this, geometry, material);
|
|
21495
21495
|
this.type = "LineLoop";
|
|
21496
21496
|
}
|
|
21497
|
-
LineLoop.prototype = Object.assign(Object.create(Line.prototype), {
|
|
21497
|
+
LineLoop.prototype = Object.assign(Object.create(Line$1.prototype), {
|
|
21498
21498
|
constructor: LineLoop,
|
|
21499
21499
|
isLineLoop: true
|
|
21500
21500
|
});
|
|
@@ -26103,32 +26103,32 @@ ImageLoader.prototype = Object.assign(Object.create(Loader.prototype), {
|
|
|
26103
26103
|
}, 0);
|
|
26104
26104
|
return cached;
|
|
26105
26105
|
}
|
|
26106
|
-
var
|
|
26106
|
+
var image2 = document.createElementNS("http://www.w3.org/1999/xhtml", "img");
|
|
26107
26107
|
function onImageLoad() {
|
|
26108
|
-
|
|
26109
|
-
|
|
26108
|
+
image2.removeEventListener("load", onImageLoad, false);
|
|
26109
|
+
image2.removeEventListener("error", onImageError, false);
|
|
26110
26110
|
Cache.add(url, this);
|
|
26111
26111
|
if (onLoad)
|
|
26112
26112
|
onLoad(this);
|
|
26113
26113
|
scope.manager.itemEnd(url);
|
|
26114
26114
|
}
|
|
26115
26115
|
function onImageError(event) {
|
|
26116
|
-
|
|
26117
|
-
|
|
26116
|
+
image2.removeEventListener("load", onImageLoad, false);
|
|
26117
|
+
image2.removeEventListener("error", onImageError, false);
|
|
26118
26118
|
if (onError)
|
|
26119
26119
|
onError(event);
|
|
26120
26120
|
scope.manager.itemError(url);
|
|
26121
26121
|
scope.manager.itemEnd(url);
|
|
26122
26122
|
}
|
|
26123
|
-
|
|
26124
|
-
|
|
26123
|
+
image2.addEventListener("load", onImageLoad, false);
|
|
26124
|
+
image2.addEventListener("error", onImageError, false);
|
|
26125
26125
|
if (url.substr(0, 5) !== "data:") {
|
|
26126
26126
|
if (this.crossOrigin !== void 0)
|
|
26127
|
-
|
|
26127
|
+
image2.crossOrigin = this.crossOrigin;
|
|
26128
26128
|
}
|
|
26129
26129
|
scope.manager.itemStart(url);
|
|
26130
|
-
|
|
26131
|
-
return
|
|
26130
|
+
image2.src = url;
|
|
26131
|
+
return image2;
|
|
26132
26132
|
}
|
|
26133
26133
|
});
|
|
26134
26134
|
function CubeTextureLoader(manager) {
|
|
@@ -26143,8 +26143,8 @@ CubeTextureLoader.prototype = Object.assign(Object.create(Loader.prototype), {
|
|
|
26143
26143
|
loader.setPath(this.path);
|
|
26144
26144
|
var loaded = 0;
|
|
26145
26145
|
function loadTexture2(i2) {
|
|
26146
|
-
loader.load(urls[i2], function(
|
|
26147
|
-
texture.images[i2] =
|
|
26146
|
+
loader.load(urls[i2], function(image2) {
|
|
26147
|
+
texture.images[i2] = image2;
|
|
26148
26148
|
loaded++;
|
|
26149
26149
|
if (loaded === 6) {
|
|
26150
26150
|
texture.needsUpdate = true;
|
|
@@ -26169,8 +26169,8 @@ TextureLoader.prototype = Object.assign(Object.create(Loader.prototype), {
|
|
|
26169
26169
|
var loader = new ImageLoader(this.manager);
|
|
26170
26170
|
loader.setCrossOrigin(this.crossOrigin);
|
|
26171
26171
|
loader.setPath(this.path);
|
|
26172
|
-
loader.load(url, function(
|
|
26173
|
-
texture.image =
|
|
26172
|
+
loader.load(url, function(image2) {
|
|
26173
|
+
texture.image = image2;
|
|
26174
26174
|
var isJPEG = url.search(/\.jpe?g($|\?)/i) > 0 || url.search(/^data\:image\/jpeg/) === 0;
|
|
26175
26175
|
texture.format = isJPEG ? RGBFormat : RGBAFormat;
|
|
26176
26176
|
texture.needsUpdate = true;
|
|
@@ -28375,18 +28375,18 @@ ObjectLoader.prototype = Object.assign(Object.create(Loader.prototype), {
|
|
|
28375
28375
|
var loader = new ImageLoader(manager);
|
|
28376
28376
|
loader.setCrossOrigin(this.crossOrigin);
|
|
28377
28377
|
for (var i = 0, il = json.length; i < il; i++) {
|
|
28378
|
-
var
|
|
28379
|
-
var url =
|
|
28378
|
+
var image2 = json[i];
|
|
28379
|
+
var url = image2.url;
|
|
28380
28380
|
if (Array.isArray(url)) {
|
|
28381
|
-
images[
|
|
28381
|
+
images[image2.uuid] = [];
|
|
28382
28382
|
for (var j = 0, jl = url.length; j < jl; j++) {
|
|
28383
28383
|
var currentUrl = url[j];
|
|
28384
28384
|
var path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(currentUrl) ? currentUrl : scope.resourcePath + currentUrl;
|
|
28385
|
-
images[
|
|
28385
|
+
images[image2.uuid].push(loadImage(path));
|
|
28386
28386
|
}
|
|
28387
28387
|
} else {
|
|
28388
|
-
var path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(
|
|
28389
|
-
images[
|
|
28388
|
+
var path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(image2.url) ? image2.url : scope.resourcePath + image2.url;
|
|
28389
|
+
images[image2.uuid] = loadImage(path);
|
|
28390
28390
|
}
|
|
28391
28391
|
}
|
|
28392
28392
|
}
|
|
@@ -28470,11 +28470,11 @@ ObjectLoader.prototype = Object.assign(Object.create(Loader.prototype), {
|
|
|
28470
28470
|
if (Array.isArray(name)) {
|
|
28471
28471
|
var array = [];
|
|
28472
28472
|
for (var i2 = 0, l3 = name.length; i2 < l3; i2++) {
|
|
28473
|
-
var
|
|
28474
|
-
if (materials[
|
|
28475
|
-
console.warn("THREE.ObjectLoader: Undefined material",
|
|
28473
|
+
var uuid2 = name[i2];
|
|
28474
|
+
if (materials[uuid2] === void 0) {
|
|
28475
|
+
console.warn("THREE.ObjectLoader: Undefined material", uuid2);
|
|
28476
28476
|
}
|
|
28477
|
-
array.push(materials[
|
|
28477
|
+
array.push(materials[uuid2]);
|
|
28478
28478
|
}
|
|
28479
28479
|
return array;
|
|
28480
28480
|
}
|
|
@@ -28559,7 +28559,7 @@ ObjectLoader.prototype = Object.assign(Object.create(Loader.prototype), {
|
|
|
28559
28559
|
object = new LOD();
|
|
28560
28560
|
break;
|
|
28561
28561
|
case "Line":
|
|
28562
|
-
object = new Line(getGeometry(data.geometry), getMaterial(data.material), data.mode);
|
|
28562
|
+
object = new Line$1(getGeometry(data.geometry), getMaterial(data.material), data.mode);
|
|
28563
28563
|
break;
|
|
28564
28564
|
case "LineLoop":
|
|
28565
28565
|
object = new LineLoop(getGeometry(data.geometry), getMaterial(data.material));
|
|
@@ -30047,10 +30047,10 @@ Object.assign(AnimationObjectGroup.prototype, {
|
|
|
30047
30047
|
add: function() {
|
|
30048
30048
|
var objects = this._objects, nObjects = objects.length, nCachedObjects = this.nCachedObjects_, indicesByUUID = this._indicesByUUID, paths = this._paths, parsedPaths = this._parsedPaths, bindings = this._bindings, nBindings = bindings.length, knownObject = void 0;
|
|
30049
30049
|
for (var i = 0, n = arguments.length; i !== n; ++i) {
|
|
30050
|
-
var object = arguments[i],
|
|
30050
|
+
var object = arguments[i], uuid2 = object.uuid, index = indicesByUUID[uuid2];
|
|
30051
30051
|
if (index === void 0) {
|
|
30052
30052
|
index = nObjects++;
|
|
30053
|
-
indicesByUUID[
|
|
30053
|
+
indicesByUUID[uuid2] = index;
|
|
30054
30054
|
objects.push(object);
|
|
30055
30055
|
for (var j = 0, m = nBindings; j !== m; ++j) {
|
|
30056
30056
|
bindings[j].push(new PropertyBinding(object, paths[j], parsedPaths[j]));
|
|
@@ -30060,7 +30060,7 @@ Object.assign(AnimationObjectGroup.prototype, {
|
|
|
30060
30060
|
var firstActiveIndex = --nCachedObjects, lastCachedObject = objects[firstActiveIndex];
|
|
30061
30061
|
indicesByUUID[lastCachedObject.uuid] = index;
|
|
30062
30062
|
objects[index] = lastCachedObject;
|
|
30063
|
-
indicesByUUID[
|
|
30063
|
+
indicesByUUID[uuid2] = firstActiveIndex;
|
|
30064
30064
|
objects[firstActiveIndex] = object;
|
|
30065
30065
|
for (var j = 0, m = nBindings; j !== m; ++j) {
|
|
30066
30066
|
var bindingsForPath = bindings[j], lastCached = bindingsForPath[firstActiveIndex], binding = bindingsForPath[index];
|
|
@@ -30079,12 +30079,12 @@ Object.assign(AnimationObjectGroup.prototype, {
|
|
|
30079
30079
|
remove: function() {
|
|
30080
30080
|
var objects = this._objects, nCachedObjects = this.nCachedObjects_, indicesByUUID = this._indicesByUUID, bindings = this._bindings, nBindings = bindings.length;
|
|
30081
30081
|
for (var i = 0, n = arguments.length; i !== n; ++i) {
|
|
30082
|
-
var object = arguments[i],
|
|
30082
|
+
var object = arguments[i], uuid2 = object.uuid, index = indicesByUUID[uuid2];
|
|
30083
30083
|
if (index !== void 0 && index >= nCachedObjects) {
|
|
30084
30084
|
var lastCachedIndex = nCachedObjects++, firstActiveObject = objects[lastCachedIndex];
|
|
30085
30085
|
indicesByUUID[firstActiveObject.uuid] = index;
|
|
30086
30086
|
objects[index] = firstActiveObject;
|
|
30087
|
-
indicesByUUID[
|
|
30087
|
+
indicesByUUID[uuid2] = lastCachedIndex;
|
|
30088
30088
|
objects[lastCachedIndex] = object;
|
|
30089
30089
|
for (var j = 0, m = nBindings; j !== m; ++j) {
|
|
30090
30090
|
var bindingsForPath = bindings[j], firstActive = bindingsForPath[lastCachedIndex], binding = bindingsForPath[index];
|
|
@@ -30098,9 +30098,9 @@ Object.assign(AnimationObjectGroup.prototype, {
|
|
|
30098
30098
|
uncache: function() {
|
|
30099
30099
|
var objects = this._objects, nObjects = objects.length, nCachedObjects = this.nCachedObjects_, indicesByUUID = this._indicesByUUID, bindings = this._bindings, nBindings = bindings.length;
|
|
30100
30100
|
for (var i = 0, n = arguments.length; i !== n; ++i) {
|
|
30101
|
-
var object = arguments[i],
|
|
30101
|
+
var object = arguments[i], uuid2 = object.uuid, index = indicesByUUID[uuid2];
|
|
30102
30102
|
if (index !== void 0) {
|
|
30103
|
-
delete indicesByUUID[
|
|
30103
|
+
delete indicesByUUID[uuid2];
|
|
30104
30104
|
if (index < nCachedObjects) {
|
|
30105
30105
|
var firstActiveIndex = --nCachedObjects, lastCachedObject = objects[firstActiveIndex], lastIndex = --nObjects, lastObject = objects[lastIndex];
|
|
30106
30106
|
indicesByUUID[lastCachedObject.uuid] = index;
|
|
@@ -31528,11 +31528,11 @@ function DirectionalLightHelper(light, size, color) {
|
|
|
31528
31528
|
0
|
|
31529
31529
|
], 3));
|
|
31530
31530
|
var material = new LineBasicMaterial({ fog: false, toneMapped: false });
|
|
31531
|
-
this.lightPlane = new Line(geometry, material);
|
|
31531
|
+
this.lightPlane = new Line$1(geometry, material);
|
|
31532
31532
|
this.add(this.lightPlane);
|
|
31533
31533
|
geometry = new BufferGeometry();
|
|
31534
31534
|
geometry.setAttribute("position", new Float32BufferAttribute([0, 0, 0, 0, 0, 1], 3));
|
|
31535
|
-
this.targetLine = new Line(geometry, material);
|
|
31535
|
+
this.targetLine = new Line$1(geometry, material);
|
|
31536
31536
|
this.add(this.targetLine);
|
|
31537
31537
|
this.update();
|
|
31538
31538
|
}
|
|
@@ -31763,7 +31763,7 @@ function PlaneHelper(plane, size, hex) {
|
|
|
31763
31763
|
var geometry = new BufferGeometry();
|
|
31764
31764
|
geometry.setAttribute("position", new Float32BufferAttribute(positions, 3));
|
|
31765
31765
|
geometry.computeBoundingSphere();
|
|
31766
|
-
Line.call(this, geometry, new LineBasicMaterial({ color, toneMapped: false }));
|
|
31766
|
+
Line$1.call(this, geometry, new LineBasicMaterial({ color, toneMapped: false }));
|
|
31767
31767
|
this.type = "PlaneHelper";
|
|
31768
31768
|
var positions2 = [1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1];
|
|
31769
31769
|
var geometry2 = new BufferGeometry();
|
|
@@ -31771,7 +31771,7 @@ function PlaneHelper(plane, size, hex) {
|
|
|
31771
31771
|
geometry2.computeBoundingSphere();
|
|
31772
31772
|
this.add(new Mesh(geometry2, new MeshBasicMaterial({ color, opacity: 0.2, transparent: true, depthWrite: false, toneMapped: false })));
|
|
31773
31773
|
}
|
|
31774
|
-
PlaneHelper.prototype = Object.create(Line.prototype);
|
|
31774
|
+
PlaneHelper.prototype = Object.create(Line$1.prototype);
|
|
31775
31775
|
PlaneHelper.prototype.constructor = PlaneHelper;
|
|
31776
31776
|
PlaneHelper.prototype.updateMatrixWorld = function(force) {
|
|
31777
31777
|
var scale = -this.plane.constant;
|
|
@@ -31806,7 +31806,7 @@ function ArrowHelper(dir, origin, length, color, headLength, headWidth) {
|
|
|
31806
31806
|
_coneGeometry.translate(0, -0.5, 0);
|
|
31807
31807
|
}
|
|
31808
31808
|
this.position.copy(origin);
|
|
31809
|
-
this.line = new Line(_lineGeometry, new LineBasicMaterial({ color, toneMapped: false }));
|
|
31809
|
+
this.line = new Line$1(_lineGeometry, new LineBasicMaterial({ color, toneMapped: false }));
|
|
31810
31810
|
this.line.matrixAutoUpdate = false;
|
|
31811
31811
|
this.add(this.line);
|
|
31812
31812
|
this.cone = new Mesh(_coneGeometry, new MeshBasicMaterial({ color, toneMapped: false }));
|
|
@@ -33814,8 +33814,8 @@ var FBXLoader = function() {
|
|
|
33814
33814
|
var arrayBufferContent = videoNode.Content instanceof ArrayBuffer && videoNode.Content.byteLength > 0;
|
|
33815
33815
|
var base64Content = typeof videoNode.Content === "string" && videoNode.Content !== "";
|
|
33816
33816
|
if (arrayBufferContent || base64Content) {
|
|
33817
|
-
var
|
|
33818
|
-
blobs[videoNode.RelativeFilename || videoNode.Filename] =
|
|
33817
|
+
var image2 = this.parseImage(videoNodes[nodeID]);
|
|
33818
|
+
blobs[videoNode.RelativeFilename || videoNode.Filename] = image2;
|
|
33819
33819
|
}
|
|
33820
33820
|
}
|
|
33821
33821
|
}
|
|
@@ -34391,7 +34391,7 @@ var FBXLoader = function() {
|
|
|
34391
34391
|
return geo;
|
|
34392
34392
|
}, null);
|
|
34393
34393
|
var material = new LineBasicMaterial({ color: 3342591, linewidth: 1 });
|
|
34394
|
-
return new Line(geometry, material);
|
|
34394
|
+
return new Line$1(geometry, material);
|
|
34395
34395
|
},
|
|
34396
34396
|
getTransformData: function(model, modelNode) {
|
|
34397
34397
|
var transformData = {};
|
|
@@ -34507,17 +34507,17 @@ var FBXLoader = function() {
|
|
|
34507
34507
|
});
|
|
34508
34508
|
},
|
|
34509
34509
|
setupMorphMaterial: function(child, material, index) {
|
|
34510
|
-
var
|
|
34510
|
+
var uuid2 = child.uuid;
|
|
34511
34511
|
var matUuid = material.uuid;
|
|
34512
34512
|
var sharedMat = false;
|
|
34513
34513
|
sceneGraph.traverse(function(node) {
|
|
34514
34514
|
if (node.isMesh) {
|
|
34515
34515
|
if (Array.isArray(node.material)) {
|
|
34516
34516
|
node.material.forEach(function(mat) {
|
|
34517
|
-
if (mat.uuid === matUuid && node.uuid !==
|
|
34517
|
+
if (mat.uuid === matUuid && node.uuid !== uuid2)
|
|
34518
34518
|
sharedMat = true;
|
|
34519
34519
|
});
|
|
34520
|
-
} else if (node.material.uuid === matUuid && node.uuid !==
|
|
34520
|
+
} else if (node.material.uuid === matUuid && node.uuid !== uuid2)
|
|
34521
34521
|
sharedMat = true;
|
|
34522
34522
|
}
|
|
34523
34523
|
});
|
|
@@ -37182,7 +37182,7 @@ const CameraMovementPlugin = (five) => {
|
|
|
37182
37182
|
rotate
|
|
37183
37183
|
};
|
|
37184
37184
|
};
|
|
37185
|
-
function samePointAt(point1, point2) {
|
|
37185
|
+
function samePointAt$1(point1, point2) {
|
|
37186
37186
|
return point1.x === point2.x && point1.y === point2.y;
|
|
37187
37187
|
}
|
|
37188
37188
|
function sameK(k1, k2) {
|
|
@@ -37223,9 +37223,9 @@ function intersectionOfLine(linePoints1, linePoints2, needIntersectionInLine) {
|
|
|
37223
37223
|
return { x, y: y2 };
|
|
37224
37224
|
}
|
|
37225
37225
|
function pointOnLine(point, linePoints) {
|
|
37226
|
-
if (samePointAt(point, linePoints[0]))
|
|
37226
|
+
if (samePointAt$1(point, linePoints[0]))
|
|
37227
37227
|
return true;
|
|
37228
|
-
if (samePointAt(point, linePoints[1]))
|
|
37228
|
+
if (samePointAt$1(point, linePoints[1]))
|
|
37229
37229
|
return true;
|
|
37230
37230
|
return (linePoints[0].x - point.x) * (point.x - linePoints[1].x) >= 0 && (linePoints[0].y - point.y) * (point.y - linePoints[1].y) >= 0 && sameK(getK(linePoints[0], point), getK(point, linePoints[1]));
|
|
37231
37231
|
}
|
|
@@ -37816,31 +37816,36 @@ class PanoCompassController {
|
|
|
37816
37816
|
});
|
|
37817
37817
|
__publicField(this, "onFivePanoArrived", (panoIndex) => {
|
|
37818
37818
|
var _a, _b, _c, _d;
|
|
37819
|
-
if (!this.compassMesh || !this.entryDoorMesh || !this.roomInfoInstance || !this.roomInfoWrapperInstance)
|
|
37820
|
-
return;
|
|
37821
|
-
if (!this.data)
|
|
37822
|
-
return;
|
|
37823
37819
|
const standingPosition = this.five.work.observers[panoIndex].standingPosition;
|
|
37824
|
-
this.compassMesh
|
|
37825
|
-
|
|
37826
|
-
|
|
37827
|
-
|
|
37828
|
-
|
|
37829
|
-
|
|
37830
|
-
|
|
37831
|
-
|
|
37832
|
-
|
|
37820
|
+
if (this.compassMesh) {
|
|
37821
|
+
this.compassMesh.position.copy(standingPosition.clone().setY(standingPosition.y + 0.01));
|
|
37822
|
+
if (this.compassMesh.material.opacity !== 0)
|
|
37823
|
+
return;
|
|
37824
|
+
(_a = this.compassMeshTween) == null ? void 0 : _a.dispose();
|
|
37825
|
+
this.compassMeshTween = tweenProgress(1e3).onUpdate(({ progress }) => {
|
|
37826
|
+
var _a2;
|
|
37827
|
+
(_a2 = this.compassMesh) == null ? void 0 : _a2.material.setValues({ opacity: progress });
|
|
37828
|
+
this.five.needsRender = true;
|
|
37829
|
+
}).play();
|
|
37830
|
+
}
|
|
37831
|
+
if (this.entryDoorMesh) {
|
|
37832
|
+
const entryDoorPosition = new THREE.Vector3(this.data.entrance.position.x, this.data.entrance.position.y, this.data.entrance.position.z);
|
|
37833
|
+
const panoToEntryDoorVector = entryDoorPosition.clone().setY(standingPosition.y).sub(standingPosition).normalize();
|
|
37834
|
+
const compassEntryDoorPosition = standingPosition.clone().add(panoToEntryDoorVector.clone().multiplyScalar(0.7)).setY(standingPosition.y + 0.01);
|
|
37835
|
+
this.entryDoorMesh.rotation.z = new THREE.Vector3(0, 0, -1).angleTo(panoToEntryDoorVector);
|
|
37836
|
+
this.entryDoorMesh.position.copy(compassEntryDoorPosition);
|
|
37837
|
+
((_b = this.data) == null ? void 0 : _b.room_observers[panoIndex].room.type) === 1 ? (_c = this.entryDoorMesh) == null ? void 0 : _c.material.setValues({ opacity: 1 }) : (_d = this.entryDoorMesh) == null ? void 0 : _d.material.setValues({ opacity: 0 });
|
|
37838
|
+
}
|
|
37839
|
+
if (this.roomInfoInstance && this.roomInfoWrapperInstance) {
|
|
37840
|
+
this.roomInfoWrapperInstance.css3DObject.position.copy(standingPosition.clone().setY(standingPosition.y + 0.01));
|
|
37841
|
+
this.roomInfoInstance.setRoom(this.data.room_observers[panoIndex].room);
|
|
37842
|
+
}
|
|
37833
37843
|
this.five.needsRender = true;
|
|
37834
|
-
if (this.compassMesh.material.opacity !== 0)
|
|
37835
|
-
return;
|
|
37836
|
-
(_d = this.compassMeshTween) == null ? void 0 : _d.dispose();
|
|
37837
|
-
this.compassMeshTween = tweenProgress(1e3).onUpdate(({ progress }) => {
|
|
37838
|
-
var _a2;
|
|
37839
|
-
(_a2 = this.compassMesh) == null ? void 0 : _a2.material.setValues({ opacity: progress });
|
|
37840
|
-
this.five.needsRender = true;
|
|
37841
|
-
}).play();
|
|
37842
37844
|
});
|
|
37843
|
-
__publicField(this, "onFiveCameraDirectionUpdate", ({
|
|
37845
|
+
__publicField(this, "onFiveCameraDirectionUpdate", ({
|
|
37846
|
+
longitude,
|
|
37847
|
+
latitude
|
|
37848
|
+
}) => {
|
|
37844
37849
|
var _a, _b;
|
|
37845
37850
|
if (!this.roomInfoWrapperInstance)
|
|
37846
37851
|
return;
|
|
@@ -37864,19 +37869,23 @@ class PanoCompassController {
|
|
|
37864
37869
|
async init() {
|
|
37865
37870
|
if (!this.data || !this.modelLoaded)
|
|
37866
37871
|
return;
|
|
37867
|
-
|
|
37868
|
-
|
|
37869
|
-
|
|
37870
|
-
|
|
37871
|
-
|
|
37872
|
-
|
|
37873
|
-
|
|
37874
|
-
this.
|
|
37872
|
+
const northRad = this.data.north_rad;
|
|
37873
|
+
if (northRad != null) {
|
|
37874
|
+
this.compassMesh = await this.loadCompassMesh();
|
|
37875
|
+
this.compassMesh.rotateX(-Math.PI / 2);
|
|
37876
|
+
this.compassMesh.rotateZ(northRad - Math.PI / 2);
|
|
37877
|
+
this.group.add(this.compassMesh);
|
|
37878
|
+
}
|
|
37879
|
+
if (this.data.entrance != null) {
|
|
37880
|
+
this.entryDoorMesh = await this.loadEntryDoorMesh();
|
|
37881
|
+
this.roomInfoWrapperInstance = this.loadRoomInfo();
|
|
37882
|
+
this.roomInfoInstance = getRoomInfoInstance();
|
|
37883
|
+
this.entryDoorMesh.rotateX(-Math.PI / 2);
|
|
37884
|
+
if (this.roomInfoWrapperInstance)
|
|
37885
|
+
this.roomInfoInstance.appendTo(this.roomInfoWrapperInstance.container);
|
|
37886
|
+
this.group.add(this.entryDoorMesh);
|
|
37887
|
+
}
|
|
37875
37888
|
this.onFivePanoArrived(this.five.panoIndex || 0);
|
|
37876
|
-
this.group.add(this.compassMesh);
|
|
37877
|
-
this.group.add(this.entryDoorMesh);
|
|
37878
|
-
if (this.roomInfoWrapperInstance)
|
|
37879
|
-
this.roomInfoInstance.appendTo(this.roomInfoWrapperInstance.container);
|
|
37880
37889
|
this.five.needsRender = true;
|
|
37881
37890
|
}
|
|
37882
37891
|
async loadCompassMesh() {
|
|
@@ -37920,4 +37929,3352 @@ class PanoCompassController {
|
|
|
37920
37929
|
return roomInfo;
|
|
37921
37930
|
}
|
|
37922
37931
|
}
|
|
37923
|
-
|
|
37932
|
+
function exchange(array, index1, index2) {
|
|
37933
|
+
const value = array[index1];
|
|
37934
|
+
array[index1] = array[index2];
|
|
37935
|
+
array[index2] = value;
|
|
37936
|
+
}
|
|
37937
|
+
class Magnifier {
|
|
37938
|
+
constructor(five, options) {
|
|
37939
|
+
__publicField(this, "five");
|
|
37940
|
+
__publicField(this, "scale");
|
|
37941
|
+
__publicField(this, "width");
|
|
37942
|
+
__publicField(this, "height");
|
|
37943
|
+
__publicField(this, "pixelRatio");
|
|
37944
|
+
__publicField(this, "originWidth");
|
|
37945
|
+
__publicField(this, "originHeight");
|
|
37946
|
+
__publicField(this, "context");
|
|
37947
|
+
__publicField(this, "canvas", document.createElement("canvas"));
|
|
37948
|
+
__publicField(this, "container");
|
|
37949
|
+
if (!five.renderer)
|
|
37950
|
+
throw new Error("Five Render \u672A\u521D\u59CB\u5316");
|
|
37951
|
+
this.five = five;
|
|
37952
|
+
const scale = options.scale;
|
|
37953
|
+
const pixelRatio = five.renderer.getPixelRatio();
|
|
37954
|
+
const originWidth = options.width;
|
|
37955
|
+
const originHeight = options.height;
|
|
37956
|
+
const width = originWidth * pixelRatio;
|
|
37957
|
+
const height = originHeight * pixelRatio;
|
|
37958
|
+
const magnifier = this.canvas;
|
|
37959
|
+
const context = this.canvas.getContext("2d");
|
|
37960
|
+
if (!context)
|
|
37961
|
+
throw new Error("CANNOT CREATE CONTEXT2D");
|
|
37962
|
+
this.scale = scale;
|
|
37963
|
+
this.context = context;
|
|
37964
|
+
this.width = width;
|
|
37965
|
+
this.height = height;
|
|
37966
|
+
this.originWidth = originWidth;
|
|
37967
|
+
this.originHeight = originHeight;
|
|
37968
|
+
this.pixelRatio = pixelRatio;
|
|
37969
|
+
magnifier.classList.add("plugin-measure-magnifier");
|
|
37970
|
+
magnifier.style.position = "absolute";
|
|
37971
|
+
magnifier.style.pointerEvents = "none";
|
|
37972
|
+
magnifier.style.borderRadius = "50%";
|
|
37973
|
+
magnifier.style.left = -width / 2 + "px";
|
|
37974
|
+
magnifier.style.top = -height - 90 + "px";
|
|
37975
|
+
magnifier.setAttribute("width", width.toString());
|
|
37976
|
+
magnifier.setAttribute("height", height.toString());
|
|
37977
|
+
this.canvas.style.width = originWidth + "px";
|
|
37978
|
+
this.canvas.style.height = originHeight + "px";
|
|
37979
|
+
}
|
|
37980
|
+
dispose() {
|
|
37981
|
+
this.clear();
|
|
37982
|
+
this.canvas.remove();
|
|
37983
|
+
}
|
|
37984
|
+
clear() {
|
|
37985
|
+
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
37986
|
+
}
|
|
37987
|
+
appendTo(element2) {
|
|
37988
|
+
this.container = element2;
|
|
37989
|
+
element2.append(this.canvas);
|
|
37990
|
+
}
|
|
37991
|
+
updateWithPoint(point) {
|
|
37992
|
+
if (!this.five.renderer || !this.container)
|
|
37993
|
+
return;
|
|
37994
|
+
const { scale, pixelRatio, context, originWidth, originHeight, width, height } = this;
|
|
37995
|
+
const position2d = point.clone().project(this.five.camera);
|
|
37996
|
+
const left = (position2d.x + 1) / 2 * this.container.clientWidth;
|
|
37997
|
+
const right = -(position2d.x - 1) / 2 * this.container.clientWidth;
|
|
37998
|
+
const top = -(position2d.y - 1) / 2 * this.container.clientHeight;
|
|
37999
|
+
if (left < 183) {
|
|
38000
|
+
this.canvas.style.top = -originHeight / 2 + "px";
|
|
38001
|
+
this.canvas.style.left = 90 + "px";
|
|
38002
|
+
} else if (top < 183) {
|
|
38003
|
+
this.canvas.style.top = 90 + "px";
|
|
38004
|
+
this.canvas.style.left = -originWidth / 2 + "px";
|
|
38005
|
+
} else if (right < 183) {
|
|
38006
|
+
this.canvas.style.top = -originHeight / 2 + "px";
|
|
38007
|
+
this.canvas.style.left = -originWidth - 90 + "px";
|
|
38008
|
+
} else {
|
|
38009
|
+
this.canvas.style.left = -originWidth / 2 + "px";
|
|
38010
|
+
this.canvas.style.top = -originHeight - 90 + "px";
|
|
38011
|
+
}
|
|
38012
|
+
this.canvas.style.transform = `translate3d(${left}px, ${top}px, 10px)`;
|
|
38013
|
+
const renderSize = this.five.renderer.getSize(new Vector2$1());
|
|
38014
|
+
const x = (position2d.x + 1) / 2 * renderSize.x;
|
|
38015
|
+
const y2 = (position2d.y + 1) / 2 * renderSize.y;
|
|
38016
|
+
const pixels = this.five.getPixels(x - originWidth / scale / 2, y2 - originHeight / scale / 2, originWidth / scale, originHeight / scale, pixelRatio * scale);
|
|
38017
|
+
const length = width * height / 2;
|
|
38018
|
+
for (let index = 0; index < length; index++) {
|
|
38019
|
+
const targetIndex = (height - Math.floor(index / width) - 1) * width + index % width;
|
|
38020
|
+
exchange(pixels, index * 4 + 0, targetIndex * 4 + 0);
|
|
38021
|
+
exchange(pixels, index * 4 + 1, targetIndex * 4 + 1);
|
|
38022
|
+
exchange(pixels, index * 4 + 2, targetIndex * 4 + 2);
|
|
38023
|
+
exchange(pixels, index * 4 + 3, targetIndex * 4 + 3);
|
|
38024
|
+
}
|
|
38025
|
+
const imageData = context.createImageData(width, height);
|
|
38026
|
+
imageData.data.set(pixels);
|
|
38027
|
+
context.putImageData(imageData, 0, 0);
|
|
38028
|
+
}
|
|
38029
|
+
}
|
|
38030
|
+
class FiveHelper {
|
|
38031
|
+
constructor(five) {
|
|
38032
|
+
__publicField(this, "edges", []);
|
|
38033
|
+
__publicField(this, "five");
|
|
38034
|
+
__publicField(this, "onModelLoaded", () => {
|
|
38035
|
+
if (!this.five.model)
|
|
38036
|
+
return;
|
|
38037
|
+
this.edges = this.five.model.getEdges();
|
|
38038
|
+
});
|
|
38039
|
+
this.five = five;
|
|
38040
|
+
this.five.model.loaded ? this.onModelLoaded() : this.five.on("modelLoaded", this.onModelLoaded);
|
|
38041
|
+
}
|
|
38042
|
+
dispose() {
|
|
38043
|
+
}
|
|
38044
|
+
getAdsorbentPoint(intersection) {
|
|
38045
|
+
if (this.edges.length === 0)
|
|
38046
|
+
return null;
|
|
38047
|
+
let distance = Infinity;
|
|
38048
|
+
let closestPoint;
|
|
38049
|
+
this.edges.forEach((line) => {
|
|
38050
|
+
const _closestPoint = line.closestPointToPoint(intersection.point, true, new Vector3$1());
|
|
38051
|
+
const _distance = _closestPoint.distanceTo(intersection.point);
|
|
38052
|
+
if (_distance < distance) {
|
|
38053
|
+
closestPoint = _closestPoint;
|
|
38054
|
+
distance = _distance;
|
|
38055
|
+
}
|
|
38056
|
+
});
|
|
38057
|
+
if (distance > 0.1)
|
|
38058
|
+
return null;
|
|
38059
|
+
return closestPoint || null;
|
|
38060
|
+
}
|
|
38061
|
+
}
|
|
38062
|
+
var hammer = { exports: {} };
|
|
38063
|
+
/*! Hammer.JS - v2.0.7 - 2016-04-22
|
|
38064
|
+
* http://hammerjs.github.io/
|
|
38065
|
+
*
|
|
38066
|
+
* Copyright (c) 2016 Jorik Tangelder;
|
|
38067
|
+
* Licensed under the MIT license */
|
|
38068
|
+
(function(module) {
|
|
38069
|
+
(function(window2, document2, exportName, undefined$1) {
|
|
38070
|
+
var VENDOR_PREFIXES = ["", "webkit", "Moz", "MS", "ms", "o"];
|
|
38071
|
+
var TEST_ELEMENT = document2.createElement("div");
|
|
38072
|
+
var TYPE_FUNCTION = "function";
|
|
38073
|
+
var round = Math.round;
|
|
38074
|
+
var abs = Math.abs;
|
|
38075
|
+
var now2 = Date.now;
|
|
38076
|
+
function setTimeoutContext(fn, timeout, context) {
|
|
38077
|
+
return setTimeout(bindFn(fn, context), timeout);
|
|
38078
|
+
}
|
|
38079
|
+
function invokeArrayArg(arg, fn, context) {
|
|
38080
|
+
if (Array.isArray(arg)) {
|
|
38081
|
+
each(arg, context[fn], context);
|
|
38082
|
+
return true;
|
|
38083
|
+
}
|
|
38084
|
+
return false;
|
|
38085
|
+
}
|
|
38086
|
+
function each(obj, iterator, context) {
|
|
38087
|
+
var i;
|
|
38088
|
+
if (!obj) {
|
|
38089
|
+
return;
|
|
38090
|
+
}
|
|
38091
|
+
if (obj.forEach) {
|
|
38092
|
+
obj.forEach(iterator, context);
|
|
38093
|
+
} else if (obj.length !== undefined$1) {
|
|
38094
|
+
i = 0;
|
|
38095
|
+
while (i < obj.length) {
|
|
38096
|
+
iterator.call(context, obj[i], i, obj);
|
|
38097
|
+
i++;
|
|
38098
|
+
}
|
|
38099
|
+
} else {
|
|
38100
|
+
for (i in obj) {
|
|
38101
|
+
obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);
|
|
38102
|
+
}
|
|
38103
|
+
}
|
|
38104
|
+
}
|
|
38105
|
+
function deprecate(method, name, message) {
|
|
38106
|
+
var deprecationMessage = "DEPRECATED METHOD: " + name + "\n" + message + " AT \n";
|
|
38107
|
+
return function() {
|
|
38108
|
+
var e = new Error("get-stack-trace");
|
|
38109
|
+
var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, "").replace(/^\s+at\s+/gm, "").replace(/^Object.<anonymous>\s*\(/gm, "{anonymous}()@") : "Unknown Stack Trace";
|
|
38110
|
+
var log = window2.console && (window2.console.warn || window2.console.log);
|
|
38111
|
+
if (log) {
|
|
38112
|
+
log.call(window2.console, deprecationMessage, stack);
|
|
38113
|
+
}
|
|
38114
|
+
return method.apply(this, arguments);
|
|
38115
|
+
};
|
|
38116
|
+
}
|
|
38117
|
+
var assign2;
|
|
38118
|
+
if (typeof Object.assign !== "function") {
|
|
38119
|
+
assign2 = function assign3(target) {
|
|
38120
|
+
if (target === undefined$1 || target === null) {
|
|
38121
|
+
throw new TypeError("Cannot convert undefined or null to object");
|
|
38122
|
+
}
|
|
38123
|
+
var output = Object(target);
|
|
38124
|
+
for (var index = 1; index < arguments.length; index++) {
|
|
38125
|
+
var source = arguments[index];
|
|
38126
|
+
if (source !== undefined$1 && source !== null) {
|
|
38127
|
+
for (var nextKey in source) {
|
|
38128
|
+
if (source.hasOwnProperty(nextKey)) {
|
|
38129
|
+
output[nextKey] = source[nextKey];
|
|
38130
|
+
}
|
|
38131
|
+
}
|
|
38132
|
+
}
|
|
38133
|
+
}
|
|
38134
|
+
return output;
|
|
38135
|
+
};
|
|
38136
|
+
} else {
|
|
38137
|
+
assign2 = Object.assign;
|
|
38138
|
+
}
|
|
38139
|
+
var extend = deprecate(function extend2(dest, src, merge2) {
|
|
38140
|
+
var keys = Object.keys(src);
|
|
38141
|
+
var i = 0;
|
|
38142
|
+
while (i < keys.length) {
|
|
38143
|
+
if (!merge2 || merge2 && dest[keys[i]] === undefined$1) {
|
|
38144
|
+
dest[keys[i]] = src[keys[i]];
|
|
38145
|
+
}
|
|
38146
|
+
i++;
|
|
38147
|
+
}
|
|
38148
|
+
return dest;
|
|
38149
|
+
}, "extend", "Use `assign`.");
|
|
38150
|
+
var merge = deprecate(function merge2(dest, src) {
|
|
38151
|
+
return extend(dest, src, true);
|
|
38152
|
+
}, "merge", "Use `assign`.");
|
|
38153
|
+
function inherit(child, base, properties) {
|
|
38154
|
+
var baseP = base.prototype, childP;
|
|
38155
|
+
childP = child.prototype = Object.create(baseP);
|
|
38156
|
+
childP.constructor = child;
|
|
38157
|
+
childP._super = baseP;
|
|
38158
|
+
if (properties) {
|
|
38159
|
+
assign2(childP, properties);
|
|
38160
|
+
}
|
|
38161
|
+
}
|
|
38162
|
+
function bindFn(fn, context) {
|
|
38163
|
+
return function boundFn() {
|
|
38164
|
+
return fn.apply(context, arguments);
|
|
38165
|
+
};
|
|
38166
|
+
}
|
|
38167
|
+
function boolOrFn(val, args) {
|
|
38168
|
+
if (typeof val == TYPE_FUNCTION) {
|
|
38169
|
+
return val.apply(args ? args[0] || undefined$1 : undefined$1, args);
|
|
38170
|
+
}
|
|
38171
|
+
return val;
|
|
38172
|
+
}
|
|
38173
|
+
function ifUndefined(val1, val2) {
|
|
38174
|
+
return val1 === undefined$1 ? val2 : val1;
|
|
38175
|
+
}
|
|
38176
|
+
function addEventListeners(target, types, handler) {
|
|
38177
|
+
each(splitStr(types), function(type) {
|
|
38178
|
+
target.addEventListener(type, handler, false);
|
|
38179
|
+
});
|
|
38180
|
+
}
|
|
38181
|
+
function removeEventListeners(target, types, handler) {
|
|
38182
|
+
each(splitStr(types), function(type) {
|
|
38183
|
+
target.removeEventListener(type, handler, false);
|
|
38184
|
+
});
|
|
38185
|
+
}
|
|
38186
|
+
function hasParent(node, parent) {
|
|
38187
|
+
while (node) {
|
|
38188
|
+
if (node == parent) {
|
|
38189
|
+
return true;
|
|
38190
|
+
}
|
|
38191
|
+
node = node.parentNode;
|
|
38192
|
+
}
|
|
38193
|
+
return false;
|
|
38194
|
+
}
|
|
38195
|
+
function inStr(str, find) {
|
|
38196
|
+
return str.indexOf(find) > -1;
|
|
38197
|
+
}
|
|
38198
|
+
function splitStr(str) {
|
|
38199
|
+
return str.trim().split(/\s+/g);
|
|
38200
|
+
}
|
|
38201
|
+
function inArray(src, find, findByKey) {
|
|
38202
|
+
if (src.indexOf && !findByKey) {
|
|
38203
|
+
return src.indexOf(find);
|
|
38204
|
+
} else {
|
|
38205
|
+
var i = 0;
|
|
38206
|
+
while (i < src.length) {
|
|
38207
|
+
if (findByKey && src[i][findByKey] == find || !findByKey && src[i] === find) {
|
|
38208
|
+
return i;
|
|
38209
|
+
}
|
|
38210
|
+
i++;
|
|
38211
|
+
}
|
|
38212
|
+
return -1;
|
|
38213
|
+
}
|
|
38214
|
+
}
|
|
38215
|
+
function toArray(obj) {
|
|
38216
|
+
return Array.prototype.slice.call(obj, 0);
|
|
38217
|
+
}
|
|
38218
|
+
function uniqueArray(src, key, sort) {
|
|
38219
|
+
var results = [];
|
|
38220
|
+
var values = [];
|
|
38221
|
+
var i = 0;
|
|
38222
|
+
while (i < src.length) {
|
|
38223
|
+
var val = key ? src[i][key] : src[i];
|
|
38224
|
+
if (inArray(values, val) < 0) {
|
|
38225
|
+
results.push(src[i]);
|
|
38226
|
+
}
|
|
38227
|
+
values[i] = val;
|
|
38228
|
+
i++;
|
|
38229
|
+
}
|
|
38230
|
+
if (sort) {
|
|
38231
|
+
if (!key) {
|
|
38232
|
+
results = results.sort();
|
|
38233
|
+
} else {
|
|
38234
|
+
results = results.sort(function sortUniqueArray(a, b) {
|
|
38235
|
+
return a[key] > b[key];
|
|
38236
|
+
});
|
|
38237
|
+
}
|
|
38238
|
+
}
|
|
38239
|
+
return results;
|
|
38240
|
+
}
|
|
38241
|
+
function prefixed(obj, property) {
|
|
38242
|
+
var prefix, prop;
|
|
38243
|
+
var camelProp = property[0].toUpperCase() + property.slice(1);
|
|
38244
|
+
var i = 0;
|
|
38245
|
+
while (i < VENDOR_PREFIXES.length) {
|
|
38246
|
+
prefix = VENDOR_PREFIXES[i];
|
|
38247
|
+
prop = prefix ? prefix + camelProp : property;
|
|
38248
|
+
if (prop in obj) {
|
|
38249
|
+
return prop;
|
|
38250
|
+
}
|
|
38251
|
+
i++;
|
|
38252
|
+
}
|
|
38253
|
+
return undefined$1;
|
|
38254
|
+
}
|
|
38255
|
+
var _uniqueId = 1;
|
|
38256
|
+
function uniqueId() {
|
|
38257
|
+
return _uniqueId++;
|
|
38258
|
+
}
|
|
38259
|
+
function getWindowForElement(element2) {
|
|
38260
|
+
var doc = element2.ownerDocument || element2;
|
|
38261
|
+
return doc.defaultView || doc.parentWindow || window2;
|
|
38262
|
+
}
|
|
38263
|
+
var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;
|
|
38264
|
+
var SUPPORT_TOUCH = "ontouchstart" in window2;
|
|
38265
|
+
var SUPPORT_POINTER_EVENTS = prefixed(window2, "PointerEvent") !== undefined$1;
|
|
38266
|
+
var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);
|
|
38267
|
+
var INPUT_TYPE_TOUCH = "touch";
|
|
38268
|
+
var INPUT_TYPE_PEN = "pen";
|
|
38269
|
+
var INPUT_TYPE_MOUSE = "mouse";
|
|
38270
|
+
var INPUT_TYPE_KINECT = "kinect";
|
|
38271
|
+
var COMPUTE_INTERVAL = 25;
|
|
38272
|
+
var INPUT_START = 1;
|
|
38273
|
+
var INPUT_MOVE = 2;
|
|
38274
|
+
var INPUT_END = 4;
|
|
38275
|
+
var INPUT_CANCEL = 8;
|
|
38276
|
+
var DIRECTION_NONE = 1;
|
|
38277
|
+
var DIRECTION_LEFT = 2;
|
|
38278
|
+
var DIRECTION_RIGHT = 4;
|
|
38279
|
+
var DIRECTION_UP = 8;
|
|
38280
|
+
var DIRECTION_DOWN = 16;
|
|
38281
|
+
var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;
|
|
38282
|
+
var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;
|
|
38283
|
+
var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;
|
|
38284
|
+
var PROPS_XY = ["x", "y"];
|
|
38285
|
+
var PROPS_CLIENT_XY = ["clientX", "clientY"];
|
|
38286
|
+
function Input(manager, callback) {
|
|
38287
|
+
var self2 = this;
|
|
38288
|
+
this.manager = manager;
|
|
38289
|
+
this.callback = callback;
|
|
38290
|
+
this.element = manager.element;
|
|
38291
|
+
this.target = manager.options.inputTarget;
|
|
38292
|
+
this.domHandler = function(ev) {
|
|
38293
|
+
if (boolOrFn(manager.options.enable, [manager])) {
|
|
38294
|
+
self2.handler(ev);
|
|
38295
|
+
}
|
|
38296
|
+
};
|
|
38297
|
+
this.init();
|
|
38298
|
+
}
|
|
38299
|
+
Input.prototype = {
|
|
38300
|
+
handler: function() {
|
|
38301
|
+
},
|
|
38302
|
+
init: function() {
|
|
38303
|
+
this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);
|
|
38304
|
+
this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);
|
|
38305
|
+
this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
|
|
38306
|
+
},
|
|
38307
|
+
destroy: function() {
|
|
38308
|
+
this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);
|
|
38309
|
+
this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);
|
|
38310
|
+
this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
|
|
38311
|
+
}
|
|
38312
|
+
};
|
|
38313
|
+
function createInputInstance(manager) {
|
|
38314
|
+
var Type;
|
|
38315
|
+
var inputClass = manager.options.inputClass;
|
|
38316
|
+
if (inputClass) {
|
|
38317
|
+
Type = inputClass;
|
|
38318
|
+
} else if (SUPPORT_POINTER_EVENTS) {
|
|
38319
|
+
Type = PointerEventInput;
|
|
38320
|
+
} else if (SUPPORT_ONLY_TOUCH) {
|
|
38321
|
+
Type = TouchInput;
|
|
38322
|
+
} else if (!SUPPORT_TOUCH) {
|
|
38323
|
+
Type = MouseInput;
|
|
38324
|
+
} else {
|
|
38325
|
+
Type = TouchMouseInput;
|
|
38326
|
+
}
|
|
38327
|
+
return new Type(manager, inputHandler);
|
|
38328
|
+
}
|
|
38329
|
+
function inputHandler(manager, eventType, input) {
|
|
38330
|
+
var pointersLen = input.pointers.length;
|
|
38331
|
+
var changedPointersLen = input.changedPointers.length;
|
|
38332
|
+
var isFirst = eventType & INPUT_START && pointersLen - changedPointersLen === 0;
|
|
38333
|
+
var isFinal = eventType & (INPUT_END | INPUT_CANCEL) && pointersLen - changedPointersLen === 0;
|
|
38334
|
+
input.isFirst = !!isFirst;
|
|
38335
|
+
input.isFinal = !!isFinal;
|
|
38336
|
+
if (isFirst) {
|
|
38337
|
+
manager.session = {};
|
|
38338
|
+
}
|
|
38339
|
+
input.eventType = eventType;
|
|
38340
|
+
computeInputData(manager, input);
|
|
38341
|
+
manager.emit("hammer.input", input);
|
|
38342
|
+
manager.recognize(input);
|
|
38343
|
+
manager.session.prevInput = input;
|
|
38344
|
+
}
|
|
38345
|
+
function computeInputData(manager, input) {
|
|
38346
|
+
var session = manager.session;
|
|
38347
|
+
var pointers = input.pointers;
|
|
38348
|
+
var pointersLength = pointers.length;
|
|
38349
|
+
if (!session.firstInput) {
|
|
38350
|
+
session.firstInput = simpleCloneInputData(input);
|
|
38351
|
+
}
|
|
38352
|
+
if (pointersLength > 1 && !session.firstMultiple) {
|
|
38353
|
+
session.firstMultiple = simpleCloneInputData(input);
|
|
38354
|
+
} else if (pointersLength === 1) {
|
|
38355
|
+
session.firstMultiple = false;
|
|
38356
|
+
}
|
|
38357
|
+
var firstInput = session.firstInput;
|
|
38358
|
+
var firstMultiple = session.firstMultiple;
|
|
38359
|
+
var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;
|
|
38360
|
+
var center = input.center = getCenter(pointers);
|
|
38361
|
+
input.timeStamp = now2();
|
|
38362
|
+
input.deltaTime = input.timeStamp - firstInput.timeStamp;
|
|
38363
|
+
input.angle = getAngle(offsetCenter, center);
|
|
38364
|
+
input.distance = getDistance2(offsetCenter, center);
|
|
38365
|
+
computeDeltaXY(session, input);
|
|
38366
|
+
input.offsetDirection = getDirection(input.deltaX, input.deltaY);
|
|
38367
|
+
var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);
|
|
38368
|
+
input.overallVelocityX = overallVelocity.x;
|
|
38369
|
+
input.overallVelocityY = overallVelocity.y;
|
|
38370
|
+
input.overallVelocity = abs(overallVelocity.x) > abs(overallVelocity.y) ? overallVelocity.x : overallVelocity.y;
|
|
38371
|
+
input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;
|
|
38372
|
+
input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;
|
|
38373
|
+
input.maxPointers = !session.prevInput ? input.pointers.length : input.pointers.length > session.prevInput.maxPointers ? input.pointers.length : session.prevInput.maxPointers;
|
|
38374
|
+
computeIntervalInputData(session, input);
|
|
38375
|
+
var target = manager.element;
|
|
38376
|
+
if (hasParent(input.srcEvent.target, target)) {
|
|
38377
|
+
target = input.srcEvent.target;
|
|
38378
|
+
}
|
|
38379
|
+
input.target = target;
|
|
38380
|
+
}
|
|
38381
|
+
function computeDeltaXY(session, input) {
|
|
38382
|
+
var center = input.center;
|
|
38383
|
+
var offset = session.offsetDelta || {};
|
|
38384
|
+
var prevDelta = session.prevDelta || {};
|
|
38385
|
+
var prevInput = session.prevInput || {};
|
|
38386
|
+
if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {
|
|
38387
|
+
prevDelta = session.prevDelta = {
|
|
38388
|
+
x: prevInput.deltaX || 0,
|
|
38389
|
+
y: prevInput.deltaY || 0
|
|
38390
|
+
};
|
|
38391
|
+
offset = session.offsetDelta = {
|
|
38392
|
+
x: center.x,
|
|
38393
|
+
y: center.y
|
|
38394
|
+
};
|
|
38395
|
+
}
|
|
38396
|
+
input.deltaX = prevDelta.x + (center.x - offset.x);
|
|
38397
|
+
input.deltaY = prevDelta.y + (center.y - offset.y);
|
|
38398
|
+
}
|
|
38399
|
+
function computeIntervalInputData(session, input) {
|
|
38400
|
+
var last = session.lastInterval || input, deltaTime = input.timeStamp - last.timeStamp, velocity, velocityX, velocityY, direction;
|
|
38401
|
+
if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined$1)) {
|
|
38402
|
+
var deltaX = input.deltaX - last.deltaX;
|
|
38403
|
+
var deltaY = input.deltaY - last.deltaY;
|
|
38404
|
+
var v2 = getVelocity(deltaTime, deltaX, deltaY);
|
|
38405
|
+
velocityX = v2.x;
|
|
38406
|
+
velocityY = v2.y;
|
|
38407
|
+
velocity = abs(v2.x) > abs(v2.y) ? v2.x : v2.y;
|
|
38408
|
+
direction = getDirection(deltaX, deltaY);
|
|
38409
|
+
session.lastInterval = input;
|
|
38410
|
+
} else {
|
|
38411
|
+
velocity = last.velocity;
|
|
38412
|
+
velocityX = last.velocityX;
|
|
38413
|
+
velocityY = last.velocityY;
|
|
38414
|
+
direction = last.direction;
|
|
38415
|
+
}
|
|
38416
|
+
input.velocity = velocity;
|
|
38417
|
+
input.velocityX = velocityX;
|
|
38418
|
+
input.velocityY = velocityY;
|
|
38419
|
+
input.direction = direction;
|
|
38420
|
+
}
|
|
38421
|
+
function simpleCloneInputData(input) {
|
|
38422
|
+
var pointers = [];
|
|
38423
|
+
var i = 0;
|
|
38424
|
+
while (i < input.pointers.length) {
|
|
38425
|
+
pointers[i] = {
|
|
38426
|
+
clientX: round(input.pointers[i].clientX),
|
|
38427
|
+
clientY: round(input.pointers[i].clientY)
|
|
38428
|
+
};
|
|
38429
|
+
i++;
|
|
38430
|
+
}
|
|
38431
|
+
return {
|
|
38432
|
+
timeStamp: now2(),
|
|
38433
|
+
pointers,
|
|
38434
|
+
center: getCenter(pointers),
|
|
38435
|
+
deltaX: input.deltaX,
|
|
38436
|
+
deltaY: input.deltaY
|
|
38437
|
+
};
|
|
38438
|
+
}
|
|
38439
|
+
function getCenter(pointers) {
|
|
38440
|
+
var pointersLength = pointers.length;
|
|
38441
|
+
if (pointersLength === 1) {
|
|
38442
|
+
return {
|
|
38443
|
+
x: round(pointers[0].clientX),
|
|
38444
|
+
y: round(pointers[0].clientY)
|
|
38445
|
+
};
|
|
38446
|
+
}
|
|
38447
|
+
var x = 0, y2 = 0, i = 0;
|
|
38448
|
+
while (i < pointersLength) {
|
|
38449
|
+
x += pointers[i].clientX;
|
|
38450
|
+
y2 += pointers[i].clientY;
|
|
38451
|
+
i++;
|
|
38452
|
+
}
|
|
38453
|
+
return {
|
|
38454
|
+
x: round(x / pointersLength),
|
|
38455
|
+
y: round(y2 / pointersLength)
|
|
38456
|
+
};
|
|
38457
|
+
}
|
|
38458
|
+
function getVelocity(deltaTime, x, y2) {
|
|
38459
|
+
return {
|
|
38460
|
+
x: x / deltaTime || 0,
|
|
38461
|
+
y: y2 / deltaTime || 0
|
|
38462
|
+
};
|
|
38463
|
+
}
|
|
38464
|
+
function getDirection(x, y2) {
|
|
38465
|
+
if (x === y2) {
|
|
38466
|
+
return DIRECTION_NONE;
|
|
38467
|
+
}
|
|
38468
|
+
if (abs(x) >= abs(y2)) {
|
|
38469
|
+
return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
|
|
38470
|
+
}
|
|
38471
|
+
return y2 < 0 ? DIRECTION_UP : DIRECTION_DOWN;
|
|
38472
|
+
}
|
|
38473
|
+
function getDistance2(p1, p2, props) {
|
|
38474
|
+
if (!props) {
|
|
38475
|
+
props = PROPS_XY;
|
|
38476
|
+
}
|
|
38477
|
+
var x = p2[props[0]] - p1[props[0]], y2 = p2[props[1]] - p1[props[1]];
|
|
38478
|
+
return Math.sqrt(x * x + y2 * y2);
|
|
38479
|
+
}
|
|
38480
|
+
function getAngle(p1, p2, props) {
|
|
38481
|
+
if (!props) {
|
|
38482
|
+
props = PROPS_XY;
|
|
38483
|
+
}
|
|
38484
|
+
var x = p2[props[0]] - p1[props[0]], y2 = p2[props[1]] - p1[props[1]];
|
|
38485
|
+
return Math.atan2(y2, x) * 180 / Math.PI;
|
|
38486
|
+
}
|
|
38487
|
+
function getRotation(start, end) {
|
|
38488
|
+
return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);
|
|
38489
|
+
}
|
|
38490
|
+
function getScale(start, end) {
|
|
38491
|
+
return getDistance2(end[0], end[1], PROPS_CLIENT_XY) / getDistance2(start[0], start[1], PROPS_CLIENT_XY);
|
|
38492
|
+
}
|
|
38493
|
+
var MOUSE_INPUT_MAP = {
|
|
38494
|
+
mousedown: INPUT_START,
|
|
38495
|
+
mousemove: INPUT_MOVE,
|
|
38496
|
+
mouseup: INPUT_END
|
|
38497
|
+
};
|
|
38498
|
+
var MOUSE_ELEMENT_EVENTS = "mousedown";
|
|
38499
|
+
var MOUSE_WINDOW_EVENTS = "mousemove mouseup";
|
|
38500
|
+
function MouseInput() {
|
|
38501
|
+
this.evEl = MOUSE_ELEMENT_EVENTS;
|
|
38502
|
+
this.evWin = MOUSE_WINDOW_EVENTS;
|
|
38503
|
+
this.pressed = false;
|
|
38504
|
+
Input.apply(this, arguments);
|
|
38505
|
+
}
|
|
38506
|
+
inherit(MouseInput, Input, {
|
|
38507
|
+
handler: function MEhandler(ev) {
|
|
38508
|
+
var eventType = MOUSE_INPUT_MAP[ev.type];
|
|
38509
|
+
if (eventType & INPUT_START && ev.button === 0) {
|
|
38510
|
+
this.pressed = true;
|
|
38511
|
+
}
|
|
38512
|
+
if (eventType & INPUT_MOVE && ev.which !== 1) {
|
|
38513
|
+
eventType = INPUT_END;
|
|
38514
|
+
}
|
|
38515
|
+
if (!this.pressed) {
|
|
38516
|
+
return;
|
|
38517
|
+
}
|
|
38518
|
+
if (eventType & INPUT_END) {
|
|
38519
|
+
this.pressed = false;
|
|
38520
|
+
}
|
|
38521
|
+
this.callback(this.manager, eventType, {
|
|
38522
|
+
pointers: [ev],
|
|
38523
|
+
changedPointers: [ev],
|
|
38524
|
+
pointerType: INPUT_TYPE_MOUSE,
|
|
38525
|
+
srcEvent: ev
|
|
38526
|
+
});
|
|
38527
|
+
}
|
|
38528
|
+
});
|
|
38529
|
+
var POINTER_INPUT_MAP = {
|
|
38530
|
+
pointerdown: INPUT_START,
|
|
38531
|
+
pointermove: INPUT_MOVE,
|
|
38532
|
+
pointerup: INPUT_END,
|
|
38533
|
+
pointercancel: INPUT_CANCEL,
|
|
38534
|
+
pointerout: INPUT_CANCEL
|
|
38535
|
+
};
|
|
38536
|
+
var IE10_POINTER_TYPE_ENUM = {
|
|
38537
|
+
2: INPUT_TYPE_TOUCH,
|
|
38538
|
+
3: INPUT_TYPE_PEN,
|
|
38539
|
+
4: INPUT_TYPE_MOUSE,
|
|
38540
|
+
5: INPUT_TYPE_KINECT
|
|
38541
|
+
};
|
|
38542
|
+
var POINTER_ELEMENT_EVENTS = "pointerdown";
|
|
38543
|
+
var POINTER_WINDOW_EVENTS = "pointermove pointerup pointercancel";
|
|
38544
|
+
if (window2.MSPointerEvent && !window2.PointerEvent) {
|
|
38545
|
+
POINTER_ELEMENT_EVENTS = "MSPointerDown";
|
|
38546
|
+
POINTER_WINDOW_EVENTS = "MSPointerMove MSPointerUp MSPointerCancel";
|
|
38547
|
+
}
|
|
38548
|
+
function PointerEventInput() {
|
|
38549
|
+
this.evEl = POINTER_ELEMENT_EVENTS;
|
|
38550
|
+
this.evWin = POINTER_WINDOW_EVENTS;
|
|
38551
|
+
Input.apply(this, arguments);
|
|
38552
|
+
this.store = this.manager.session.pointerEvents = [];
|
|
38553
|
+
}
|
|
38554
|
+
inherit(PointerEventInput, Input, {
|
|
38555
|
+
handler: function PEhandler(ev) {
|
|
38556
|
+
var store = this.store;
|
|
38557
|
+
var removePointer = false;
|
|
38558
|
+
var eventTypeNormalized = ev.type.toLowerCase().replace("ms", "");
|
|
38559
|
+
var eventType = POINTER_INPUT_MAP[eventTypeNormalized];
|
|
38560
|
+
var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;
|
|
38561
|
+
var isTouch = pointerType == INPUT_TYPE_TOUCH;
|
|
38562
|
+
var storeIndex = inArray(store, ev.pointerId, "pointerId");
|
|
38563
|
+
if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {
|
|
38564
|
+
if (storeIndex < 0) {
|
|
38565
|
+
store.push(ev);
|
|
38566
|
+
storeIndex = store.length - 1;
|
|
38567
|
+
}
|
|
38568
|
+
} else if (eventType & (INPUT_END | INPUT_CANCEL)) {
|
|
38569
|
+
removePointer = true;
|
|
38570
|
+
}
|
|
38571
|
+
if (storeIndex < 0) {
|
|
38572
|
+
return;
|
|
38573
|
+
}
|
|
38574
|
+
store[storeIndex] = ev;
|
|
38575
|
+
this.callback(this.manager, eventType, {
|
|
38576
|
+
pointers: store,
|
|
38577
|
+
changedPointers: [ev],
|
|
38578
|
+
pointerType,
|
|
38579
|
+
srcEvent: ev
|
|
38580
|
+
});
|
|
38581
|
+
if (removePointer) {
|
|
38582
|
+
store.splice(storeIndex, 1);
|
|
38583
|
+
}
|
|
38584
|
+
}
|
|
38585
|
+
});
|
|
38586
|
+
var SINGLE_TOUCH_INPUT_MAP = {
|
|
38587
|
+
touchstart: INPUT_START,
|
|
38588
|
+
touchmove: INPUT_MOVE,
|
|
38589
|
+
touchend: INPUT_END,
|
|
38590
|
+
touchcancel: INPUT_CANCEL
|
|
38591
|
+
};
|
|
38592
|
+
var SINGLE_TOUCH_TARGET_EVENTS = "touchstart";
|
|
38593
|
+
var SINGLE_TOUCH_WINDOW_EVENTS = "touchstart touchmove touchend touchcancel";
|
|
38594
|
+
function SingleTouchInput() {
|
|
38595
|
+
this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;
|
|
38596
|
+
this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;
|
|
38597
|
+
this.started = false;
|
|
38598
|
+
Input.apply(this, arguments);
|
|
38599
|
+
}
|
|
38600
|
+
inherit(SingleTouchInput, Input, {
|
|
38601
|
+
handler: function TEhandler(ev) {
|
|
38602
|
+
var type = SINGLE_TOUCH_INPUT_MAP[ev.type];
|
|
38603
|
+
if (type === INPUT_START) {
|
|
38604
|
+
this.started = true;
|
|
38605
|
+
}
|
|
38606
|
+
if (!this.started) {
|
|
38607
|
+
return;
|
|
38608
|
+
}
|
|
38609
|
+
var touches = normalizeSingleTouches.call(this, ev, type);
|
|
38610
|
+
if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {
|
|
38611
|
+
this.started = false;
|
|
38612
|
+
}
|
|
38613
|
+
this.callback(this.manager, type, {
|
|
38614
|
+
pointers: touches[0],
|
|
38615
|
+
changedPointers: touches[1],
|
|
38616
|
+
pointerType: INPUT_TYPE_TOUCH,
|
|
38617
|
+
srcEvent: ev
|
|
38618
|
+
});
|
|
38619
|
+
}
|
|
38620
|
+
});
|
|
38621
|
+
function normalizeSingleTouches(ev, type) {
|
|
38622
|
+
var all = toArray(ev.touches);
|
|
38623
|
+
var changed = toArray(ev.changedTouches);
|
|
38624
|
+
if (type & (INPUT_END | INPUT_CANCEL)) {
|
|
38625
|
+
all = uniqueArray(all.concat(changed), "identifier", true);
|
|
38626
|
+
}
|
|
38627
|
+
return [all, changed];
|
|
38628
|
+
}
|
|
38629
|
+
var TOUCH_INPUT_MAP = {
|
|
38630
|
+
touchstart: INPUT_START,
|
|
38631
|
+
touchmove: INPUT_MOVE,
|
|
38632
|
+
touchend: INPUT_END,
|
|
38633
|
+
touchcancel: INPUT_CANCEL
|
|
38634
|
+
};
|
|
38635
|
+
var TOUCH_TARGET_EVENTS = "touchstart touchmove touchend touchcancel";
|
|
38636
|
+
function TouchInput() {
|
|
38637
|
+
this.evTarget = TOUCH_TARGET_EVENTS;
|
|
38638
|
+
this.targetIds = {};
|
|
38639
|
+
Input.apply(this, arguments);
|
|
38640
|
+
}
|
|
38641
|
+
inherit(TouchInput, Input, {
|
|
38642
|
+
handler: function MTEhandler(ev) {
|
|
38643
|
+
var type = TOUCH_INPUT_MAP[ev.type];
|
|
38644
|
+
var touches = getTouches.call(this, ev, type);
|
|
38645
|
+
if (!touches) {
|
|
38646
|
+
return;
|
|
38647
|
+
}
|
|
38648
|
+
this.callback(this.manager, type, {
|
|
38649
|
+
pointers: touches[0],
|
|
38650
|
+
changedPointers: touches[1],
|
|
38651
|
+
pointerType: INPUT_TYPE_TOUCH,
|
|
38652
|
+
srcEvent: ev
|
|
38653
|
+
});
|
|
38654
|
+
}
|
|
38655
|
+
});
|
|
38656
|
+
function getTouches(ev, type) {
|
|
38657
|
+
var allTouches = toArray(ev.touches);
|
|
38658
|
+
var targetIds = this.targetIds;
|
|
38659
|
+
if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {
|
|
38660
|
+
targetIds[allTouches[0].identifier] = true;
|
|
38661
|
+
return [allTouches, allTouches];
|
|
38662
|
+
}
|
|
38663
|
+
var i, targetTouches, changedTouches = toArray(ev.changedTouches), changedTargetTouches = [], target = this.target;
|
|
38664
|
+
targetTouches = allTouches.filter(function(touch) {
|
|
38665
|
+
return hasParent(touch.target, target);
|
|
38666
|
+
});
|
|
38667
|
+
if (type === INPUT_START) {
|
|
38668
|
+
i = 0;
|
|
38669
|
+
while (i < targetTouches.length) {
|
|
38670
|
+
targetIds[targetTouches[i].identifier] = true;
|
|
38671
|
+
i++;
|
|
38672
|
+
}
|
|
38673
|
+
}
|
|
38674
|
+
i = 0;
|
|
38675
|
+
while (i < changedTouches.length) {
|
|
38676
|
+
if (targetIds[changedTouches[i].identifier]) {
|
|
38677
|
+
changedTargetTouches.push(changedTouches[i]);
|
|
38678
|
+
}
|
|
38679
|
+
if (type & (INPUT_END | INPUT_CANCEL)) {
|
|
38680
|
+
delete targetIds[changedTouches[i].identifier];
|
|
38681
|
+
}
|
|
38682
|
+
i++;
|
|
38683
|
+
}
|
|
38684
|
+
if (!changedTargetTouches.length) {
|
|
38685
|
+
return;
|
|
38686
|
+
}
|
|
38687
|
+
return [
|
|
38688
|
+
uniqueArray(targetTouches.concat(changedTargetTouches), "identifier", true),
|
|
38689
|
+
changedTargetTouches
|
|
38690
|
+
];
|
|
38691
|
+
}
|
|
38692
|
+
var DEDUP_TIMEOUT = 2500;
|
|
38693
|
+
var DEDUP_DISTANCE = 25;
|
|
38694
|
+
function TouchMouseInput() {
|
|
38695
|
+
Input.apply(this, arguments);
|
|
38696
|
+
var handler = bindFn(this.handler, this);
|
|
38697
|
+
this.touch = new TouchInput(this.manager, handler);
|
|
38698
|
+
this.mouse = new MouseInput(this.manager, handler);
|
|
38699
|
+
this.primaryTouch = null;
|
|
38700
|
+
this.lastTouches = [];
|
|
38701
|
+
}
|
|
38702
|
+
inherit(TouchMouseInput, Input, {
|
|
38703
|
+
handler: function TMEhandler(manager, inputEvent, inputData) {
|
|
38704
|
+
var isTouch = inputData.pointerType == INPUT_TYPE_TOUCH, isMouse = inputData.pointerType == INPUT_TYPE_MOUSE;
|
|
38705
|
+
if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) {
|
|
38706
|
+
return;
|
|
38707
|
+
}
|
|
38708
|
+
if (isTouch) {
|
|
38709
|
+
recordTouches.call(this, inputEvent, inputData);
|
|
38710
|
+
} else if (isMouse && isSyntheticEvent.call(this, inputData)) {
|
|
38711
|
+
return;
|
|
38712
|
+
}
|
|
38713
|
+
this.callback(manager, inputEvent, inputData);
|
|
38714
|
+
},
|
|
38715
|
+
destroy: function destroy() {
|
|
38716
|
+
this.touch.destroy();
|
|
38717
|
+
this.mouse.destroy();
|
|
38718
|
+
}
|
|
38719
|
+
});
|
|
38720
|
+
function recordTouches(eventType, eventData) {
|
|
38721
|
+
if (eventType & INPUT_START) {
|
|
38722
|
+
this.primaryTouch = eventData.changedPointers[0].identifier;
|
|
38723
|
+
setLastTouch.call(this, eventData);
|
|
38724
|
+
} else if (eventType & (INPUT_END | INPUT_CANCEL)) {
|
|
38725
|
+
setLastTouch.call(this, eventData);
|
|
38726
|
+
}
|
|
38727
|
+
}
|
|
38728
|
+
function setLastTouch(eventData) {
|
|
38729
|
+
var touch = eventData.changedPointers[0];
|
|
38730
|
+
if (touch.identifier === this.primaryTouch) {
|
|
38731
|
+
var lastTouch = { x: touch.clientX, y: touch.clientY };
|
|
38732
|
+
this.lastTouches.push(lastTouch);
|
|
38733
|
+
var lts = this.lastTouches;
|
|
38734
|
+
var removeLastTouch = function() {
|
|
38735
|
+
var i = lts.indexOf(lastTouch);
|
|
38736
|
+
if (i > -1) {
|
|
38737
|
+
lts.splice(i, 1);
|
|
38738
|
+
}
|
|
38739
|
+
};
|
|
38740
|
+
setTimeout(removeLastTouch, DEDUP_TIMEOUT);
|
|
38741
|
+
}
|
|
38742
|
+
}
|
|
38743
|
+
function isSyntheticEvent(eventData) {
|
|
38744
|
+
var x = eventData.srcEvent.clientX, y2 = eventData.srcEvent.clientY;
|
|
38745
|
+
for (var i = 0; i < this.lastTouches.length; i++) {
|
|
38746
|
+
var t2 = this.lastTouches[i];
|
|
38747
|
+
var dx = Math.abs(x - t2.x), dy = Math.abs(y2 - t2.y);
|
|
38748
|
+
if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {
|
|
38749
|
+
return true;
|
|
38750
|
+
}
|
|
38751
|
+
}
|
|
38752
|
+
return false;
|
|
38753
|
+
}
|
|
38754
|
+
var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, "touchAction");
|
|
38755
|
+
var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined$1;
|
|
38756
|
+
var TOUCH_ACTION_COMPUTE = "compute";
|
|
38757
|
+
var TOUCH_ACTION_AUTO = "auto";
|
|
38758
|
+
var TOUCH_ACTION_MANIPULATION = "manipulation";
|
|
38759
|
+
var TOUCH_ACTION_NONE = "none";
|
|
38760
|
+
var TOUCH_ACTION_PAN_X = "pan-x";
|
|
38761
|
+
var TOUCH_ACTION_PAN_Y = "pan-y";
|
|
38762
|
+
var TOUCH_ACTION_MAP = getTouchActionProps();
|
|
38763
|
+
function TouchAction(manager, value) {
|
|
38764
|
+
this.manager = manager;
|
|
38765
|
+
this.set(value);
|
|
38766
|
+
}
|
|
38767
|
+
TouchAction.prototype = {
|
|
38768
|
+
set: function(value) {
|
|
38769
|
+
if (value == TOUCH_ACTION_COMPUTE) {
|
|
38770
|
+
value = this.compute();
|
|
38771
|
+
}
|
|
38772
|
+
if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) {
|
|
38773
|
+
this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;
|
|
38774
|
+
}
|
|
38775
|
+
this.actions = value.toLowerCase().trim();
|
|
38776
|
+
},
|
|
38777
|
+
update: function() {
|
|
38778
|
+
this.set(this.manager.options.touchAction);
|
|
38779
|
+
},
|
|
38780
|
+
compute: function() {
|
|
38781
|
+
var actions = [];
|
|
38782
|
+
each(this.manager.recognizers, function(recognizer) {
|
|
38783
|
+
if (boolOrFn(recognizer.options.enable, [recognizer])) {
|
|
38784
|
+
actions = actions.concat(recognizer.getTouchAction());
|
|
38785
|
+
}
|
|
38786
|
+
});
|
|
38787
|
+
return cleanTouchActions(actions.join(" "));
|
|
38788
|
+
},
|
|
38789
|
+
preventDefaults: function(input) {
|
|
38790
|
+
var srcEvent = input.srcEvent;
|
|
38791
|
+
var direction = input.offsetDirection;
|
|
38792
|
+
if (this.manager.session.prevented) {
|
|
38793
|
+
srcEvent.preventDefault();
|
|
38794
|
+
return;
|
|
38795
|
+
}
|
|
38796
|
+
var actions = this.actions;
|
|
38797
|
+
var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];
|
|
38798
|
+
var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];
|
|
38799
|
+
var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];
|
|
38800
|
+
if (hasNone) {
|
|
38801
|
+
var isTapPointer = input.pointers.length === 1;
|
|
38802
|
+
var isTapMovement = input.distance < 2;
|
|
38803
|
+
var isTapTouchTime = input.deltaTime < 250;
|
|
38804
|
+
if (isTapPointer && isTapMovement && isTapTouchTime) {
|
|
38805
|
+
return;
|
|
38806
|
+
}
|
|
38807
|
+
}
|
|
38808
|
+
if (hasPanX && hasPanY) {
|
|
38809
|
+
return;
|
|
38810
|
+
}
|
|
38811
|
+
if (hasNone || hasPanY && direction & DIRECTION_HORIZONTAL || hasPanX && direction & DIRECTION_VERTICAL) {
|
|
38812
|
+
return this.preventSrc(srcEvent);
|
|
38813
|
+
}
|
|
38814
|
+
},
|
|
38815
|
+
preventSrc: function(srcEvent) {
|
|
38816
|
+
this.manager.session.prevented = true;
|
|
38817
|
+
srcEvent.preventDefault();
|
|
38818
|
+
}
|
|
38819
|
+
};
|
|
38820
|
+
function cleanTouchActions(actions) {
|
|
38821
|
+
if (inStr(actions, TOUCH_ACTION_NONE)) {
|
|
38822
|
+
return TOUCH_ACTION_NONE;
|
|
38823
|
+
}
|
|
38824
|
+
var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
|
|
38825
|
+
var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
|
|
38826
|
+
if (hasPanX && hasPanY) {
|
|
38827
|
+
return TOUCH_ACTION_NONE;
|
|
38828
|
+
}
|
|
38829
|
+
if (hasPanX || hasPanY) {
|
|
38830
|
+
return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;
|
|
38831
|
+
}
|
|
38832
|
+
if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {
|
|
38833
|
+
return TOUCH_ACTION_MANIPULATION;
|
|
38834
|
+
}
|
|
38835
|
+
return TOUCH_ACTION_AUTO;
|
|
38836
|
+
}
|
|
38837
|
+
function getTouchActionProps() {
|
|
38838
|
+
if (!NATIVE_TOUCH_ACTION) {
|
|
38839
|
+
return false;
|
|
38840
|
+
}
|
|
38841
|
+
var touchMap = {};
|
|
38842
|
+
var cssSupports = window2.CSS && window2.CSS.supports;
|
|
38843
|
+
["auto", "manipulation", "pan-y", "pan-x", "pan-x pan-y", "none"].forEach(function(val) {
|
|
38844
|
+
touchMap[val] = cssSupports ? window2.CSS.supports("touch-action", val) : true;
|
|
38845
|
+
});
|
|
38846
|
+
return touchMap;
|
|
38847
|
+
}
|
|
38848
|
+
var STATE_POSSIBLE = 1;
|
|
38849
|
+
var STATE_BEGAN = 2;
|
|
38850
|
+
var STATE_CHANGED = 4;
|
|
38851
|
+
var STATE_ENDED = 8;
|
|
38852
|
+
var STATE_RECOGNIZED = STATE_ENDED;
|
|
38853
|
+
var STATE_CANCELLED = 16;
|
|
38854
|
+
var STATE_FAILED = 32;
|
|
38855
|
+
function Recognizer(options) {
|
|
38856
|
+
this.options = assign2({}, this.defaults, options || {});
|
|
38857
|
+
this.id = uniqueId();
|
|
38858
|
+
this.manager = null;
|
|
38859
|
+
this.options.enable = ifUndefined(this.options.enable, true);
|
|
38860
|
+
this.state = STATE_POSSIBLE;
|
|
38861
|
+
this.simultaneous = {};
|
|
38862
|
+
this.requireFail = [];
|
|
38863
|
+
}
|
|
38864
|
+
Recognizer.prototype = {
|
|
38865
|
+
defaults: {},
|
|
38866
|
+
set: function(options) {
|
|
38867
|
+
assign2(this.options, options);
|
|
38868
|
+
this.manager && this.manager.touchAction.update();
|
|
38869
|
+
return this;
|
|
38870
|
+
},
|
|
38871
|
+
recognizeWith: function(otherRecognizer) {
|
|
38872
|
+
if (invokeArrayArg(otherRecognizer, "recognizeWith", this)) {
|
|
38873
|
+
return this;
|
|
38874
|
+
}
|
|
38875
|
+
var simultaneous = this.simultaneous;
|
|
38876
|
+
otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
|
|
38877
|
+
if (!simultaneous[otherRecognizer.id]) {
|
|
38878
|
+
simultaneous[otherRecognizer.id] = otherRecognizer;
|
|
38879
|
+
otherRecognizer.recognizeWith(this);
|
|
38880
|
+
}
|
|
38881
|
+
return this;
|
|
38882
|
+
},
|
|
38883
|
+
dropRecognizeWith: function(otherRecognizer) {
|
|
38884
|
+
if (invokeArrayArg(otherRecognizer, "dropRecognizeWith", this)) {
|
|
38885
|
+
return this;
|
|
38886
|
+
}
|
|
38887
|
+
otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
|
|
38888
|
+
delete this.simultaneous[otherRecognizer.id];
|
|
38889
|
+
return this;
|
|
38890
|
+
},
|
|
38891
|
+
requireFailure: function(otherRecognizer) {
|
|
38892
|
+
if (invokeArrayArg(otherRecognizer, "requireFailure", this)) {
|
|
38893
|
+
return this;
|
|
38894
|
+
}
|
|
38895
|
+
var requireFail = this.requireFail;
|
|
38896
|
+
otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
|
|
38897
|
+
if (inArray(requireFail, otherRecognizer) === -1) {
|
|
38898
|
+
requireFail.push(otherRecognizer);
|
|
38899
|
+
otherRecognizer.requireFailure(this);
|
|
38900
|
+
}
|
|
38901
|
+
return this;
|
|
38902
|
+
},
|
|
38903
|
+
dropRequireFailure: function(otherRecognizer) {
|
|
38904
|
+
if (invokeArrayArg(otherRecognizer, "dropRequireFailure", this)) {
|
|
38905
|
+
return this;
|
|
38906
|
+
}
|
|
38907
|
+
otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
|
|
38908
|
+
var index = inArray(this.requireFail, otherRecognizer);
|
|
38909
|
+
if (index > -1) {
|
|
38910
|
+
this.requireFail.splice(index, 1);
|
|
38911
|
+
}
|
|
38912
|
+
return this;
|
|
38913
|
+
},
|
|
38914
|
+
hasRequireFailures: function() {
|
|
38915
|
+
return this.requireFail.length > 0;
|
|
38916
|
+
},
|
|
38917
|
+
canRecognizeWith: function(otherRecognizer) {
|
|
38918
|
+
return !!this.simultaneous[otherRecognizer.id];
|
|
38919
|
+
},
|
|
38920
|
+
emit: function(input) {
|
|
38921
|
+
var self2 = this;
|
|
38922
|
+
var state = this.state;
|
|
38923
|
+
function emit(event) {
|
|
38924
|
+
self2.manager.emit(event, input);
|
|
38925
|
+
}
|
|
38926
|
+
if (state < STATE_ENDED) {
|
|
38927
|
+
emit(self2.options.event + stateStr(state));
|
|
38928
|
+
}
|
|
38929
|
+
emit(self2.options.event);
|
|
38930
|
+
if (input.additionalEvent) {
|
|
38931
|
+
emit(input.additionalEvent);
|
|
38932
|
+
}
|
|
38933
|
+
if (state >= STATE_ENDED) {
|
|
38934
|
+
emit(self2.options.event + stateStr(state));
|
|
38935
|
+
}
|
|
38936
|
+
},
|
|
38937
|
+
tryEmit: function(input) {
|
|
38938
|
+
if (this.canEmit()) {
|
|
38939
|
+
return this.emit(input);
|
|
38940
|
+
}
|
|
38941
|
+
this.state = STATE_FAILED;
|
|
38942
|
+
},
|
|
38943
|
+
canEmit: function() {
|
|
38944
|
+
var i = 0;
|
|
38945
|
+
while (i < this.requireFail.length) {
|
|
38946
|
+
if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {
|
|
38947
|
+
return false;
|
|
38948
|
+
}
|
|
38949
|
+
i++;
|
|
38950
|
+
}
|
|
38951
|
+
return true;
|
|
38952
|
+
},
|
|
38953
|
+
recognize: function(inputData) {
|
|
38954
|
+
var inputDataClone = assign2({}, inputData);
|
|
38955
|
+
if (!boolOrFn(this.options.enable, [this, inputDataClone])) {
|
|
38956
|
+
this.reset();
|
|
38957
|
+
this.state = STATE_FAILED;
|
|
38958
|
+
return;
|
|
38959
|
+
}
|
|
38960
|
+
if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {
|
|
38961
|
+
this.state = STATE_POSSIBLE;
|
|
38962
|
+
}
|
|
38963
|
+
this.state = this.process(inputDataClone);
|
|
38964
|
+
if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {
|
|
38965
|
+
this.tryEmit(inputDataClone);
|
|
38966
|
+
}
|
|
38967
|
+
},
|
|
38968
|
+
process: function(inputData) {
|
|
38969
|
+
},
|
|
38970
|
+
getTouchAction: function() {
|
|
38971
|
+
},
|
|
38972
|
+
reset: function() {
|
|
38973
|
+
}
|
|
38974
|
+
};
|
|
38975
|
+
function stateStr(state) {
|
|
38976
|
+
if (state & STATE_CANCELLED) {
|
|
38977
|
+
return "cancel";
|
|
38978
|
+
} else if (state & STATE_ENDED) {
|
|
38979
|
+
return "end";
|
|
38980
|
+
} else if (state & STATE_CHANGED) {
|
|
38981
|
+
return "move";
|
|
38982
|
+
} else if (state & STATE_BEGAN) {
|
|
38983
|
+
return "start";
|
|
38984
|
+
}
|
|
38985
|
+
return "";
|
|
38986
|
+
}
|
|
38987
|
+
function directionStr(direction) {
|
|
38988
|
+
if (direction == DIRECTION_DOWN) {
|
|
38989
|
+
return "down";
|
|
38990
|
+
} else if (direction == DIRECTION_UP) {
|
|
38991
|
+
return "up";
|
|
38992
|
+
} else if (direction == DIRECTION_LEFT) {
|
|
38993
|
+
return "left";
|
|
38994
|
+
} else if (direction == DIRECTION_RIGHT) {
|
|
38995
|
+
return "right";
|
|
38996
|
+
}
|
|
38997
|
+
return "";
|
|
38998
|
+
}
|
|
38999
|
+
function getRecognizerByNameIfManager(otherRecognizer, recognizer) {
|
|
39000
|
+
var manager = recognizer.manager;
|
|
39001
|
+
if (manager) {
|
|
39002
|
+
return manager.get(otherRecognizer);
|
|
39003
|
+
}
|
|
39004
|
+
return otherRecognizer;
|
|
39005
|
+
}
|
|
39006
|
+
function AttrRecognizer() {
|
|
39007
|
+
Recognizer.apply(this, arguments);
|
|
39008
|
+
}
|
|
39009
|
+
inherit(AttrRecognizer, Recognizer, {
|
|
39010
|
+
defaults: {
|
|
39011
|
+
pointers: 1
|
|
39012
|
+
},
|
|
39013
|
+
attrTest: function(input) {
|
|
39014
|
+
var optionPointers = this.options.pointers;
|
|
39015
|
+
return optionPointers === 0 || input.pointers.length === optionPointers;
|
|
39016
|
+
},
|
|
39017
|
+
process: function(input) {
|
|
39018
|
+
var state = this.state;
|
|
39019
|
+
var eventType = input.eventType;
|
|
39020
|
+
var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);
|
|
39021
|
+
var isValid = this.attrTest(input);
|
|
39022
|
+
if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {
|
|
39023
|
+
return state | STATE_CANCELLED;
|
|
39024
|
+
} else if (isRecognized || isValid) {
|
|
39025
|
+
if (eventType & INPUT_END) {
|
|
39026
|
+
return state | STATE_ENDED;
|
|
39027
|
+
} else if (!(state & STATE_BEGAN)) {
|
|
39028
|
+
return STATE_BEGAN;
|
|
39029
|
+
}
|
|
39030
|
+
return state | STATE_CHANGED;
|
|
39031
|
+
}
|
|
39032
|
+
return STATE_FAILED;
|
|
39033
|
+
}
|
|
39034
|
+
});
|
|
39035
|
+
function PanRecognizer() {
|
|
39036
|
+
AttrRecognizer.apply(this, arguments);
|
|
39037
|
+
this.pX = null;
|
|
39038
|
+
this.pY = null;
|
|
39039
|
+
}
|
|
39040
|
+
inherit(PanRecognizer, AttrRecognizer, {
|
|
39041
|
+
defaults: {
|
|
39042
|
+
event: "pan",
|
|
39043
|
+
threshold: 10,
|
|
39044
|
+
pointers: 1,
|
|
39045
|
+
direction: DIRECTION_ALL
|
|
39046
|
+
},
|
|
39047
|
+
getTouchAction: function() {
|
|
39048
|
+
var direction = this.options.direction;
|
|
39049
|
+
var actions = [];
|
|
39050
|
+
if (direction & DIRECTION_HORIZONTAL) {
|
|
39051
|
+
actions.push(TOUCH_ACTION_PAN_Y);
|
|
39052
|
+
}
|
|
39053
|
+
if (direction & DIRECTION_VERTICAL) {
|
|
39054
|
+
actions.push(TOUCH_ACTION_PAN_X);
|
|
39055
|
+
}
|
|
39056
|
+
return actions;
|
|
39057
|
+
},
|
|
39058
|
+
directionTest: function(input) {
|
|
39059
|
+
var options = this.options;
|
|
39060
|
+
var hasMoved = true;
|
|
39061
|
+
var distance = input.distance;
|
|
39062
|
+
var direction = input.direction;
|
|
39063
|
+
var x = input.deltaX;
|
|
39064
|
+
var y2 = input.deltaY;
|
|
39065
|
+
if (!(direction & options.direction)) {
|
|
39066
|
+
if (options.direction & DIRECTION_HORIZONTAL) {
|
|
39067
|
+
direction = x === 0 ? DIRECTION_NONE : x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
|
|
39068
|
+
hasMoved = x != this.pX;
|
|
39069
|
+
distance = Math.abs(input.deltaX);
|
|
39070
|
+
} else {
|
|
39071
|
+
direction = y2 === 0 ? DIRECTION_NONE : y2 < 0 ? DIRECTION_UP : DIRECTION_DOWN;
|
|
39072
|
+
hasMoved = y2 != this.pY;
|
|
39073
|
+
distance = Math.abs(input.deltaY);
|
|
39074
|
+
}
|
|
39075
|
+
}
|
|
39076
|
+
input.direction = direction;
|
|
39077
|
+
return hasMoved && distance > options.threshold && direction & options.direction;
|
|
39078
|
+
},
|
|
39079
|
+
attrTest: function(input) {
|
|
39080
|
+
return AttrRecognizer.prototype.attrTest.call(this, input) && (this.state & STATE_BEGAN || !(this.state & STATE_BEGAN) && this.directionTest(input));
|
|
39081
|
+
},
|
|
39082
|
+
emit: function(input) {
|
|
39083
|
+
this.pX = input.deltaX;
|
|
39084
|
+
this.pY = input.deltaY;
|
|
39085
|
+
var direction = directionStr(input.direction);
|
|
39086
|
+
if (direction) {
|
|
39087
|
+
input.additionalEvent = this.options.event + direction;
|
|
39088
|
+
}
|
|
39089
|
+
this._super.emit.call(this, input);
|
|
39090
|
+
}
|
|
39091
|
+
});
|
|
39092
|
+
function PinchRecognizer() {
|
|
39093
|
+
AttrRecognizer.apply(this, arguments);
|
|
39094
|
+
}
|
|
39095
|
+
inherit(PinchRecognizer, AttrRecognizer, {
|
|
39096
|
+
defaults: {
|
|
39097
|
+
event: "pinch",
|
|
39098
|
+
threshold: 0,
|
|
39099
|
+
pointers: 2
|
|
39100
|
+
},
|
|
39101
|
+
getTouchAction: function() {
|
|
39102
|
+
return [TOUCH_ACTION_NONE];
|
|
39103
|
+
},
|
|
39104
|
+
attrTest: function(input) {
|
|
39105
|
+
return this._super.attrTest.call(this, input) && (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);
|
|
39106
|
+
},
|
|
39107
|
+
emit: function(input) {
|
|
39108
|
+
if (input.scale !== 1) {
|
|
39109
|
+
var inOut = input.scale < 1 ? "in" : "out";
|
|
39110
|
+
input.additionalEvent = this.options.event + inOut;
|
|
39111
|
+
}
|
|
39112
|
+
this._super.emit.call(this, input);
|
|
39113
|
+
}
|
|
39114
|
+
});
|
|
39115
|
+
function PressRecognizer() {
|
|
39116
|
+
Recognizer.apply(this, arguments);
|
|
39117
|
+
this._timer = null;
|
|
39118
|
+
this._input = null;
|
|
39119
|
+
}
|
|
39120
|
+
inherit(PressRecognizer, Recognizer, {
|
|
39121
|
+
defaults: {
|
|
39122
|
+
event: "press",
|
|
39123
|
+
pointers: 1,
|
|
39124
|
+
time: 251,
|
|
39125
|
+
threshold: 9
|
|
39126
|
+
},
|
|
39127
|
+
getTouchAction: function() {
|
|
39128
|
+
return [TOUCH_ACTION_AUTO];
|
|
39129
|
+
},
|
|
39130
|
+
process: function(input) {
|
|
39131
|
+
var options = this.options;
|
|
39132
|
+
var validPointers = input.pointers.length === options.pointers;
|
|
39133
|
+
var validMovement = input.distance < options.threshold;
|
|
39134
|
+
var validTime = input.deltaTime > options.time;
|
|
39135
|
+
this._input = input;
|
|
39136
|
+
if (!validMovement || !validPointers || input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime) {
|
|
39137
|
+
this.reset();
|
|
39138
|
+
} else if (input.eventType & INPUT_START) {
|
|
39139
|
+
this.reset();
|
|
39140
|
+
this._timer = setTimeoutContext(function() {
|
|
39141
|
+
this.state = STATE_RECOGNIZED;
|
|
39142
|
+
this.tryEmit();
|
|
39143
|
+
}, options.time, this);
|
|
39144
|
+
} else if (input.eventType & INPUT_END) {
|
|
39145
|
+
return STATE_RECOGNIZED;
|
|
39146
|
+
}
|
|
39147
|
+
return STATE_FAILED;
|
|
39148
|
+
},
|
|
39149
|
+
reset: function() {
|
|
39150
|
+
clearTimeout(this._timer);
|
|
39151
|
+
},
|
|
39152
|
+
emit: function(input) {
|
|
39153
|
+
if (this.state !== STATE_RECOGNIZED) {
|
|
39154
|
+
return;
|
|
39155
|
+
}
|
|
39156
|
+
if (input && input.eventType & INPUT_END) {
|
|
39157
|
+
this.manager.emit(this.options.event + "up", input);
|
|
39158
|
+
} else {
|
|
39159
|
+
this._input.timeStamp = now2();
|
|
39160
|
+
this.manager.emit(this.options.event, this._input);
|
|
39161
|
+
}
|
|
39162
|
+
}
|
|
39163
|
+
});
|
|
39164
|
+
function RotateRecognizer() {
|
|
39165
|
+
AttrRecognizer.apply(this, arguments);
|
|
39166
|
+
}
|
|
39167
|
+
inherit(RotateRecognizer, AttrRecognizer, {
|
|
39168
|
+
defaults: {
|
|
39169
|
+
event: "rotate",
|
|
39170
|
+
threshold: 0,
|
|
39171
|
+
pointers: 2
|
|
39172
|
+
},
|
|
39173
|
+
getTouchAction: function() {
|
|
39174
|
+
return [TOUCH_ACTION_NONE];
|
|
39175
|
+
},
|
|
39176
|
+
attrTest: function(input) {
|
|
39177
|
+
return this._super.attrTest.call(this, input) && (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);
|
|
39178
|
+
}
|
|
39179
|
+
});
|
|
39180
|
+
function SwipeRecognizer() {
|
|
39181
|
+
AttrRecognizer.apply(this, arguments);
|
|
39182
|
+
}
|
|
39183
|
+
inherit(SwipeRecognizer, AttrRecognizer, {
|
|
39184
|
+
defaults: {
|
|
39185
|
+
event: "swipe",
|
|
39186
|
+
threshold: 10,
|
|
39187
|
+
velocity: 0.3,
|
|
39188
|
+
direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
|
|
39189
|
+
pointers: 1
|
|
39190
|
+
},
|
|
39191
|
+
getTouchAction: function() {
|
|
39192
|
+
return PanRecognizer.prototype.getTouchAction.call(this);
|
|
39193
|
+
},
|
|
39194
|
+
attrTest: function(input) {
|
|
39195
|
+
var direction = this.options.direction;
|
|
39196
|
+
var velocity;
|
|
39197
|
+
if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {
|
|
39198
|
+
velocity = input.overallVelocity;
|
|
39199
|
+
} else if (direction & DIRECTION_HORIZONTAL) {
|
|
39200
|
+
velocity = input.overallVelocityX;
|
|
39201
|
+
} else if (direction & DIRECTION_VERTICAL) {
|
|
39202
|
+
velocity = input.overallVelocityY;
|
|
39203
|
+
}
|
|
39204
|
+
return this._super.attrTest.call(this, input) && direction & input.offsetDirection && input.distance > this.options.threshold && input.maxPointers == this.options.pointers && abs(velocity) > this.options.velocity && input.eventType & INPUT_END;
|
|
39205
|
+
},
|
|
39206
|
+
emit: function(input) {
|
|
39207
|
+
var direction = directionStr(input.offsetDirection);
|
|
39208
|
+
if (direction) {
|
|
39209
|
+
this.manager.emit(this.options.event + direction, input);
|
|
39210
|
+
}
|
|
39211
|
+
this.manager.emit(this.options.event, input);
|
|
39212
|
+
}
|
|
39213
|
+
});
|
|
39214
|
+
function TapRecognizer() {
|
|
39215
|
+
Recognizer.apply(this, arguments);
|
|
39216
|
+
this.pTime = false;
|
|
39217
|
+
this.pCenter = false;
|
|
39218
|
+
this._timer = null;
|
|
39219
|
+
this._input = null;
|
|
39220
|
+
this.count = 0;
|
|
39221
|
+
}
|
|
39222
|
+
inherit(TapRecognizer, Recognizer, {
|
|
39223
|
+
defaults: {
|
|
39224
|
+
event: "tap",
|
|
39225
|
+
pointers: 1,
|
|
39226
|
+
taps: 1,
|
|
39227
|
+
interval: 300,
|
|
39228
|
+
time: 250,
|
|
39229
|
+
threshold: 9,
|
|
39230
|
+
posThreshold: 10
|
|
39231
|
+
},
|
|
39232
|
+
getTouchAction: function() {
|
|
39233
|
+
return [TOUCH_ACTION_MANIPULATION];
|
|
39234
|
+
},
|
|
39235
|
+
process: function(input) {
|
|
39236
|
+
var options = this.options;
|
|
39237
|
+
var validPointers = input.pointers.length === options.pointers;
|
|
39238
|
+
var validMovement = input.distance < options.threshold;
|
|
39239
|
+
var validTouchTime = input.deltaTime < options.time;
|
|
39240
|
+
this.reset();
|
|
39241
|
+
if (input.eventType & INPUT_START && this.count === 0) {
|
|
39242
|
+
return this.failTimeout();
|
|
39243
|
+
}
|
|
39244
|
+
if (validMovement && validTouchTime && validPointers) {
|
|
39245
|
+
if (input.eventType != INPUT_END) {
|
|
39246
|
+
return this.failTimeout();
|
|
39247
|
+
}
|
|
39248
|
+
var validInterval = this.pTime ? input.timeStamp - this.pTime < options.interval : true;
|
|
39249
|
+
var validMultiTap = !this.pCenter || getDistance2(this.pCenter, input.center) < options.posThreshold;
|
|
39250
|
+
this.pTime = input.timeStamp;
|
|
39251
|
+
this.pCenter = input.center;
|
|
39252
|
+
if (!validMultiTap || !validInterval) {
|
|
39253
|
+
this.count = 1;
|
|
39254
|
+
} else {
|
|
39255
|
+
this.count += 1;
|
|
39256
|
+
}
|
|
39257
|
+
this._input = input;
|
|
39258
|
+
var tapCount = this.count % options.taps;
|
|
39259
|
+
if (tapCount === 0) {
|
|
39260
|
+
if (!this.hasRequireFailures()) {
|
|
39261
|
+
return STATE_RECOGNIZED;
|
|
39262
|
+
} else {
|
|
39263
|
+
this._timer = setTimeoutContext(function() {
|
|
39264
|
+
this.state = STATE_RECOGNIZED;
|
|
39265
|
+
this.tryEmit();
|
|
39266
|
+
}, options.interval, this);
|
|
39267
|
+
return STATE_BEGAN;
|
|
39268
|
+
}
|
|
39269
|
+
}
|
|
39270
|
+
}
|
|
39271
|
+
return STATE_FAILED;
|
|
39272
|
+
},
|
|
39273
|
+
failTimeout: function() {
|
|
39274
|
+
this._timer = setTimeoutContext(function() {
|
|
39275
|
+
this.state = STATE_FAILED;
|
|
39276
|
+
}, this.options.interval, this);
|
|
39277
|
+
return STATE_FAILED;
|
|
39278
|
+
},
|
|
39279
|
+
reset: function() {
|
|
39280
|
+
clearTimeout(this._timer);
|
|
39281
|
+
},
|
|
39282
|
+
emit: function() {
|
|
39283
|
+
if (this.state == STATE_RECOGNIZED) {
|
|
39284
|
+
this._input.tapCount = this.count;
|
|
39285
|
+
this.manager.emit(this.options.event, this._input);
|
|
39286
|
+
}
|
|
39287
|
+
}
|
|
39288
|
+
});
|
|
39289
|
+
function Hammer2(element2, options) {
|
|
39290
|
+
options = options || {};
|
|
39291
|
+
options.recognizers = ifUndefined(options.recognizers, Hammer2.defaults.preset);
|
|
39292
|
+
return new Manager(element2, options);
|
|
39293
|
+
}
|
|
39294
|
+
Hammer2.VERSION = "2.0.7";
|
|
39295
|
+
Hammer2.defaults = {
|
|
39296
|
+
domEvents: false,
|
|
39297
|
+
touchAction: TOUCH_ACTION_COMPUTE,
|
|
39298
|
+
enable: true,
|
|
39299
|
+
inputTarget: null,
|
|
39300
|
+
inputClass: null,
|
|
39301
|
+
preset: [
|
|
39302
|
+
[RotateRecognizer, { enable: false }],
|
|
39303
|
+
[PinchRecognizer, { enable: false }, ["rotate"]],
|
|
39304
|
+
[SwipeRecognizer, { direction: DIRECTION_HORIZONTAL }],
|
|
39305
|
+
[PanRecognizer, { direction: DIRECTION_HORIZONTAL }, ["swipe"]],
|
|
39306
|
+
[TapRecognizer],
|
|
39307
|
+
[TapRecognizer, { event: "doubletap", taps: 2 }, ["tap"]],
|
|
39308
|
+
[PressRecognizer]
|
|
39309
|
+
],
|
|
39310
|
+
cssProps: {
|
|
39311
|
+
userSelect: "none",
|
|
39312
|
+
touchSelect: "none",
|
|
39313
|
+
touchCallout: "none",
|
|
39314
|
+
contentZooming: "none",
|
|
39315
|
+
userDrag: "none",
|
|
39316
|
+
tapHighlightColor: "rgba(0,0,0,0)"
|
|
39317
|
+
}
|
|
39318
|
+
};
|
|
39319
|
+
var STOP = 1;
|
|
39320
|
+
var FORCED_STOP = 2;
|
|
39321
|
+
function Manager(element2, options) {
|
|
39322
|
+
this.options = assign2({}, Hammer2.defaults, options || {});
|
|
39323
|
+
this.options.inputTarget = this.options.inputTarget || element2;
|
|
39324
|
+
this.handlers = {};
|
|
39325
|
+
this.session = {};
|
|
39326
|
+
this.recognizers = [];
|
|
39327
|
+
this.oldCssProps = {};
|
|
39328
|
+
this.element = element2;
|
|
39329
|
+
this.input = createInputInstance(this);
|
|
39330
|
+
this.touchAction = new TouchAction(this, this.options.touchAction);
|
|
39331
|
+
toggleCssProps(this, true);
|
|
39332
|
+
each(this.options.recognizers, function(item) {
|
|
39333
|
+
var recognizer = this.add(new item[0](item[1]));
|
|
39334
|
+
item[2] && recognizer.recognizeWith(item[2]);
|
|
39335
|
+
item[3] && recognizer.requireFailure(item[3]);
|
|
39336
|
+
}, this);
|
|
39337
|
+
}
|
|
39338
|
+
Manager.prototype = {
|
|
39339
|
+
set: function(options) {
|
|
39340
|
+
assign2(this.options, options);
|
|
39341
|
+
if (options.touchAction) {
|
|
39342
|
+
this.touchAction.update();
|
|
39343
|
+
}
|
|
39344
|
+
if (options.inputTarget) {
|
|
39345
|
+
this.input.destroy();
|
|
39346
|
+
this.input.target = options.inputTarget;
|
|
39347
|
+
this.input.init();
|
|
39348
|
+
}
|
|
39349
|
+
return this;
|
|
39350
|
+
},
|
|
39351
|
+
stop: function(force) {
|
|
39352
|
+
this.session.stopped = force ? FORCED_STOP : STOP;
|
|
39353
|
+
},
|
|
39354
|
+
recognize: function(inputData) {
|
|
39355
|
+
var session = this.session;
|
|
39356
|
+
if (session.stopped) {
|
|
39357
|
+
return;
|
|
39358
|
+
}
|
|
39359
|
+
this.touchAction.preventDefaults(inputData);
|
|
39360
|
+
var recognizer;
|
|
39361
|
+
var recognizers = this.recognizers;
|
|
39362
|
+
var curRecognizer = session.curRecognizer;
|
|
39363
|
+
if (!curRecognizer || curRecognizer && curRecognizer.state & STATE_RECOGNIZED) {
|
|
39364
|
+
curRecognizer = session.curRecognizer = null;
|
|
39365
|
+
}
|
|
39366
|
+
var i = 0;
|
|
39367
|
+
while (i < recognizers.length) {
|
|
39368
|
+
recognizer = recognizers[i];
|
|
39369
|
+
if (session.stopped !== FORCED_STOP && (!curRecognizer || recognizer == curRecognizer || recognizer.canRecognizeWith(curRecognizer))) {
|
|
39370
|
+
recognizer.recognize(inputData);
|
|
39371
|
+
} else {
|
|
39372
|
+
recognizer.reset();
|
|
39373
|
+
}
|
|
39374
|
+
if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {
|
|
39375
|
+
curRecognizer = session.curRecognizer = recognizer;
|
|
39376
|
+
}
|
|
39377
|
+
i++;
|
|
39378
|
+
}
|
|
39379
|
+
},
|
|
39380
|
+
get: function(recognizer) {
|
|
39381
|
+
if (recognizer instanceof Recognizer) {
|
|
39382
|
+
return recognizer;
|
|
39383
|
+
}
|
|
39384
|
+
var recognizers = this.recognizers;
|
|
39385
|
+
for (var i = 0; i < recognizers.length; i++) {
|
|
39386
|
+
if (recognizers[i].options.event == recognizer) {
|
|
39387
|
+
return recognizers[i];
|
|
39388
|
+
}
|
|
39389
|
+
}
|
|
39390
|
+
return null;
|
|
39391
|
+
},
|
|
39392
|
+
add: function(recognizer) {
|
|
39393
|
+
if (invokeArrayArg(recognizer, "add", this)) {
|
|
39394
|
+
return this;
|
|
39395
|
+
}
|
|
39396
|
+
var existing = this.get(recognizer.options.event);
|
|
39397
|
+
if (existing) {
|
|
39398
|
+
this.remove(existing);
|
|
39399
|
+
}
|
|
39400
|
+
this.recognizers.push(recognizer);
|
|
39401
|
+
recognizer.manager = this;
|
|
39402
|
+
this.touchAction.update();
|
|
39403
|
+
return recognizer;
|
|
39404
|
+
},
|
|
39405
|
+
remove: function(recognizer) {
|
|
39406
|
+
if (invokeArrayArg(recognizer, "remove", this)) {
|
|
39407
|
+
return this;
|
|
39408
|
+
}
|
|
39409
|
+
recognizer = this.get(recognizer);
|
|
39410
|
+
if (recognizer) {
|
|
39411
|
+
var recognizers = this.recognizers;
|
|
39412
|
+
var index = inArray(recognizers, recognizer);
|
|
39413
|
+
if (index !== -1) {
|
|
39414
|
+
recognizers.splice(index, 1);
|
|
39415
|
+
this.touchAction.update();
|
|
39416
|
+
}
|
|
39417
|
+
}
|
|
39418
|
+
return this;
|
|
39419
|
+
},
|
|
39420
|
+
on: function(events, handler) {
|
|
39421
|
+
if (events === undefined$1) {
|
|
39422
|
+
return;
|
|
39423
|
+
}
|
|
39424
|
+
if (handler === undefined$1) {
|
|
39425
|
+
return;
|
|
39426
|
+
}
|
|
39427
|
+
var handlers = this.handlers;
|
|
39428
|
+
each(splitStr(events), function(event) {
|
|
39429
|
+
handlers[event] = handlers[event] || [];
|
|
39430
|
+
handlers[event].push(handler);
|
|
39431
|
+
});
|
|
39432
|
+
return this;
|
|
39433
|
+
},
|
|
39434
|
+
off: function(events, handler) {
|
|
39435
|
+
if (events === undefined$1) {
|
|
39436
|
+
return;
|
|
39437
|
+
}
|
|
39438
|
+
var handlers = this.handlers;
|
|
39439
|
+
each(splitStr(events), function(event) {
|
|
39440
|
+
if (!handler) {
|
|
39441
|
+
delete handlers[event];
|
|
39442
|
+
} else {
|
|
39443
|
+
handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);
|
|
39444
|
+
}
|
|
39445
|
+
});
|
|
39446
|
+
return this;
|
|
39447
|
+
},
|
|
39448
|
+
emit: function(event, data) {
|
|
39449
|
+
if (this.options.domEvents) {
|
|
39450
|
+
triggerDomEvent(event, data);
|
|
39451
|
+
}
|
|
39452
|
+
var handlers = this.handlers[event] && this.handlers[event].slice();
|
|
39453
|
+
if (!handlers || !handlers.length) {
|
|
39454
|
+
return;
|
|
39455
|
+
}
|
|
39456
|
+
data.type = event;
|
|
39457
|
+
data.preventDefault = function() {
|
|
39458
|
+
data.srcEvent.preventDefault();
|
|
39459
|
+
};
|
|
39460
|
+
var i = 0;
|
|
39461
|
+
while (i < handlers.length) {
|
|
39462
|
+
handlers[i](data);
|
|
39463
|
+
i++;
|
|
39464
|
+
}
|
|
39465
|
+
},
|
|
39466
|
+
destroy: function() {
|
|
39467
|
+
this.element && toggleCssProps(this, false);
|
|
39468
|
+
this.handlers = {};
|
|
39469
|
+
this.session = {};
|
|
39470
|
+
this.input.destroy();
|
|
39471
|
+
this.element = null;
|
|
39472
|
+
}
|
|
39473
|
+
};
|
|
39474
|
+
function toggleCssProps(manager, add2) {
|
|
39475
|
+
var element2 = manager.element;
|
|
39476
|
+
if (!element2.style) {
|
|
39477
|
+
return;
|
|
39478
|
+
}
|
|
39479
|
+
var prop;
|
|
39480
|
+
each(manager.options.cssProps, function(value, name) {
|
|
39481
|
+
prop = prefixed(element2.style, name);
|
|
39482
|
+
if (add2) {
|
|
39483
|
+
manager.oldCssProps[prop] = element2.style[prop];
|
|
39484
|
+
element2.style[prop] = value;
|
|
39485
|
+
} else {
|
|
39486
|
+
element2.style[prop] = manager.oldCssProps[prop] || "";
|
|
39487
|
+
}
|
|
39488
|
+
});
|
|
39489
|
+
if (!add2) {
|
|
39490
|
+
manager.oldCssProps = {};
|
|
39491
|
+
}
|
|
39492
|
+
}
|
|
39493
|
+
function triggerDomEvent(event, data) {
|
|
39494
|
+
var gestureEvent = document2.createEvent("Event");
|
|
39495
|
+
gestureEvent.initEvent(event, true, true);
|
|
39496
|
+
gestureEvent.gesture = data;
|
|
39497
|
+
data.target.dispatchEvent(gestureEvent);
|
|
39498
|
+
}
|
|
39499
|
+
assign2(Hammer2, {
|
|
39500
|
+
INPUT_START,
|
|
39501
|
+
INPUT_MOVE,
|
|
39502
|
+
INPUT_END,
|
|
39503
|
+
INPUT_CANCEL,
|
|
39504
|
+
STATE_POSSIBLE,
|
|
39505
|
+
STATE_BEGAN,
|
|
39506
|
+
STATE_CHANGED,
|
|
39507
|
+
STATE_ENDED,
|
|
39508
|
+
STATE_RECOGNIZED,
|
|
39509
|
+
STATE_CANCELLED,
|
|
39510
|
+
STATE_FAILED,
|
|
39511
|
+
DIRECTION_NONE,
|
|
39512
|
+
DIRECTION_LEFT,
|
|
39513
|
+
DIRECTION_RIGHT,
|
|
39514
|
+
DIRECTION_UP,
|
|
39515
|
+
DIRECTION_DOWN,
|
|
39516
|
+
DIRECTION_HORIZONTAL,
|
|
39517
|
+
DIRECTION_VERTICAL,
|
|
39518
|
+
DIRECTION_ALL,
|
|
39519
|
+
Manager,
|
|
39520
|
+
Input,
|
|
39521
|
+
TouchAction,
|
|
39522
|
+
TouchInput,
|
|
39523
|
+
MouseInput,
|
|
39524
|
+
PointerEventInput,
|
|
39525
|
+
TouchMouseInput,
|
|
39526
|
+
SingleTouchInput,
|
|
39527
|
+
Recognizer,
|
|
39528
|
+
AttrRecognizer,
|
|
39529
|
+
Tap: TapRecognizer,
|
|
39530
|
+
Pan: PanRecognizer,
|
|
39531
|
+
Swipe: SwipeRecognizer,
|
|
39532
|
+
Pinch: PinchRecognizer,
|
|
39533
|
+
Rotate: RotateRecognizer,
|
|
39534
|
+
Press: PressRecognizer,
|
|
39535
|
+
on: addEventListeners,
|
|
39536
|
+
off: removeEventListeners,
|
|
39537
|
+
each,
|
|
39538
|
+
merge,
|
|
39539
|
+
extend,
|
|
39540
|
+
assign: assign2,
|
|
39541
|
+
inherit,
|
|
39542
|
+
bindFn,
|
|
39543
|
+
prefixed
|
|
39544
|
+
});
|
|
39545
|
+
var freeGlobal = typeof window2 !== "undefined" ? window2 : typeof self !== "undefined" ? self : {};
|
|
39546
|
+
freeGlobal.Hammer = Hammer2;
|
|
39547
|
+
if (typeof undefined$1 === "function" && undefined$1.amd) {
|
|
39548
|
+
undefined$1(function() {
|
|
39549
|
+
return Hammer2;
|
|
39550
|
+
});
|
|
39551
|
+
} else if (module.exports) {
|
|
39552
|
+
module.exports = Hammer2;
|
|
39553
|
+
} else {
|
|
39554
|
+
window2[exportName] = Hammer2;
|
|
39555
|
+
}
|
|
39556
|
+
})(window, document, "Hammer");
|
|
39557
|
+
})(hammer);
|
|
39558
|
+
var Hammer = hammer.exports;
|
|
39559
|
+
function S4() {
|
|
39560
|
+
return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
|
|
39561
|
+
}
|
|
39562
|
+
function uuid() {
|
|
39563
|
+
return (S4() + S4() + "-" + S4() + "-4" + S4().substr(0, 3) + "-" + S4() + "-" + S4() + S4() + S4()).toLowerCase();
|
|
39564
|
+
}
|
|
39565
|
+
class Polyline {
|
|
39566
|
+
constructor() {
|
|
39567
|
+
__publicField(this, "id", uuid());
|
|
39568
|
+
__publicField(this, "points", []);
|
|
39569
|
+
__publicField(this, "lines", []);
|
|
39570
|
+
}
|
|
39571
|
+
push(line) {
|
|
39572
|
+
const next = this.getNext(line);
|
|
39573
|
+
if (!next)
|
|
39574
|
+
throw new Error("\u5F53\u524D\u7EBF\u6BB5\u4E8E\u4E0A\u4E00\u6761\u7EBF\u6BB5\u65E0\u6CD5\u6784\u6210\u6298\u7EBF");
|
|
39575
|
+
this.lines.push(next.line);
|
|
39576
|
+
this.points.push(...next.points);
|
|
39577
|
+
return this.lines.length;
|
|
39578
|
+
}
|
|
39579
|
+
pop() {
|
|
39580
|
+
const lastPoint = this.lines.pop();
|
|
39581
|
+
const polylineLength = this.lines.length;
|
|
39582
|
+
if (polylineLength === 0)
|
|
39583
|
+
this.points.slice(0, this.points.length);
|
|
39584
|
+
else
|
|
39585
|
+
this.points.pop();
|
|
39586
|
+
return lastPoint;
|
|
39587
|
+
}
|
|
39588
|
+
getNext(line) {
|
|
39589
|
+
const lastPoint = this.points.slice(-1)[0];
|
|
39590
|
+
if (!lastPoint)
|
|
39591
|
+
return { line, points: line.points };
|
|
39592
|
+
if (!line.points.includes(lastPoint))
|
|
39593
|
+
return null;
|
|
39594
|
+
const nextPoint = line.points.find((point) => point !== lastPoint);
|
|
39595
|
+
if (!nextPoint)
|
|
39596
|
+
return null;
|
|
39597
|
+
return { line, points: [nextPoint] };
|
|
39598
|
+
}
|
|
39599
|
+
toJson() {
|
|
39600
|
+
return {
|
|
39601
|
+
id: this.id,
|
|
39602
|
+
lines: this.lines.map((line) => line.id),
|
|
39603
|
+
points: this.points.map((point) => point.id)
|
|
39604
|
+
};
|
|
39605
|
+
}
|
|
39606
|
+
toCompletelyJson() {
|
|
39607
|
+
return {
|
|
39608
|
+
id: this.id,
|
|
39609
|
+
points: this.points.map((point) => point.toJson()),
|
|
39610
|
+
lines: this.lines.map((line) => line.toCompletelyJson())
|
|
39611
|
+
};
|
|
39612
|
+
}
|
|
39613
|
+
}
|
|
39614
|
+
const lineWidth = 2;
|
|
39615
|
+
const lightLineWidth = 4;
|
|
39616
|
+
const lineColor = new Color$1(16777215);
|
|
39617
|
+
const lightLineColor = new Color$1(2981119);
|
|
39618
|
+
const pointColor = new Color$1(16777215);
|
|
39619
|
+
const lightPointColor = new Color$1(2981119);
|
|
39620
|
+
const pointSize = 8;
|
|
39621
|
+
const lightPointSize = 16;
|
|
39622
|
+
const pointImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAIVBMVEUAAAD////////////////////////////////////////PIev5AAAACnRSTlMAG/Py2baba05un7UgfgAAAHJJREFUKM9joBpgLHVSCRdA4metAoJlCJHmVWBgAeNzroKCCVCBLpjACqgJVjCBxRBT2FbBQQJYQAohsBAsUIUQWA4WiEIILAULeCEEloAFtBACizAEMLRgGIphLabDMJ2O6TlM72MGECIIMQIZIxqoBQCPvpJ/e9FaAAAAAABJRU5ErkJggg==";
|
|
39623
|
+
const pointTexture = new TextureLoader$1().load(pointImage);
|
|
39624
|
+
const normalLineOpts = {
|
|
39625
|
+
pointTexture,
|
|
39626
|
+
pointSize,
|
|
39627
|
+
lineWidth,
|
|
39628
|
+
lineColor,
|
|
39629
|
+
pointColor,
|
|
39630
|
+
lineRenderOrder: 20,
|
|
39631
|
+
pointsRenderOrder: 20
|
|
39632
|
+
};
|
|
39633
|
+
Object.assign({}, normalLineOpts, { dashed: true });
|
|
39634
|
+
const lightLineOpts = {
|
|
39635
|
+
pointTexture,
|
|
39636
|
+
pointSize: lightPointSize,
|
|
39637
|
+
lineWidth: lightLineWidth,
|
|
39638
|
+
lineColor: lightLineColor,
|
|
39639
|
+
pointColor: lightPointColor,
|
|
39640
|
+
lineRenderOrder: 10,
|
|
39641
|
+
pointsRenderOrder: 10
|
|
39642
|
+
};
|
|
39643
|
+
function creatLine(start, end, opts) {
|
|
39644
|
+
var _a, _b, _c, _d, _e;
|
|
39645
|
+
const lineWidth2 = (_a = opts == null ? void 0 : opts.lineWidth) != null ? _a : 2;
|
|
39646
|
+
const lineColor2 = (_b = opts == null ? void 0 : opts.lineColor) != null ? _b : new Color$1(16777215);
|
|
39647
|
+
const pointSize2 = (_c = opts == null ? void 0 : opts.pointSize) != null ? _c : 5;
|
|
39648
|
+
const lineRenderOrder = (_d = opts == null ? void 0 : opts.lineRenderOrder) != null ? _d : 10;
|
|
39649
|
+
const pointsRenderOrder = (_e = opts == null ? void 0 : opts.lineRenderOrder) != null ? _e : 20;
|
|
39650
|
+
const line = new Line$2(start, end);
|
|
39651
|
+
line.setMaterial({ linewidth: lineWidth2, color: lineColor2 });
|
|
39652
|
+
line.line.material.depthTest = false;
|
|
39653
|
+
line.line.material.transparent = true;
|
|
39654
|
+
line.line.renderOrder = lineRenderOrder;
|
|
39655
|
+
line.points.renderOrder = pointsRenderOrder;
|
|
39656
|
+
const pointMaterial = line.points.material;
|
|
39657
|
+
pointMaterial.depthTest = false;
|
|
39658
|
+
pointMaterial.size = pointSize2;
|
|
39659
|
+
(opts == null ? void 0 : opts.pointColor) && pointMaterial.color.set(opts.pointColor).convertSRGBToLinear();
|
|
39660
|
+
if (opts == null ? void 0 : opts.pointTexture)
|
|
39661
|
+
pointMaterial.map = opts.pointTexture;
|
|
39662
|
+
return line;
|
|
39663
|
+
}
|
|
39664
|
+
function creatLineMesh(line, type) {
|
|
39665
|
+
const [point, anotherPoint] = line.points;
|
|
39666
|
+
const opts = type === "light" ? lightLineOpts : normalLineOpts;
|
|
39667
|
+
const fiveLine = creatLine(point.position, anotherPoint.position, opts);
|
|
39668
|
+
fiveLine.name = "normalLine_" + line.id;
|
|
39669
|
+
return fiveLine;
|
|
39670
|
+
}
|
|
39671
|
+
function isNDCPointInScreen(ndcPoint) {
|
|
39672
|
+
const { x, y: y2, z } = ndcPoint;
|
|
39673
|
+
if (Math.abs(x) > 1 || Math.abs(y2) > 1 || Math.abs(z) > 1)
|
|
39674
|
+
return false;
|
|
39675
|
+
return true;
|
|
39676
|
+
}
|
|
39677
|
+
function creatContentDom() {
|
|
39678
|
+
const contentDom = document.createElement("div");
|
|
39679
|
+
contentDom.style.height = "24px";
|
|
39680
|
+
contentDom.style.width = "62px";
|
|
39681
|
+
contentDom.style.lineHeight = "24px";
|
|
39682
|
+
contentDom.style.textAlign = "center";
|
|
39683
|
+
contentDom.style.transform = "translate(-50%, -50%)";
|
|
39684
|
+
contentDom.style.borderRadius = "12px";
|
|
39685
|
+
contentDom.style.fontSize = "14px";
|
|
39686
|
+
contentDom.style.color = "#000000";
|
|
39687
|
+
contentDom.style.background = "#fff";
|
|
39688
|
+
contentDom.style.pointerEvents = "all";
|
|
39689
|
+
contentDom.style.cursor = "pointer";
|
|
39690
|
+
return contentDom;
|
|
39691
|
+
}
|
|
39692
|
+
function createContainerDom(line) {
|
|
39693
|
+
const containerDom = document.createElement("div");
|
|
39694
|
+
containerDom.id = "distance_" + line.id;
|
|
39695
|
+
containerDom.classList.add("five-plugin-measure__distance");
|
|
39696
|
+
containerDom.style.opacity = "0";
|
|
39697
|
+
containerDom.style.position = "absolute";
|
|
39698
|
+
containerDom.style.left = "0";
|
|
39699
|
+
containerDom.style.top = "0";
|
|
39700
|
+
containerDom.style.transform = "translate3d(0, 0, 0)";
|
|
39701
|
+
return containerDom;
|
|
39702
|
+
}
|
|
39703
|
+
function creatDistanceItem(props) {
|
|
39704
|
+
function handleClick() {
|
|
39705
|
+
var _a;
|
|
39706
|
+
highlight();
|
|
39707
|
+
(_a = props.clickCallback) == null ? void 0 : _a.call(props, distanceItem);
|
|
39708
|
+
}
|
|
39709
|
+
function highlight() {
|
|
39710
|
+
if (userDistanceItem)
|
|
39711
|
+
return userDistanceItem.highlight();
|
|
39712
|
+
contentDom.style.border = "1px solid #538FFF";
|
|
39713
|
+
contentDom.style.color = "#538FFF";
|
|
39714
|
+
}
|
|
39715
|
+
function unHighlight() {
|
|
39716
|
+
if (userDistanceItem)
|
|
39717
|
+
return userDistanceItem.unHighlight();
|
|
39718
|
+
contentDom.style.border = "none";
|
|
39719
|
+
contentDom.style.color = "#000";
|
|
39720
|
+
}
|
|
39721
|
+
function update2(five) {
|
|
39722
|
+
const fiveElement = five.getElement();
|
|
39723
|
+
if (!fiveElement)
|
|
39724
|
+
return;
|
|
39725
|
+
const screenWidth = fiveElement.clientWidth;
|
|
39726
|
+
const screenHeight = fiveElement.clientHeight;
|
|
39727
|
+
if (line.points.length < 2)
|
|
39728
|
+
return;
|
|
39729
|
+
const [startPoint, endPoint] = line.points;
|
|
39730
|
+
const ndcStartPosition = startPoint.position.clone().project(five.camera);
|
|
39731
|
+
const ndcEndPosition = endPoint.position.clone().project(five.camera);
|
|
39732
|
+
const ndcDomPosition = ndcStartPosition.clone().lerp(ndcEndPosition, 0.5);
|
|
39733
|
+
const visible = (() => {
|
|
39734
|
+
if (Math.abs(ndcStartPosition.z) > 1 || Math.abs(ndcEndPosition.z) > 1)
|
|
39735
|
+
return false;
|
|
39736
|
+
if (!isNDCPointInScreen(ndcStartPosition) && !isNDCPointInScreen(ndcEndPosition))
|
|
39737
|
+
return false;
|
|
39738
|
+
if (!isNDCPointInScreen(ndcDomPosition))
|
|
39739
|
+
return false;
|
|
39740
|
+
const screenStartPosition = new Vector2$1(ndcStartPosition.x * screenWidth, ndcStartPosition.y * screenHeight);
|
|
39741
|
+
const screenEndPosition = new Vector2$1(ndcEndPosition.x * screenWidth, ndcEndPosition.y * screenHeight);
|
|
39742
|
+
if (screenStartPosition.distanceTo(screenEndPosition) < 20)
|
|
39743
|
+
return false;
|
|
39744
|
+
return true;
|
|
39745
|
+
})();
|
|
39746
|
+
if (visible === false) {
|
|
39747
|
+
containerDom.style.opacity = "0";
|
|
39748
|
+
containerDom.style.pointerEvents = "none";
|
|
39749
|
+
return;
|
|
39750
|
+
}
|
|
39751
|
+
const left = (ndcDomPosition.x + 1) / 2 * screenWidth;
|
|
39752
|
+
const top = -(ndcDomPosition.y - 1) / 2 * screenHeight;
|
|
39753
|
+
containerDom.style.transform = `translate3d(${left}px, ${top}px, 10px)`;
|
|
39754
|
+
containerDom.style.opacity = "1";
|
|
39755
|
+
containerDom.style.pointerEvents = "all";
|
|
39756
|
+
if (userDistanceItem) {
|
|
39757
|
+
userDistanceItem.update({ line: line.toCompletelyJson(), polyline: line.getPolyline().toCompletelyJson() });
|
|
39758
|
+
}
|
|
39759
|
+
const distanceString = startPoint.position.clone().distanceTo(endPoint.position).toFixed(2) + "m";
|
|
39760
|
+
contentDom.innerText !== distanceString && (contentDom.innerText = distanceString);
|
|
39761
|
+
}
|
|
39762
|
+
function appendTo(container) {
|
|
39763
|
+
container.appendChild(containerDom);
|
|
39764
|
+
containerDom.addEventListener("click", handleClick);
|
|
39765
|
+
}
|
|
39766
|
+
function remove2() {
|
|
39767
|
+
contentDom.removeEventListener("click", handleClick);
|
|
39768
|
+
containerDom.remove();
|
|
39769
|
+
}
|
|
39770
|
+
const { line } = props;
|
|
39771
|
+
const lineID = line.id;
|
|
39772
|
+
const contentDom = creatContentDom();
|
|
39773
|
+
const containerDom = createContainerDom(line);
|
|
39774
|
+
const userDistanceItem = props.userDistanceItem;
|
|
39775
|
+
const ndcPosition = new Vector3$1(0, 0, 0);
|
|
39776
|
+
const distanceItem = {
|
|
39777
|
+
lineID,
|
|
39778
|
+
ndcPosition,
|
|
39779
|
+
update: update2,
|
|
39780
|
+
appendTo,
|
|
39781
|
+
remove: remove2,
|
|
39782
|
+
highlight,
|
|
39783
|
+
unHighlight
|
|
39784
|
+
};
|
|
39785
|
+
(userDistanceItem == null ? void 0 : userDistanceItem.element) ? containerDom.appendChild(userDistanceItem.element) : containerDom.appendChild(contentDom);
|
|
39786
|
+
return distanceItem;
|
|
39787
|
+
}
|
|
39788
|
+
class Line {
|
|
39789
|
+
constructor(point, anotherPoint, model) {
|
|
39790
|
+
__publicField(this, "id");
|
|
39791
|
+
__publicField(this, "selected", false);
|
|
39792
|
+
__publicField(this, "type", "line");
|
|
39793
|
+
__publicField(this, "model");
|
|
39794
|
+
__publicField(this, "mesh");
|
|
39795
|
+
__publicField(this, "points");
|
|
39796
|
+
__publicField(this, "lightMesh");
|
|
39797
|
+
__publicField(this, "hook");
|
|
39798
|
+
__publicField(this, "distanceItem");
|
|
39799
|
+
__publicField(this, "polyline");
|
|
39800
|
+
this.id = uuid();
|
|
39801
|
+
this.model = model;
|
|
39802
|
+
if (point.id === anotherPoint.id)
|
|
39803
|
+
throw new Error("\u65E0\u6548\u7684\u7EBF\u6BB5, \u4E00\u4E2A\u70B9\u65E0\u6CD5\u6784\u6210\u7EBF\u6BB5");
|
|
39804
|
+
this.hook = new Subscribe();
|
|
39805
|
+
this.points = [point, anotherPoint];
|
|
39806
|
+
this.mesh = creatLineMesh(this, "normal");
|
|
39807
|
+
this.lightMesh = creatLineMesh(this, "light");
|
|
39808
|
+
this.distanceItem = creatDistanceItem({
|
|
39809
|
+
line: this,
|
|
39810
|
+
clickCallback: () => this.hook.emit("selected", this),
|
|
39811
|
+
userDistanceItem: this.model.params.userDistanceItemCreator ? this.model.params.userDistanceItemCreator() : void 0
|
|
39812
|
+
});
|
|
39813
|
+
point.lines.push(this);
|
|
39814
|
+
anotherPoint.lines.push(this);
|
|
39815
|
+
}
|
|
39816
|
+
clear() {
|
|
39817
|
+
this.selected = false;
|
|
39818
|
+
this.polyline = void 0;
|
|
39819
|
+
}
|
|
39820
|
+
getPolyline() {
|
|
39821
|
+
if (this.polyline)
|
|
39822
|
+
return this.polyline;
|
|
39823
|
+
const modelPolyline = this.model.polylines.find((polyline2) => polyline2.lines.includes(this));
|
|
39824
|
+
this.polyline = modelPolyline;
|
|
39825
|
+
if (modelPolyline)
|
|
39826
|
+
return modelPolyline;
|
|
39827
|
+
const polyline = new Polyline();
|
|
39828
|
+
polyline.push(this);
|
|
39829
|
+
return polyline;
|
|
39830
|
+
}
|
|
39831
|
+
findAnotherPoint(point) {
|
|
39832
|
+
return this.points.find(({ id }) => id !== point.id);
|
|
39833
|
+
}
|
|
39834
|
+
toJson() {
|
|
39835
|
+
return { id: this.id, points: this.points.map(({ id }) => id) };
|
|
39836
|
+
}
|
|
39837
|
+
toCompletelyJson() {
|
|
39838
|
+
return { id: this.id, points: this.points.map((point) => point.toJson()) };
|
|
39839
|
+
}
|
|
39840
|
+
clone() {
|
|
39841
|
+
const line = new Line(this.points[0].clone(), this.points[1].clone(), this.model);
|
|
39842
|
+
return line;
|
|
39843
|
+
}
|
|
39844
|
+
}
|
|
39845
|
+
function removeArrayItem(item, array) {
|
|
39846
|
+
for (let index = 0, len = array.length; index < len; index++) {
|
|
39847
|
+
if (item === array[index])
|
|
39848
|
+
return array.splice(index, 1)[0];
|
|
39849
|
+
}
|
|
39850
|
+
}
|
|
39851
|
+
class Point {
|
|
39852
|
+
constructor(position) {
|
|
39853
|
+
__publicField(this, "id");
|
|
39854
|
+
__publicField(this, "lines");
|
|
39855
|
+
__publicField(this, "position");
|
|
39856
|
+
__publicField(this, "type", "point");
|
|
39857
|
+
this.id = uuid();
|
|
39858
|
+
this.lines = [];
|
|
39859
|
+
this.position = new Vector3$1();
|
|
39860
|
+
position instanceof Vector3$1 ? this.position.copy(position) : this.position.fromArray(position);
|
|
39861
|
+
}
|
|
39862
|
+
toJson() {
|
|
39863
|
+
return { id: this.id, lines: this.lines.map(({ id }) => id), position: this.position.toArray() };
|
|
39864
|
+
}
|
|
39865
|
+
addLine(line) {
|
|
39866
|
+
this.lines.push(line);
|
|
39867
|
+
}
|
|
39868
|
+
removeLine(line) {
|
|
39869
|
+
removeArrayItem(line, this.lines);
|
|
39870
|
+
}
|
|
39871
|
+
clone() {
|
|
39872
|
+
const point = new Point(this.position);
|
|
39873
|
+
return point;
|
|
39874
|
+
}
|
|
39875
|
+
}
|
|
39876
|
+
class Model {
|
|
39877
|
+
constructor(params) {
|
|
39878
|
+
__publicField(this, "lines", []);
|
|
39879
|
+
__publicField(this, "points", []);
|
|
39880
|
+
__publicField(this, "params");
|
|
39881
|
+
__publicField(this, "polylines", []);
|
|
39882
|
+
__publicField(this, "hook", new Subscribe());
|
|
39883
|
+
this.params = params;
|
|
39884
|
+
}
|
|
39885
|
+
addLine(line) {
|
|
39886
|
+
const [startPoint, endPoint] = line.points;
|
|
39887
|
+
if (!startPoint || !endPoint)
|
|
39888
|
+
return this;
|
|
39889
|
+
if (!this.includes(startPoint))
|
|
39890
|
+
this.points.push(startPoint);
|
|
39891
|
+
if (!this.includes(endPoint))
|
|
39892
|
+
this.points.push(endPoint);
|
|
39893
|
+
this.lines.push(line);
|
|
39894
|
+
const lastPolyline = this.polylines.find((polyline) => !!polyline.getNext(line));
|
|
39895
|
+
if (lastPolyline) {
|
|
39896
|
+
lastPolyline.push(line);
|
|
39897
|
+
} else {
|
|
39898
|
+
const polyline = new Polyline();
|
|
39899
|
+
polyline.push(line);
|
|
39900
|
+
this.polylines.push(polyline);
|
|
39901
|
+
}
|
|
39902
|
+
this.hook.emit("lineAdded", line);
|
|
39903
|
+
}
|
|
39904
|
+
removeLineByID(lineID) {
|
|
39905
|
+
const line = this.getLineByID(lineID);
|
|
39906
|
+
if (line)
|
|
39907
|
+
this.removeLine(line);
|
|
39908
|
+
}
|
|
39909
|
+
removeLine(line) {
|
|
39910
|
+
const polyline = this.polylines.find((polyline2) => polyline2.lines.includes(line));
|
|
39911
|
+
if (polyline) {
|
|
39912
|
+
if (polyline.lines.slice(-1)[0] !== line)
|
|
39913
|
+
throw new Error("\u4E0D\u80FD\u4ECE\u4E2D\u95F4\u5220\u9664\u7EBF\u6BB5");
|
|
39914
|
+
polyline.pop();
|
|
39915
|
+
if (polyline.lines.length === 0)
|
|
39916
|
+
removeArrayItem(polyline, this.polylines);
|
|
39917
|
+
}
|
|
39918
|
+
const [point, anotherPoint] = line.points;
|
|
39919
|
+
if (point.lines.length === 0)
|
|
39920
|
+
removeArrayItem(point, this.points);
|
|
39921
|
+
if (anotherPoint.lines.length === 0)
|
|
39922
|
+
removeArrayItem(anotherPoint, this.points);
|
|
39923
|
+
removeArrayItem(line, this.lines);
|
|
39924
|
+
line.clear();
|
|
39925
|
+
this.hook.emit("lineRemoved", line);
|
|
39926
|
+
return this;
|
|
39927
|
+
}
|
|
39928
|
+
mergeModel(model) {
|
|
39929
|
+
model.lines.forEach((line) => this.addLine(line));
|
|
39930
|
+
}
|
|
39931
|
+
includes(item) {
|
|
39932
|
+
if (item.type === "point") {
|
|
39933
|
+
return this.points.find(({ id }) => id === item.id) !== void 0;
|
|
39934
|
+
} else if (item.type === "line") {
|
|
39935
|
+
return this.lines.find(({ id }) => id === item.id) !== void 0;
|
|
39936
|
+
}
|
|
39937
|
+
}
|
|
39938
|
+
getPointByID(id) {
|
|
39939
|
+
return this.points.find(({ id: _id }) => _id === id);
|
|
39940
|
+
}
|
|
39941
|
+
getLineByID(id) {
|
|
39942
|
+
return this.lines.find(({ id: _id }) => _id === id);
|
|
39943
|
+
}
|
|
39944
|
+
getClosestPoint() {
|
|
39945
|
+
}
|
|
39946
|
+
parse(data) {
|
|
39947
|
+
const points = data.points.map(({ id, position }) => {
|
|
39948
|
+
const point = new Point(position);
|
|
39949
|
+
point.id = id;
|
|
39950
|
+
return point;
|
|
39951
|
+
});
|
|
39952
|
+
const lines = data.lines.map((data2) => {
|
|
39953
|
+
const [pointID, anotherPointID] = data2.points;
|
|
39954
|
+
const point = this.getPointByID.call({ points }, pointID);
|
|
39955
|
+
const anotherPoint = this.getPointByID.call({ points }, anotherPointID);
|
|
39956
|
+
if (!point || !anotherPoint)
|
|
39957
|
+
throw new Error("\u7EBF\u4E0A\u7684\u70B9\u4E0D\u5B58\u5728");
|
|
39958
|
+
const line = new Line(point, anotherPoint, this);
|
|
39959
|
+
line.id = data2.id;
|
|
39960
|
+
return line;
|
|
39961
|
+
});
|
|
39962
|
+
const polylines = data.polylines.map((polylineJson) => {
|
|
39963
|
+
const polyline = new Polyline();
|
|
39964
|
+
polylineJson.lines.forEach((lineID) => {
|
|
39965
|
+
const line = lines.find(({ id }) => id === lineID);
|
|
39966
|
+
line && polyline.push(line);
|
|
39967
|
+
});
|
|
39968
|
+
return polyline;
|
|
39969
|
+
});
|
|
39970
|
+
this.points.splice(0, this.points.length, ...points);
|
|
39971
|
+
this.lines.splice(0, this.lines.length, ...lines);
|
|
39972
|
+
this.polylines.splice(0, this.polylines.length, ...polylines);
|
|
39973
|
+
return this;
|
|
39974
|
+
}
|
|
39975
|
+
toJson() {
|
|
39976
|
+
return {
|
|
39977
|
+
points: this.points.map((point) => point.toJson()),
|
|
39978
|
+
lines: this.lines.map((line) => line.toJson()),
|
|
39979
|
+
polylines: this.polylines.map((polyline) => polyline.toJson()).filter((polylines) => polylines.lines.length > 0)
|
|
39980
|
+
};
|
|
39981
|
+
}
|
|
39982
|
+
}
|
|
39983
|
+
const preventDefault = (e) => e.preventDefault();
|
|
39984
|
+
class BaseController {
|
|
39985
|
+
constructor(params) {
|
|
39986
|
+
__publicField(this, "five");
|
|
39987
|
+
__publicField(this, "group");
|
|
39988
|
+
__publicField(this, "model");
|
|
39989
|
+
__publicField(this, "disposed", false);
|
|
39990
|
+
__publicField(this, "mouseGroup");
|
|
39991
|
+
__publicField(this, "container");
|
|
39992
|
+
__publicField(this, "fiveHelper");
|
|
39993
|
+
__publicField(this, "hook");
|
|
39994
|
+
__publicField(this, "magnifier");
|
|
39995
|
+
__publicField(this, "userDistanceItemCreator");
|
|
39996
|
+
__publicField(this, "updateDistanceUI", () => {
|
|
39997
|
+
this.model.lines.forEach((line) => line.distanceItem.update(this.five));
|
|
39998
|
+
});
|
|
39999
|
+
this.five = params.five;
|
|
40000
|
+
this.hook = params.hook;
|
|
40001
|
+
this.model = params.model;
|
|
40002
|
+
this.magnifier = params.magnifier;
|
|
40003
|
+
this.container = params.container;
|
|
40004
|
+
this.fiveHelper = params.fiveHelper;
|
|
40005
|
+
this.userDistanceItemCreator = params.userDistanceItemCreator;
|
|
40006
|
+
this.group = params.group;
|
|
40007
|
+
this.mouseGroup = params.mouseGroup;
|
|
40008
|
+
const fiveElement = this.five.getElement();
|
|
40009
|
+
if (fiveElement) {
|
|
40010
|
+
fiveElement.addEventListener("touchstart", preventDefault);
|
|
40011
|
+
fiveElement.addEventListener("contextmenu", preventDefault);
|
|
40012
|
+
}
|
|
40013
|
+
}
|
|
40014
|
+
removeLine(line) {
|
|
40015
|
+
this.group.remove(line.mesh, line.lightMesh);
|
|
40016
|
+
line.distanceItem.remove();
|
|
40017
|
+
this.five.needsRender = true;
|
|
40018
|
+
}
|
|
40019
|
+
updateMouseGroup(intersection, mesh) {
|
|
40020
|
+
if (!intersection)
|
|
40021
|
+
return this.mouseGroup;
|
|
40022
|
+
const adsorbentPoint = this.fiveHelper.getAdsorbentPoint(intersection);
|
|
40023
|
+
const viewPosition = adsorbentPoint ? adsorbentPoint : intersection.point;
|
|
40024
|
+
this.mouseGroup.position.copy(viewPosition);
|
|
40025
|
+
if (mesh) {
|
|
40026
|
+
this.mouseGroup.quaternion.copy(mesh.quaternion);
|
|
40027
|
+
} else if (intersection.face) {
|
|
40028
|
+
const normal = intersection.face.normal;
|
|
40029
|
+
const positionVector = normal.clone().multiplyScalar(0.05);
|
|
40030
|
+
const position = intersection.point.clone().add(positionVector);
|
|
40031
|
+
const lookAtVector = position.clone().add(positionVector);
|
|
40032
|
+
this.mouseGroup.lookAt(lookAtVector);
|
|
40033
|
+
}
|
|
40034
|
+
return this.mouseGroup;
|
|
40035
|
+
}
|
|
40036
|
+
dispose() {
|
|
40037
|
+
this.disposed = true;
|
|
40038
|
+
this.magnifier.dispose();
|
|
40039
|
+
this.model.lines.forEach((line) => this.removeLine(line));
|
|
40040
|
+
const fiveElement = this.five.getElement();
|
|
40041
|
+
if (fiveElement) {
|
|
40042
|
+
fiveElement.removeEventListener("touchstart", preventDefault);
|
|
40043
|
+
fiveElement.removeEventListener("contextmenu", preventDefault);
|
|
40044
|
+
}
|
|
40045
|
+
}
|
|
40046
|
+
}
|
|
40047
|
+
function getPointFromHammerEvent(event) {
|
|
40048
|
+
const { x: clientX, y: clientY } = event.center;
|
|
40049
|
+
const { clientWidth, clientHeight } = event.target;
|
|
40050
|
+
const clientRect = event.target.getBoundingClientRect();
|
|
40051
|
+
const position = new Vector2$1(clientX, clientY).sub(new Vector2$1(clientRect.left, clientRect.top));
|
|
40052
|
+
const mouse = new Vector2$1(position.x / clientWidth * 2 - 1, -(position.y / clientHeight) * 2 + 1);
|
|
40053
|
+
return { point: position, ndcPoint: mouse };
|
|
40054
|
+
}
|
|
40055
|
+
function getIntersectionFromEvent(five, event) {
|
|
40056
|
+
const mouse = getPointFromHammerEvent(event).ndcPoint;
|
|
40057
|
+
const raycaster = new Raycaster$1();
|
|
40058
|
+
raycaster.setFromCamera(mouse, five.camera);
|
|
40059
|
+
return five.model.intersectRaycaster(raycaster);
|
|
40060
|
+
}
|
|
40061
|
+
class EditController extends BaseController {
|
|
40062
|
+
constructor(params) {
|
|
40063
|
+
super(params);
|
|
40064
|
+
__publicField(this, "type", "edit");
|
|
40065
|
+
__publicField(this, "model", new Model({ userDistanceItemCreator: this.userDistanceItemCreator }));
|
|
40066
|
+
__publicField(this, "pressPoint");
|
|
40067
|
+
__publicField(this, "hasAppendDashed", false);
|
|
40068
|
+
__publicField(this, "hasAppendMouseGroup", false);
|
|
40069
|
+
__publicField(this, "fiveElement");
|
|
40070
|
+
__publicField(this, "lastPoint", null);
|
|
40071
|
+
__publicField(this, "dashed");
|
|
40072
|
+
__publicField(this, "hammer");
|
|
40073
|
+
__publicField(this, "onIntersectionUpdate", throttle((intersection, mesh) => {
|
|
40074
|
+
var _a;
|
|
40075
|
+
if (this.hasAppendMouseGroup === false) {
|
|
40076
|
+
this.group.add(this.mouseGroup);
|
|
40077
|
+
this.magnifier.appendTo(this.container);
|
|
40078
|
+
this.hasAppendMouseGroup = true;
|
|
40079
|
+
}
|
|
40080
|
+
const position = this.updateMouseGroup(intersection, mesh).position;
|
|
40081
|
+
(_a = this.pressPoint) == null ? void 0 : _a.position.copy(position);
|
|
40082
|
+
this.updateDashed();
|
|
40083
|
+
requestAnimationFrame(() => this.magnifier.updateWithPoint(this.mouseGroup.position));
|
|
40084
|
+
this.five.needsRender = true;
|
|
40085
|
+
}, 20));
|
|
40086
|
+
__publicField(this, "revoke", () => {
|
|
40087
|
+
if (this.model.lines.length === 0 && this.lastPoint) {
|
|
40088
|
+
this.lastPoint = null;
|
|
40089
|
+
this.hasAppendDashed = false;
|
|
40090
|
+
this.dashed.distanceItem.remove();
|
|
40091
|
+
this.group.remove(this.dashed.mesh);
|
|
40092
|
+
this.hook.emit("anchorChange", null);
|
|
40093
|
+
this.five.needsRender = true;
|
|
40094
|
+
return;
|
|
40095
|
+
}
|
|
40096
|
+
if (this.model.lines.length === 0 && !this.lastPoint)
|
|
40097
|
+
return;
|
|
40098
|
+
if (!this.lastPoint)
|
|
40099
|
+
return;
|
|
40100
|
+
const revokedLine = this.model.lines[this.model.lines.length - 1];
|
|
40101
|
+
const lastPoint = revokedLine.findAnotherPoint(this.lastPoint);
|
|
40102
|
+
if (!lastPoint)
|
|
40103
|
+
return;
|
|
40104
|
+
this.lastPoint = lastPoint;
|
|
40105
|
+
this.hook.emit("anchorChange", lastPoint.position);
|
|
40106
|
+
this.group.remove(revokedLine.mesh);
|
|
40107
|
+
this.model.removeLine(revokedLine);
|
|
40108
|
+
this.hasAppendMouseGroup = false;
|
|
40109
|
+
this.mouseGroup.position.copy(this.lastPoint.position);
|
|
40110
|
+
this.group.remove(this.mouseGroup);
|
|
40111
|
+
revokedLine.distanceItem.remove();
|
|
40112
|
+
this.updateDashed();
|
|
40113
|
+
this.magnifier.dispose();
|
|
40114
|
+
this.five.needsRender = true;
|
|
40115
|
+
});
|
|
40116
|
+
__publicField(this, "onMouseLeave", () => {
|
|
40117
|
+
this.magnifier.dispose();
|
|
40118
|
+
this.group.remove(this.mouseGroup);
|
|
40119
|
+
this.hasAppendMouseGroup = false;
|
|
40120
|
+
if (this.lastPoint) {
|
|
40121
|
+
this.mouseGroup.position.copy(this.lastPoint.position);
|
|
40122
|
+
this.updateDashed();
|
|
40123
|
+
}
|
|
40124
|
+
});
|
|
40125
|
+
__publicField(this, "onLineChanged", () => {
|
|
40126
|
+
this.hook.emit("editedLineChange", this.model.lines.map((line) => line.toCompletelyJson()));
|
|
40127
|
+
});
|
|
40128
|
+
__publicField(this, "onPress", (e) => {
|
|
40129
|
+
const [intersection] = getIntersectionFromEvent(this.five, e);
|
|
40130
|
+
if (!intersection || !intersection.face)
|
|
40131
|
+
return;
|
|
40132
|
+
const nowPoint = new Point(intersection.point);
|
|
40133
|
+
this.pressPoint = nowPoint;
|
|
40134
|
+
this.onIntersectionUpdate(intersection);
|
|
40135
|
+
});
|
|
40136
|
+
__publicField(this, "onPan", (e) => {
|
|
40137
|
+
if (!this.pressPoint)
|
|
40138
|
+
return;
|
|
40139
|
+
const [intersection] = getIntersectionFromEvent(this.five, e);
|
|
40140
|
+
if (!intersection || !intersection.face)
|
|
40141
|
+
return;
|
|
40142
|
+
this.onIntersectionUpdate(intersection);
|
|
40143
|
+
});
|
|
40144
|
+
__publicField(this, "onPanEnd", (e) => {
|
|
40145
|
+
if (!this.pressPoint)
|
|
40146
|
+
return;
|
|
40147
|
+
this.onTap(e);
|
|
40148
|
+
});
|
|
40149
|
+
__publicField(this, "onTap", (e) => {
|
|
40150
|
+
if (!this.hasAppendDashed) {
|
|
40151
|
+
this.dashed.distanceItem.appendTo(this.container);
|
|
40152
|
+
this.group.add(this.dashed.mesh);
|
|
40153
|
+
}
|
|
40154
|
+
this.hasAppendDashed = true;
|
|
40155
|
+
const [intersection] = getIntersectionFromEvent(this.five, e);
|
|
40156
|
+
this.updateMouseGroup(intersection);
|
|
40157
|
+
const nowPoint = new Point(this.mouseGroup.position);
|
|
40158
|
+
const lastPoint = this.lastPoint;
|
|
40159
|
+
if (nowPoint)
|
|
40160
|
+
this.lastPoint = nowPoint;
|
|
40161
|
+
if (nowPoint && lastPoint) {
|
|
40162
|
+
const line = new Line(lastPoint, nowPoint, this.model);
|
|
40163
|
+
line.distanceItem.appendTo(this.container);
|
|
40164
|
+
this.model.addLine(line);
|
|
40165
|
+
this.group.add(line.mesh);
|
|
40166
|
+
line.distanceItem.update(this.five);
|
|
40167
|
+
}
|
|
40168
|
+
this.pressPoint = void 0;
|
|
40169
|
+
this.hasAppendMouseGroup = false;
|
|
40170
|
+
this.magnifier.dispose();
|
|
40171
|
+
this.group.remove(this.mouseGroup);
|
|
40172
|
+
this.updateDashed();
|
|
40173
|
+
this.five.needsRender = true;
|
|
40174
|
+
this.hook.emit("anchorChange", nowPoint.position);
|
|
40175
|
+
});
|
|
40176
|
+
__publicField(this, "onWantsTapGesture", () => false);
|
|
40177
|
+
__publicField(this, "onWantsToMoveToPano", () => false);
|
|
40178
|
+
__publicField(this, "onWantsPanGesture", () => this.pressPoint ? false : void 0);
|
|
40179
|
+
__publicField(this, "onCameraUpdate", () => {
|
|
40180
|
+
this.updateDistanceUI();
|
|
40181
|
+
this.dashed.distanceItem.update(this.five);
|
|
40182
|
+
});
|
|
40183
|
+
__publicField(this, "updateDashed", () => {
|
|
40184
|
+
if (!this.lastPoint)
|
|
40185
|
+
return;
|
|
40186
|
+
this.dashed.points[0].position.copy(this.lastPoint.position);
|
|
40187
|
+
this.dashed.points[1].position.copy(this.mouseGroup.position);
|
|
40188
|
+
this.dashed.mesh.setPoints(this.lastPoint.position, this.mouseGroup.position);
|
|
40189
|
+
this.dashed.distanceItem.update(this.five);
|
|
40190
|
+
});
|
|
40191
|
+
var _a;
|
|
40192
|
+
this.dashed = new Line(new Point([0, 0, 0]), new Point([0, 0, 0]), this.model);
|
|
40193
|
+
this.dashed.mesh.setMaterial({ dashed: true, dashScale: 100 });
|
|
40194
|
+
this.five.on("cameraUpdate", this.onCameraUpdate);
|
|
40195
|
+
this.five.on("wantsPanGesture", this.onWantsPanGesture);
|
|
40196
|
+
this.five.on("wantsTapGesture", this.onWantsTapGesture);
|
|
40197
|
+
this.five.on("wantsToMoveToPano", this.onWantsToMoveToPano);
|
|
40198
|
+
this.five.on("intersectionOnModelUpdate", this.onIntersectionUpdate);
|
|
40199
|
+
this.model.hook.on("lineAdded", this.onLineChanged);
|
|
40200
|
+
this.model.hook.on("lineRemoved", this.onLineChanged);
|
|
40201
|
+
const fiveElement = this.five.getElement();
|
|
40202
|
+
if (fiveElement) {
|
|
40203
|
+
this.fiveElement = fiveElement;
|
|
40204
|
+
const hammer2 = new Hammer(fiveElement);
|
|
40205
|
+
this.hammer = hammer2;
|
|
40206
|
+
hammer2.on("tap", this.onTap);
|
|
40207
|
+
hammer2.on("pan", this.onPan);
|
|
40208
|
+
hammer2.on("press", this.onPress);
|
|
40209
|
+
hammer2.on("panend", this.onPanEnd);
|
|
40210
|
+
}
|
|
40211
|
+
(_a = this.fiveElement) == null ? void 0 : _a.addEventListener("mouseleave", this.onMouseLeave);
|
|
40212
|
+
this.hook.emit("anchorChange", null);
|
|
40213
|
+
this.five.refresh();
|
|
40214
|
+
}
|
|
40215
|
+
dispose() {
|
|
40216
|
+
var _a, _b;
|
|
40217
|
+
super.dispose();
|
|
40218
|
+
this.group.remove(this.mouseGroup, this.dashed.mesh);
|
|
40219
|
+
this.five.off("cameraUpdate", this.onCameraUpdate);
|
|
40220
|
+
this.five.off("wantsPanGesture", this.onWantsPanGesture);
|
|
40221
|
+
this.five.off("wantsTapGesture", this.onWantsTapGesture);
|
|
40222
|
+
this.five.off("wantsToMoveToPano", this.onWantsToMoveToPano);
|
|
40223
|
+
this.five.off("intersectionOnModelUpdate", this.onIntersectionUpdate);
|
|
40224
|
+
this.model.hook.off("lineAdded", this.onLineChanged);
|
|
40225
|
+
this.model.hook.off("lineRemoved", this.onLineChanged);
|
|
40226
|
+
(_a = this.hammer) == null ? void 0 : _a.destroy();
|
|
40227
|
+
(_b = this.fiveElement) == null ? void 0 : _b.removeEventListener("mouseleave", this.onMouseLeave);
|
|
40228
|
+
this.magnifier.dispose();
|
|
40229
|
+
this.dashed.distanceItem.remove();
|
|
40230
|
+
this.five.needsRender = true;
|
|
40231
|
+
}
|
|
40232
|
+
getEditingLines() {
|
|
40233
|
+
return this.model.lines;
|
|
40234
|
+
}
|
|
40235
|
+
}
|
|
40236
|
+
const svg = `<svg class="fpm__delete-icon" width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
|
40237
|
+
<defs>
|
|
40238
|
+
<linearGradient x1="21.443%" y1="100%" x2="67.281%" y2="6.672%" id="a">
|
|
40239
|
+
<stop stop-color="#FFFCFC" stop-opacity=".6" offset="0%" />
|
|
40240
|
+
<stop stop-color="#FFF" offset="100%" />
|
|
40241
|
+
</linearGradient>
|
|
40242
|
+
</defs>
|
|
40243
|
+
<path
|
|
40244
|
+
d="M14.932 3.545a.75.75 0 0 1 .102 1.494l-.102.006H13.83l-.979 8.813a2.05 2.05 0 0 1-1.882 1.818l-.155.006H4.868a2.05 2.05 0 0 1-2.037-1.824l-.98-8.813H.75a.75.75 0 0 1-.102-1.493l.102-.007h14.182zm-2.611 1.5H3.36l.961 8.648a.55.55 0 0 0 .369.46l.087.021.091.008h5.946a.55.55 0 0 0 .546-.49l.961-8.647zM10.795 0a.75.75 0 0 1 .102 1.493l-.102.007H4.886A.75.75 0 0 1 4.785.007L4.886 0h5.91z"
|
|
40245
|
+
transform="translate(2.16 2.16)"
|
|
40246
|
+
fill="url(#a)"
|
|
40247
|
+
fill-rule="nonzero"
|
|
40248
|
+
/>
|
|
40249
|
+
</svg>`;
|
|
40250
|
+
const image$1 = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIgAAABACAYAAADBAT+LAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAiKADAAQAAAABAAAAQAAAAABHi6MyAAAQMUlEQVR4Ae1dTWxV1RampVCwQH+QPhADKbHAy0sgGHkOHejExDhRB8aRA2Mk0cQfGDlzZhwTJzpyYGI0ceBIRxp1ojFE8h4qKE992ActhZYWKa11fbf3O/nu6t53n33PaZVnV3LuWnutb31r7XP2Pefc29t7161bk7U90GYPdLWJ1RJaXFxEjW7Zepq2+mHrBjzHsCGq1SYPNERzNaZ8ilW85qufPBr3fORcNBC338SGT8ewISEsY9DYFmybt23Otl+b23XTM11dXYitmOBg1S7NRbHeiLu//PLLnpdeemno559/3nbt2rU+226bn5/fYJgNprsXFha4Y3P6QA52LHNpQ4fE40MY9aX4FEsbB5L9wMcFBtvXL83f29u7zraFvr6+xYGBgfmRkZG5u+66a/7ee++98eCDD87Zfpw1/mnbrthiwQKqVXRClYibiwJ83cePH+99++2375iYmBiem5vrt0WAncWdgjq0oSF+By55b93H1PxS8VIzX79+/eLBgwevP/DAA9MvvPDCzJ49e65Z4hXbpm2xcN+W4oqBalkgzcXRffjw4e3ffffdiC2K7bIoUDu1AHJ3WFW83x++P8/v8X6cyvdxn+/rZeNtsfx26NChmRdffPHyE088gTPKZdsqLxQ0Ull27ty5Y3x8fNQuGYOVydYIKu8BuwTNnDhx4tJTTz2Fs8m4nU1udEpadYFs2rBhw99v3rx5hzXAZ0GZXoiFhqSeMUuo8o+e32f6elXxns/X82NfLzff8/lxg//o0aOTJ0+eHLvnnnsmDYB7FPizBI11KsM9PT1H7KyBG10/4RSn3yG5+XXz5/aTi/f9Vs33fH5c8OMG9+WXX/6PbeMGmrBFwldIPic4BlEnss+SDtjWab5fEMWEOmmmRE7VelXzfYt183n+ljFuZh999NEL9sJhzAJYJHjJXEpyD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3YZmd29e/fVp59+evL555+/aUSNz5PWsTjQVGyH+4azxrZY8B96+NberfalaJvtZXG3LZSuc+fOdZ0+fbrr4sWL3fa1z+vsBrfLNnD7HQLfSoo/oL5+Kl61t9L8WATY7IDjQ+Xzg4ODc/YT7XN2pph99dVXZ+68804sCLwyWahrUejkVmSBaAFbLPgqAbxvgq+4ws0sNiwgfKIeG3rAxldDvC/yPuJUM0exONjYYdC0zSxs7wcWG0Rj3kZcscxRn+ZoHH6IYjVOO5bPOBYDF0SDayUWRaPTtYe1PVBmD/wO6CvGytWge74AAAAASUVORK5CYII=`;
|
|
40251
|
+
const image = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIgAAABACAYAAADBAT+LAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAiKADAAQAAAABAAAAQAAAAABHi6MyAAAWC0lEQVR4Ae1dfaxl1VVf9955M8www8wwFQpYSpAEEMow0WpBpFGDbUxTjCY2RauJjR2skFbU1PiRQLRa/aM0YrEoTbF/FFsTSWppUyXYELW0FNQAQpWPwkAp4wDDMMMwH+9ef7+192+ffde59513eY+veezHOWudtddee62111p7v3PvPMxeb697YAEP9BboW5au0WjEOfrVtSrjNZ14fZFfz8TZaljjkkPIVo+t+2p5NW/NX4+v6ZJT90d5kjkCk65hhZNWPxNnm8SrPkJe87gO4zqI64V87Qfc1+v12PeSNS7WsrccFAMI7tstf7bWbv3kObZ/z+k2PHSyHT70ZhsNN6PvaMB1cA91oHPpqOzkEfAecEK20N0izMgfxWnmPFuad8H5k1rNfWGJPRgwwg8hm3DC1ML4yp7+AIHRf95Wze23VWuesaM3P24bjv+enbz1EXvnRx6Gr5+DCF67ESwMoGVtSeFlEJmDgvL6dtWPHWtP/ddFduiFtyMIzoZbVtkQvujn6YQTspEuGp+TK5Mb+dy4Nw0Q77TxHFM35iDrgfJSOCFbV3+nPpAhmS6QatLWKf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s8pf7vkpb8BXAYMHbG7zv9tfPPkwlyZ/bBK1m+l5yQGi2apA2WzfuWOzfeVjJ9mOb5xszzxxHAKlX84pHBAXMB5KYwmO/K2AgYO0TU2Uj37JkMI1VB8hW1xAySZkiwEct8B4qI7yWvNVm5RPEAyM/E33vA0Gj9vq9ffbKW+/xz58E3919X+vsBzB4aa6Pst8Q7CshshNuDbYvp3r7V+vP9YeumOj7X5sg+357gZ7Yd86fGttzg7igMvgiQ6MW0IMmMZBSfMu/riA0d5YwuOCdOkXx7dKfpgwBtzC8vkvDQ4hKnHYHOy1Af737KvXPmXrtjxp267YYe/+VX7BmB7xPzoXZlry47JVkGmaIFj4f+DmPwpfi4tnFl4MIP7KzIs68KJbBYEWXDTx1VBjah4eROkwQuFACx7p5OXFVvdFnP01r8bUtHpM3U86W81b9wufNl79rA68JGe4XJWCyr3eXvfAzB74f1jZ3oK55MvlAAAAAElFTkSuQmCC`;
|
|
40252
|
+
class DeleteDom {
|
|
40253
|
+
constructor(five, opts) {
|
|
40254
|
+
__publicField(this, "visible", false);
|
|
40255
|
+
__publicField(this, "five");
|
|
40256
|
+
__publicField(this, "lines", []);
|
|
40257
|
+
__publicField(this, "points", []);
|
|
40258
|
+
__publicField(this, "onClick");
|
|
40259
|
+
__publicField(this, "content", document.createElement("div"));
|
|
40260
|
+
__publicField(this, "container", document.createElement("div"));
|
|
40261
|
+
__publicField(this, "onMouseEnter", () => {
|
|
40262
|
+
this.content.style.backgroundImage = `url(${image})`;
|
|
40263
|
+
});
|
|
40264
|
+
__publicField(this, "onMouseLeave", () => {
|
|
40265
|
+
this.content.style.backgroundImage = `url(${image$1})`;
|
|
40266
|
+
});
|
|
40267
|
+
this.five = five;
|
|
40268
|
+
this.onClick = (opts == null ? void 0 : opts.onClick) || (() => void 0);
|
|
40269
|
+
this.container.classList.add("fpm__delete");
|
|
40270
|
+
this.container.style.opacity = "0";
|
|
40271
|
+
this.container.style.position = "absolute";
|
|
40272
|
+
this.container.style.left = "0";
|
|
40273
|
+
this.container.style.top = "0";
|
|
40274
|
+
this.container.style.transform = `translate3d(0, 0, 10px)`;
|
|
40275
|
+
this.container.style.pointerEvents = `none`;
|
|
40276
|
+
this.content.classList.add("fpm__delete-content");
|
|
40277
|
+
this.content.style.width = "67px";
|
|
40278
|
+
this.content.style.height = "31px";
|
|
40279
|
+
this.content.style.display = "flex";
|
|
40280
|
+
this.content.style.alignItems = "center";
|
|
40281
|
+
this.content.style.justifyContent = "center";
|
|
40282
|
+
this.content.style.transform = "translate(-50%, -50%)";
|
|
40283
|
+
this.content.style.color = "#fff";
|
|
40284
|
+
this.content.style.fontSize = "14px";
|
|
40285
|
+
this.content.style.lineHeight = "31px";
|
|
40286
|
+
this.content.style.borderRadius = "15px";
|
|
40287
|
+
this.content.style.backgroundSize = "100% 100%";
|
|
40288
|
+
this.content.style.cursor = "pointer";
|
|
40289
|
+
this.content.style.userSelect = "none";
|
|
40290
|
+
this.content.style.backgroundImage = `url(${image$1})`;
|
|
40291
|
+
this.content.innerHTML = `
|
|
40292
|
+
${svg}
|
|
40293
|
+
<span>\u5220\u9664</span>
|
|
40294
|
+
`;
|
|
40295
|
+
this.container.append(this.content);
|
|
40296
|
+
const deleteSvgDom = this.content.querySelector(".fpm__delete-icon");
|
|
40297
|
+
if (deleteSvgDom) {
|
|
40298
|
+
deleteSvgDom.style.width = "20px";
|
|
40299
|
+
deleteSvgDom.style.height = "20px";
|
|
40300
|
+
deleteSvgDom.style.marginRight = "2px";
|
|
40301
|
+
}
|
|
40302
|
+
this.content.addEventListener("click", this.onClick);
|
|
40303
|
+
this.content.addEventListener("mouseenter", this.onMouseEnter);
|
|
40304
|
+
this.content.addEventListener("mouseleave", this.onMouseLeave);
|
|
40305
|
+
}
|
|
40306
|
+
dispose() {
|
|
40307
|
+
this.content.removeEventListener("click", this.onClick);
|
|
40308
|
+
this.content.removeEventListener("mouseenter", this.onMouseEnter);
|
|
40309
|
+
this.content.removeEventListener("mouseleave", this.onMouseLeave);
|
|
40310
|
+
this.container.remove();
|
|
40311
|
+
}
|
|
40312
|
+
appendTo(element2) {
|
|
40313
|
+
element2.append(this.container);
|
|
40314
|
+
return this;
|
|
40315
|
+
}
|
|
40316
|
+
setLines(lines) {
|
|
40317
|
+
this.lines = lines;
|
|
40318
|
+
this.points = Array.from(new Set(this.lines.map((line) => [line.points[0], line.points[1]]).flat(1)));
|
|
40319
|
+
return this;
|
|
40320
|
+
}
|
|
40321
|
+
updatePosition() {
|
|
40322
|
+
if (this.lines.length === 0)
|
|
40323
|
+
return this;
|
|
40324
|
+
const points = this.points.map((point) => point.position);
|
|
40325
|
+
const ndcPoints = points.map((point) => point.clone().project(this.five.camera));
|
|
40326
|
+
if (ndcPoints.some((ndcPoint) => Math.abs(ndcPoint.z) > 1))
|
|
40327
|
+
return this.hide();
|
|
40328
|
+
const xArray = ndcPoints.map((point) => point.x);
|
|
40329
|
+
const yArray = ndcPoints.map((point) => point.y);
|
|
40330
|
+
const centerX = (Math.min(...xArray) + Math.max(...xArray)) / 2;
|
|
40331
|
+
const maxY = Math.max(...yArray);
|
|
40332
|
+
const wrapper = this.container.parentElement;
|
|
40333
|
+
if (!wrapper)
|
|
40334
|
+
return this;
|
|
40335
|
+
const centerScreenX = (centerX + 1) / 2 * wrapper.clientWidth;
|
|
40336
|
+
const maxScreenY = -(maxY - 1) / 2 * wrapper.clientHeight;
|
|
40337
|
+
const x = centerScreenX;
|
|
40338
|
+
const y2 = maxScreenY - 34;
|
|
40339
|
+
this.container.style.transform = `translate3d(${x}px, ${y2}px, 10px)`;
|
|
40340
|
+
return this.show();
|
|
40341
|
+
}
|
|
40342
|
+
hide() {
|
|
40343
|
+
this.visible = false;
|
|
40344
|
+
this.container.style.opacity = "0";
|
|
40345
|
+
this.container.style.pointerEvents = "none";
|
|
40346
|
+
return this;
|
|
40347
|
+
}
|
|
40348
|
+
show() {
|
|
40349
|
+
this.visible = true;
|
|
40350
|
+
this.container.style.opacity = "1";
|
|
40351
|
+
this.container.style.pointerEvents = "auto";
|
|
40352
|
+
return this;
|
|
40353
|
+
}
|
|
40354
|
+
}
|
|
40355
|
+
function closestPointOnLine(point, linePoints) {
|
|
40356
|
+
const tA = point.x - linePoints[0].x;
|
|
40357
|
+
const tB = point.y - linePoints[0].y;
|
|
40358
|
+
const tC = linePoints[1].x - linePoints[0].x;
|
|
40359
|
+
const tD = linePoints[1].y - linePoints[0].y;
|
|
40360
|
+
const tDot = tA * tC + tB * tD;
|
|
40361
|
+
const tLenSq = tC * tC + tD * tD;
|
|
40362
|
+
const tParam = tDot / tLenSq;
|
|
40363
|
+
let tXx, tYy;
|
|
40364
|
+
if (tParam < 0 || samePointAt(linePoints[0], linePoints[1])) {
|
|
40365
|
+
tXx = linePoints[0].x;
|
|
40366
|
+
tYy = linePoints[0].y;
|
|
40367
|
+
} else if (tParam > 1) {
|
|
40368
|
+
tXx = linePoints[1].x;
|
|
40369
|
+
tYy = linePoints[1].y;
|
|
40370
|
+
} else {
|
|
40371
|
+
tXx = linePoints[0].x + tParam * tC;
|
|
40372
|
+
tYy = linePoints[0].y + tParam * tD;
|
|
40373
|
+
}
|
|
40374
|
+
return new Vector2$1(tXx, tYy);
|
|
40375
|
+
}
|
|
40376
|
+
function samePointAt(point1, point2) {
|
|
40377
|
+
return point1.x === point2.x && point1.y === point2.y;
|
|
40378
|
+
}
|
|
40379
|
+
function ndc2Screen(ndcPosition, containerSize) {
|
|
40380
|
+
const left = (ndcPosition.x + 1) / 2 * containerSize.width;
|
|
40381
|
+
const top = -(ndcPosition.y - 1) / 2 * containerSize.height;
|
|
40382
|
+
return new Vector2$1(left, top);
|
|
40383
|
+
}
|
|
40384
|
+
function findClosestPoint(five, points, tapPoint, maxDistance) {
|
|
40385
|
+
const container = five.getElement();
|
|
40386
|
+
if (!container)
|
|
40387
|
+
return null;
|
|
40388
|
+
if (points.length === 0)
|
|
40389
|
+
return null;
|
|
40390
|
+
const containerSize = { width: container.clientWidth, height: container.clientHeight };
|
|
40391
|
+
const ndcPoints = points.map((point) => {
|
|
40392
|
+
const ndcPosition = point.position.clone().project(five.camera);
|
|
40393
|
+
if (!isNDCPointInScreen(ndcPosition))
|
|
40394
|
+
return { distance: Infinity, point };
|
|
40395
|
+
const screenPosition = ndc2Screen(ndcPosition, containerSize);
|
|
40396
|
+
const distance = screenPosition.distanceTo(tapPoint);
|
|
40397
|
+
return { distance, point };
|
|
40398
|
+
}).sort((a, b) => a.distance - b.distance);
|
|
40399
|
+
if (typeof maxDistance === "number" && ndcPoints[0].distance > maxDistance)
|
|
40400
|
+
return null;
|
|
40401
|
+
return ndcPoints[0];
|
|
40402
|
+
}
|
|
40403
|
+
function findAssociatedLines(line) {
|
|
40404
|
+
const mergeNextLine = (point, nextIndex, target) => {
|
|
40405
|
+
const nextLine = point.lines.find((line2) => {
|
|
40406
|
+
const pointIndex = line2.points.findIndex(({ id }) => id === point.id);
|
|
40407
|
+
if (pointIndex === nextIndex)
|
|
40408
|
+
return false;
|
|
40409
|
+
return true;
|
|
40410
|
+
});
|
|
40411
|
+
if (!nextLine)
|
|
40412
|
+
return target;
|
|
40413
|
+
const nextPoint = nextLine.points[nextIndex];
|
|
40414
|
+
if (!nextPoint)
|
|
40415
|
+
return target;
|
|
40416
|
+
return mergeNextLine(nextPoint, nextIndex, target.concat(nextLine));
|
|
40417
|
+
};
|
|
40418
|
+
const rightLines = mergeNextLine(line.points[0], 1, []);
|
|
40419
|
+
const leftLines = mergeNextLine(line.points[0], 0, []);
|
|
40420
|
+
const lines = rightLines.concat(leftLines);
|
|
40421
|
+
return lines;
|
|
40422
|
+
}
|
|
40423
|
+
class WatchController extends BaseController {
|
|
40424
|
+
constructor(params) {
|
|
40425
|
+
super(params);
|
|
40426
|
+
__publicField(this, "type", "watch");
|
|
40427
|
+
__publicField(this, "deleteDom");
|
|
40428
|
+
__publicField(this, "highlightedLines", []);
|
|
40429
|
+
__publicField(this, "fiveElement");
|
|
40430
|
+
__publicField(this, "editPointState");
|
|
40431
|
+
__publicField(this, "hammer");
|
|
40432
|
+
__publicField(this, "onPanStart", (e) => {
|
|
40433
|
+
var _a;
|
|
40434
|
+
if (this.model.points.length === 0 || !this.fiveElement)
|
|
40435
|
+
return;
|
|
40436
|
+
const mouse = getPointFromHammerEvent(e).point;
|
|
40437
|
+
const closestPoint = (_a = findClosestPoint(this.five, this.model.points, mouse, 20)) == null ? void 0 : _a.point;
|
|
40438
|
+
if (!closestPoint) {
|
|
40439
|
+
this.editPointState = void 0;
|
|
40440
|
+
return;
|
|
40441
|
+
}
|
|
40442
|
+
const editPointState = {
|
|
40443
|
+
point: closestPoint,
|
|
40444
|
+
associatedLines: findAssociatedLines(closestPoint.lines[0])
|
|
40445
|
+
};
|
|
40446
|
+
const cancelDragLine = this.hook.emit("wantsDragLine", {
|
|
40447
|
+
point: closestPoint.id,
|
|
40448
|
+
lines: editPointState.associatedLines.map(({ id }) => id)
|
|
40449
|
+
});
|
|
40450
|
+
if (cancelDragLine)
|
|
40451
|
+
return;
|
|
40452
|
+
this.editPointState = editPointState;
|
|
40453
|
+
this.magnifier.appendTo(this.container);
|
|
40454
|
+
this.group.add(this.mouseGroup);
|
|
40455
|
+
});
|
|
40456
|
+
__publicField(this, "onPanEnd", () => {
|
|
40457
|
+
if (!this.editPointState)
|
|
40458
|
+
return;
|
|
40459
|
+
this.editPointState.point.lines.forEach((line) => line.mesh.setMaterial({ dashed: false }));
|
|
40460
|
+
this.highlightLines(this.editPointState.associatedLines);
|
|
40461
|
+
this.editPointState = void 0;
|
|
40462
|
+
this.magnifier.dispose();
|
|
40463
|
+
this.group.remove(this.mouseGroup);
|
|
40464
|
+
});
|
|
40465
|
+
__publicField(this, "onPan", (e) => {
|
|
40466
|
+
if (!this.editPointState || !this.fiveElement)
|
|
40467
|
+
return;
|
|
40468
|
+
const mouse = getPointFromHammerEvent(e).ndcPoint;
|
|
40469
|
+
const raycaster = new Raycaster$1();
|
|
40470
|
+
raycaster.setFromCamera(mouse, this.five.camera);
|
|
40471
|
+
const [intersection] = this.five.model.intersectRaycaster(raycaster);
|
|
40472
|
+
if (!intersection)
|
|
40473
|
+
return;
|
|
40474
|
+
this.onIntersectionUpdate(intersection);
|
|
40475
|
+
});
|
|
40476
|
+
__publicField(this, "onIntersectionUpdate", (intersection, mesh) => {
|
|
40477
|
+
if (!this.editPointState)
|
|
40478
|
+
return;
|
|
40479
|
+
this.clearHighlightLines();
|
|
40480
|
+
this.editPointState.point.position.copy(intersection.point);
|
|
40481
|
+
this.editPointState.point.lines.forEach((line) => {
|
|
40482
|
+
line.mesh.setPoints(line.points[0].position.clone(), line.points[1].position.clone());
|
|
40483
|
+
line.lightMesh.setPoints(line.points[0].position.clone(), line.points[1].position.clone());
|
|
40484
|
+
line.mesh.setMaterial({ dashed: true });
|
|
40485
|
+
});
|
|
40486
|
+
this.updateDistanceUI();
|
|
40487
|
+
this.magnifier.updateWithPoint(intersection.point);
|
|
40488
|
+
this.mouseGroup.position.copy(intersection.point);
|
|
40489
|
+
if (mesh) {
|
|
40490
|
+
this.mouseGroup.quaternion.copy(mesh.quaternion);
|
|
40491
|
+
} else if (intersection.face) {
|
|
40492
|
+
const face = intersection.face.normal;
|
|
40493
|
+
const positionVector = face.clone().multiplyScalar(0.05);
|
|
40494
|
+
const position = intersection.point.clone().add(positionVector);
|
|
40495
|
+
const lookAtVector = position.clone().add(positionVector);
|
|
40496
|
+
this.mouseGroup.lookAt(lookAtVector);
|
|
40497
|
+
}
|
|
40498
|
+
this.five.needsRender = true;
|
|
40499
|
+
this.hook.emit("selectedChange", this.editPointState.associatedLines.map((line) => line.toCompletelyJson()));
|
|
40500
|
+
});
|
|
40501
|
+
__publicField(this, "wantsPanGesture", () => {
|
|
40502
|
+
if (this.editPointState)
|
|
40503
|
+
return false;
|
|
40504
|
+
});
|
|
40505
|
+
__publicField(this, "wantsTapGesture", (raycaster) => {
|
|
40506
|
+
const [target] = this.five.model.intersectRaycaster(raycaster);
|
|
40507
|
+
if (!target)
|
|
40508
|
+
return;
|
|
40509
|
+
const camera = this.five.camera;
|
|
40510
|
+
const ndcTarget = target.point.clone().project(camera);
|
|
40511
|
+
const screenWidth = this.container.clientWidth;
|
|
40512
|
+
const screenHeight = this.container.clientHeight;
|
|
40513
|
+
const targetScreenPosition = new Vector2$1(ndcTarget.x * screenWidth, ndcTarget.y * screenHeight);
|
|
40514
|
+
const screenLines = this.model.lines.map((line) => {
|
|
40515
|
+
const [startPoint, endPoint] = line.points;
|
|
40516
|
+
const ndcStartPoint = startPoint.position.clone().project(camera);
|
|
40517
|
+
const ndcEndPoint = endPoint.position.clone().project(camera);
|
|
40518
|
+
if (!isNDCPointInScreen(ndcStartPoint) && !isNDCPointInScreen(ndcEndPoint))
|
|
40519
|
+
return null;
|
|
40520
|
+
const startScreenPosition = new Vector2$1(ndcStartPoint.x * screenWidth, ndcStartPoint.y * screenHeight);
|
|
40521
|
+
const endScreenPosition = new Vector2$1(ndcEndPoint.x * screenWidth, ndcEndPoint.y * screenHeight);
|
|
40522
|
+
return { id: line.id, points: [startScreenPosition, endScreenPosition] };
|
|
40523
|
+
}).filter((line) => !!line);
|
|
40524
|
+
if (screenLines.length === 0)
|
|
40525
|
+
return;
|
|
40526
|
+
const distanceLines = screenLines.map((line) => {
|
|
40527
|
+
const closestPoint = closestPointOnLine(targetScreenPosition, line.points);
|
|
40528
|
+
return { id: line.id, distance: closestPoint.distanceTo(targetScreenPosition) };
|
|
40529
|
+
}).sort((a, b) => a.distance - b.distance);
|
|
40530
|
+
const closestScreenLine = distanceLines[0];
|
|
40531
|
+
if (closestScreenLine.distance > 20)
|
|
40532
|
+
return;
|
|
40533
|
+
const closestLine = this.model.lines.find(({ id }) => id === closestScreenLine.id);
|
|
40534
|
+
if (!closestLine)
|
|
40535
|
+
return;
|
|
40536
|
+
this.chooseLine(closestLine);
|
|
40537
|
+
return false;
|
|
40538
|
+
});
|
|
40539
|
+
__publicField(this, "chooseLine", (line) => {
|
|
40540
|
+
const highlightLines = findAssociatedLines(line);
|
|
40541
|
+
this.highlightLines(highlightLines);
|
|
40542
|
+
this.five.needsRender = true;
|
|
40543
|
+
this.hook.emit("selectedChange", highlightLines.map((line2) => line2.toCompletelyJson()));
|
|
40544
|
+
});
|
|
40545
|
+
__publicField(this, "lineRemoved", (line) => {
|
|
40546
|
+
this.removeLine(line);
|
|
40547
|
+
this.hook.emit("selectedChange", this.model.lines.filter((line2) => line2.selected).map((line2) => line2.toCompletelyJson()));
|
|
40548
|
+
});
|
|
40549
|
+
__publicField(this, "onCameraUpdate", () => {
|
|
40550
|
+
this.updateDistanceUI();
|
|
40551
|
+
this.highlightedLines.length > 0 && this.deleteDom.updatePosition();
|
|
40552
|
+
});
|
|
40553
|
+
__publicField(this, "deleteDomClickCallback", () => {
|
|
40554
|
+
const firstLine = this.highlightedLines[0];
|
|
40555
|
+
firstLine.getPolyline().lines.slice().reverse().forEach((line) => this.model.removeLine(line));
|
|
40556
|
+
this.highlightedLines = [];
|
|
40557
|
+
this.deleteDom.setLines([]).hide();
|
|
40558
|
+
});
|
|
40559
|
+
this.deleteDom = new DeleteDom(this.five, { onClick: this.deleteDomClickCallback }).appendTo(this.container);
|
|
40560
|
+
this.model.lines.forEach((line) => {
|
|
40561
|
+
line.distanceItem.appendTo(this.container);
|
|
40562
|
+
line.distanceItem.update(this.five);
|
|
40563
|
+
line.hook.on("selected", this.chooseLine);
|
|
40564
|
+
this.group.add(line.mesh);
|
|
40565
|
+
});
|
|
40566
|
+
const fiveElement = this.five.getElement();
|
|
40567
|
+
if (fiveElement) {
|
|
40568
|
+
this.fiveElement = fiveElement;
|
|
40569
|
+
const hammer2 = new Hammer(fiveElement);
|
|
40570
|
+
this.hammer = hammer2;
|
|
40571
|
+
hammer2.on("pan", this.onPan);
|
|
40572
|
+
hammer2.on("panstart", this.onPanStart);
|
|
40573
|
+
hammer2.on("panend", this.onPanEnd);
|
|
40574
|
+
}
|
|
40575
|
+
this.model.hook.on("lineRemoved", this.lineRemoved);
|
|
40576
|
+
this.five.on("cameraUpdate", this.onCameraUpdate);
|
|
40577
|
+
this.five.on("wantsTapGesture", this.wantsTapGesture);
|
|
40578
|
+
this.five.on("wantsPanGesture", this.wantsPanGesture);
|
|
40579
|
+
this.five.needsRender = true;
|
|
40580
|
+
}
|
|
40581
|
+
dispose() {
|
|
40582
|
+
var _a;
|
|
40583
|
+
super.dispose();
|
|
40584
|
+
this.deleteDom.dispose();
|
|
40585
|
+
this.model.hook.off("lineRemoved", this.lineRemoved);
|
|
40586
|
+
this.five.off("cameraUpdate", this.onCameraUpdate);
|
|
40587
|
+
this.five.off("wantsPanGesture", this.wantsPanGesture);
|
|
40588
|
+
this.five.off("wantsTapGesture", this.wantsTapGesture);
|
|
40589
|
+
this.five.needsRender = true;
|
|
40590
|
+
this.hook.emit("selectedChange", []);
|
|
40591
|
+
(_a = this.hammer) == null ? void 0 : _a.destroy();
|
|
40592
|
+
}
|
|
40593
|
+
highlightLine(line) {
|
|
40594
|
+
if (line.selected)
|
|
40595
|
+
return;
|
|
40596
|
+
line.selected = true;
|
|
40597
|
+
this.group.add(line.lightMesh);
|
|
40598
|
+
line.distanceItem.highlight();
|
|
40599
|
+
this.five.needsRender = true;
|
|
40600
|
+
}
|
|
40601
|
+
clearHighlightLines() {
|
|
40602
|
+
if (this.group.children.length === 0)
|
|
40603
|
+
return;
|
|
40604
|
+
this.deleteDom.setLines([]).hide();
|
|
40605
|
+
this.model.lines.forEach((line) => {
|
|
40606
|
+
line.selected = false;
|
|
40607
|
+
line.distanceItem.unHighlight();
|
|
40608
|
+
this.group.remove(line.lightMesh);
|
|
40609
|
+
});
|
|
40610
|
+
this.highlightedLines = [];
|
|
40611
|
+
this.five.needsRender = true;
|
|
40612
|
+
}
|
|
40613
|
+
highlightLines(lines) {
|
|
40614
|
+
this.clearHighlightLines();
|
|
40615
|
+
this.highlightedLines = lines;
|
|
40616
|
+
this.deleteDom.setLines(lines).updatePosition().show();
|
|
40617
|
+
lines.forEach((line) => this.highlightLine(line));
|
|
40618
|
+
}
|
|
40619
|
+
}
|
|
40620
|
+
const planTextureUrl = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjoAAAI6CAMAAAAZlhLyAAACB1BMVEUAAAD+/v6qqqqgoKCLi4t7e3u4uLhvb29MTExZWVlCQkJgYGBqamo4ODi9vb3///9FRUXPz887Ozv///9QUFBWVlZdXV38/Pzj4+Pn5+f8/Pz5+fn9/f329vZoaGje3t78/Pz////x8fH8/Pzs7OyBgYHd3d39/f319fX+/v79/f2Kior6+vr////+/v76+vr+/v7////8/Pz9/f3+/v7m5ub7+/v+/v7+/v7j4+P////+/v79/f3d3d3h4eH4+Pj+/v79/f12dnbc3Nz9/f3w8PD9/f34+Pj9/f3+/v5jY2P8/Pz9/f2ioqJubm7v7+/+/v76+vr5+fnv7+/09PSDg4P////t7e3+/v7+/v7+/v7///+ZmZl7e3v7+/vy8vL+/v7+/v7p6en19fX////s7Oz+/v6lpaX+/v7r6+vg4OD9/f3q6ur///////+UlJTt7e329vbz8/Pg4OD///+wsLCdnZ2QkJDe3t77+/vz8/Pw8PD+/v7c3Nyqqqrw8PD4+Pj+/v7////4+Pj////s7Oyurq7f39/p6en8/Pz////8/Pz19fVycnK0tLT////q6ure3t7o6Oj////s7Oz39/fd3d3h4eH+/v7j4+P////+/v7n5+f///////////////+ysrLe3t7////////8/PzHx8fl5eX////39/fv7+/d3d3///8S/hbOAAAArHRSTlMAzhATFhkNGyEfIx4dJQ/OKwoozS4wMh3Uy4SPbjs34kJ9EAkGP+8Snk1nRRo5JYl2eDQiA88wY3PXRDYN6dyTX0s751SxPJdhPjRdV1M4ti0XFa+pQiq5aShQSE09IKJwWMilWr9SVzLC3wvFwplKvKKY9spfUEjge6yqnexaLpqQakgBtVz1wQe9i4s6ZaG788fGKIXx95TZzKbSuKu1s2LlsJb7dqiu/cSWYhzVwQAALl1JREFUeNrs0jFqalEUheE9C9ugAQloCg0WmuIJIbxHUsQUQhQEQUTINNI463fvqU2xT3G5xfetNYQ/+M3PT7SDfDo/T0/SIe+p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p0BfTLEA6dGQymTYXUGqSSAfp0Jn5ZDKfS4dy8yyg1N8sQDocJh364jWRDuVes4BSi9fFQjq0sMgCSi3u0wWUuk+kQ7ltKmcbUGqbSAfp0Jntc0M6lHvOAkpVz1VVSYdyVRYgHTpSVXfNAkrdJdJBOnRmvb5br9cBpZpupIN06ND6Jl1AqZtEOkiHY6RDX0iHlm5Ok4BSp9KhdTqzmXQoN8sCpENHZrOHZgGlHhLp0Cqdc+nQwnkWIB0Okw59cX6bLqDUbSIdpENnRrcj6dDGKAuQDh3Z7Xaj3S6g1K4hHVqo611d1wHl6dTSoY1lvazrZUCpZSIdpENnlsljQKnHRDpIh2OkQ1+sGo+rgFKrRDqUu1hdXEiHFi6yAOlwmHToi6ssQDocJh364uXqpVnAv3bp0IhBIAig6HaBh5uJQSJpghSQBtIGhq5zd5qIRTCI934LP+vTWIe8YfgM1uGCoQuwDuesw1NYh4vmapgDsubGOliH22zbXAvI2hrrkLe9rcMl7y7AOtzk1QVYh3PW4SnGxjrkjV1A1jquq3W4YO0CrMM56/AU3y7AOtxkmr61gKypsQ5501HPOQKyynGUYh3ySheQVZZSFuuQt3QB1uGcdXiKvY6z7wFpe4R1/vsBKXObiM3QZ5oAAAAASUVORK5CYII=`;
|
|
40621
|
+
function getMouseGroup() {
|
|
40622
|
+
const group = new Group$2();
|
|
40623
|
+
const planGeometry = new PlaneGeometry$1(0.3, 0.3);
|
|
40624
|
+
const planTexture = new TextureLoader$1().load(planTextureUrl);
|
|
40625
|
+
planTexture.encoding = sRGBEncoding$1;
|
|
40626
|
+
const planMaterial = new MeshBasicMaterial$1({ map: planTexture, transparent: true, depthTest: false });
|
|
40627
|
+
const planMesh = new Mesh$1(planGeometry, planMaterial);
|
|
40628
|
+
const zPath = new CurvePath$1();
|
|
40629
|
+
zPath.add(new LineCurve3$1(new Vector3$1(0, 0, 0), new Vector3$1(0, 0, 0.1)));
|
|
40630
|
+
const zGeometry = new TubeGeometry$1(zPath, 10, 5e-3);
|
|
40631
|
+
const zMaterial = new MeshBasicMaterial$1({ color: 3404271, depthTest: false, side: DoubleSide$1 });
|
|
40632
|
+
const zMesh = new Mesh$1(zGeometry, zMaterial);
|
|
40633
|
+
const ballGeometry = new SphereGeometry$1(0.01, 32, 32);
|
|
40634
|
+
const ballMesh = new Mesh$1(ballGeometry, zMaterial);
|
|
40635
|
+
ballMesh.position.set(0, 0, 0.1);
|
|
40636
|
+
group.name = "mouse-current";
|
|
40637
|
+
group.add(planMesh, zMesh, ballMesh);
|
|
40638
|
+
return group;
|
|
40639
|
+
}
|
|
40640
|
+
const MAIN_NORMAL_PATH = "M31.379 15.466a1.045 1.045 0 0 1-.92 1.076l-11.276.607a1.6 1.6 0 0 0-1.512 1.511l-.599 11.113a1.045 1.045 0 0 1-.92 1.075l-.164.008a1.183 1.183 0 0 1-1.123-.975l-.016-.164-.221-10.768a1.6 1.6 0 0 0-1.567-1.567l-11.3-.231-.165-.016a1.187 1.187 0 0 1-.964-.996l-.01-.127.007-.164c.061-.496.455-.876.958-.917l.118-.003 11.112-.599a1.6 1.6 0 0 0 1.498-1.37l.014-.142.607-11.276a1.045 1.045 0 0 1 1.076-.92c.573.015 1.055.46 1.13 1.019l.009.121.221 10.766a1.6 1.6 0 0 0 1.567 1.566l11.3.234a1.181 1.181 0 0 1 1.14 1.139z";
|
|
40641
|
+
const MAIN_DONE_PATH = "M27.1772552,8.15828895 C27.8664561,7.48070421 28.5574369,7.81156875 28.8336646,8.04968716 C29.1098924,8.28780557 29.3990219,9.110014 28.8256559,9.79263351 L28.7110903,9.9165024 L13.9697229,25.1399531 C13.3288458,25.7700285 12.3239388,25.8070917 11.6402346,25.2511429 L11.5159715,25.1399531 L3.7056151,18.0063788 C3.01641417,17.3287941 3.00699739,16.2207954 3.68458213,15.5315945 C4.32230894,14.8829348 5.3413021,14.8364368 6.03356826,15.3981178 L6.15936649,15.5105615 L12.6856594,21.9049888 L27.1772552,8.15828895 Z";
|
|
40642
|
+
const MAIN_MOUSE_ENTER_FILL = "url(#fpm__main-b)";
|
|
40643
|
+
const MAIN_MOUSE_LEAVE_FILL = "url(#fpm__main-c)";
|
|
40644
|
+
const revokeSvg = `
|
|
40645
|
+
<svg class="fpm__revoke-icon" width="40" height="40" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg">
|
|
40646
|
+
<defs>
|
|
40647
|
+
<linearGradient x1="47.631%" y1="55.183%" x2="2.967%" y2="86.323%" id="fpm__revoke-a">
|
|
40648
|
+
<stop stop-color="#FFF" offset="0%" />
|
|
40649
|
+
<stop stop-color="#FFF" stop-opacity=".5" offset="100%" />
|
|
40650
|
+
</linearGradient>
|
|
40651
|
+
<linearGradient x1="5.297%" y1="43.016%" x2="38.238%" y2="79.932%" id="fpm__revoke-b">
|
|
40652
|
+
<stop stop-color="#FFF" offset="0%" />
|
|
40653
|
+
<stop stop-color="#FFF" stop-opacity="0" offset="100%" />
|
|
40654
|
+
</linearGradient>
|
|
40655
|
+
</defs>
|
|
40656
|
+
<path
|
|
40657
|
+
d="M13.388 7.108c.552 0 1.005.42 1.06.957l.006.11v1.224c0 .921.745 1.667 1.666 1.667h7.184c5.804 0 10.509 4.616 10.509 10.309 0 5.595-4.544 10.15-10.21 10.305l-.3.004H8.924c-.917 0-1.66-.729-1.66-1.628 0-.846.658-1.541 1.5-1.62l.16-.008h14.38c3.972 0 7.191-3.158 7.191-7.053 0-3.81-3.08-6.916-6.933-7.049l-.257-.004H10.029l-.109-.005H8.212c-.245 0-.482-.085-.67-.237l-.09-.082a1.066 1.066 0 0 1-.065-1.422l.079-.086 5.175-5.077c.2-.195.468-.305.747-.305z"
|
|
40658
|
+
fill="url(#fpm__revoke-a)"
|
|
40659
|
+
fill-rule="nonzero"
|
|
40660
|
+
stroke="url(#fpm__revoke-b)"
|
|
40661
|
+
stroke-width=".5"
|
|
40662
|
+
/>
|
|
40663
|
+
</svg>
|
|
40664
|
+
`;
|
|
40665
|
+
const exitSvg = `
|
|
40666
|
+
<svg class="fpm__exit-icon width="40" height="40" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg">
|
|
40667
|
+
<defs>
|
|
40668
|
+
<linearGradient x1="36.288%" y1="73.736%" x2="54.242%" y2="97.166%" id="fpm__exit-a">
|
|
40669
|
+
<stop stop-color="#FFF" offset="0%" />
|
|
40670
|
+
<stop stop-color="#FFF" stop-opacity=".5" offset="100%" />
|
|
40671
|
+
</linearGradient>
|
|
40672
|
+
<linearGradient x1="100%" y1="47.234%" x2="24.047%" y2="47.234%" id="fpm__exit-b">
|
|
40673
|
+
<stop stop-color="#FFF" offset="0%" />
|
|
40674
|
+
<stop stop-color="#FFF" stop-opacity=".005" offset="99.535%" />
|
|
40675
|
+
<stop stop-color="#FFF" stop-opacity="0" offset="100%" />
|
|
40676
|
+
</linearGradient>
|
|
40677
|
+
</defs>
|
|
40678
|
+
<path
|
|
40679
|
+
d="M22 7a1.5 1.5 0 0 1 .144 2.993L22 10h-9a1.5 1.5 0 0 0-1.493 1.356l-.007.144v17a1.5 1.5 0 0 0 1.356 1.493L13 30h9a1.5 1.5 0 0 1 .144 2.993L22 33h-9a4.5 4.5 0 0 1-4.495-4.288L8.5 28.5v-17a4.5 4.5 0 0 1 4.288-4.495L13 7h9zm6.317 7.755a1 1 0 0 1 .7.286l4.856 4.764a1 1 0 0 1-.7 1.713h-5.856V21.5h-8.032a1.5 1.5 0 1 1 0-3h6.365c.92 0 1.666-.746 1.667-1.667v-1.078a1 1 0 0 1 1-1z"
|
|
40680
|
+
fill="url(#fpm__exit-a)"
|
|
40681
|
+
fill-rule="nonzero"
|
|
40682
|
+
stroke="url(#fpm__exit-b)"
|
|
40683
|
+
stroke-width=".5"
|
|
40684
|
+
/>
|
|
40685
|
+
</svg>
|
|
40686
|
+
`;
|
|
40687
|
+
const mainSvg = `
|
|
40688
|
+
<svg class="fpm__main-icon" width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg">
|
|
40689
|
+
<defs>
|
|
40690
|
+
<mask id="fpm__main-icon-mask">
|
|
40691
|
+
<rect id="fpm__main-icon-mask-black" x="0" y="0" width="30" height="30" fill="black"></rect>
|
|
40692
|
+
<rect id="fpm__main-icon-mask-white" x="0" y="0" width="0" height="30" fill="white"></rect>
|
|
40693
|
+
</mask>
|
|
40694
|
+
<linearGradient id="fpm__main-a" x1="25.371%" y1="0%" x2="109.587%" y2="172.268%">
|
|
40695
|
+
<stop stop-color="#FFF" offset="0%" />
|
|
40696
|
+
<stop stop-color="#FFF" stop-opacity=".77" offset="44.051%" />
|
|
40697
|
+
<stop stop-color="#FFF" stop-opacity=".201" offset="100%" />
|
|
40698
|
+
</linearGradient>
|
|
40699
|
+
<radialGradient id="fpm__main-b" fx="50%" fy="50%" r="50.864%" gradientTransform="matrix(-.98302 0 0 -1 .992 1)">
|
|
40700
|
+
<stop stop-color="#2D7CFF" offset="0%" />
|
|
40701
|
+
<stop stop-color="#2D7CFF" stop-opacity=".3" offset="100%" />
|
|
40702
|
+
</radialGradient>
|
|
40703
|
+
<radialGradient id="fpm__main-c" fx="50%" fy="50%" r="50.864%" gradientTransform="matrix(-.98302 0 0 -1 .992 1)">
|
|
40704
|
+
<stop stop-opacity=".4" offset="0%" />
|
|
40705
|
+
<stop stop-opacity=".12" offset="100%" />
|
|
40706
|
+
</radialGradient>
|
|
40707
|
+
</defs>
|
|
40708
|
+
<g fill="none" fill-rule="evenodd">
|
|
40709
|
+
<circle fill="url(#fpm__main-a)" cx="30" cy="30" r="30" />
|
|
40710
|
+
<path
|
|
40711
|
+
class="fpm__main-icon-path"
|
|
40712
|
+
d="${MAIN_NORMAL_PATH}"
|
|
40713
|
+
fill="${MAIN_MOUSE_LEAVE_FILL}"
|
|
40714
|
+
fill-rule="nonzero"
|
|
40715
|
+
transform="translate(14 14)"
|
|
40716
|
+
/>
|
|
40717
|
+
</g>
|
|
40718
|
+
</svg>
|
|
40719
|
+
`;
|
|
40720
|
+
var htmlString = `
|
|
40721
|
+
<style>
|
|
40722
|
+
.fpm__revoke {
|
|
40723
|
+
opacity: 0.3;
|
|
40724
|
+
}
|
|
40725
|
+
|
|
40726
|
+
.fpm__revoke.enabled {
|
|
40727
|
+
opacity: 0.7;
|
|
40728
|
+
}
|
|
40729
|
+
|
|
40730
|
+
.fpm__revoke.enabled:hover {
|
|
40731
|
+
opacity: 1;
|
|
40732
|
+
}
|
|
40733
|
+
|
|
40734
|
+
.fpm__revoke-icon {
|
|
40735
|
+
width: 40px;
|
|
40736
|
+
height: 40px;
|
|
40737
|
+
margin-top: 10px;
|
|
40738
|
+
cursor: pointer;
|
|
40739
|
+
}
|
|
40740
|
+
</style>
|
|
40741
|
+
<div class="fpm_ui-bg"></div>
|
|
40742
|
+
<div class="fpm_operating-space">
|
|
40743
|
+
<div class="fpm__ui-item fpm__revoke">
|
|
40744
|
+
${revokeSvg}
|
|
40745
|
+
<span class="fpm__text fpm__revoke-text">\u64A4\u9500</span>
|
|
40746
|
+
</div>
|
|
40747
|
+
<div class="fpm__ui-item fpm__main">
|
|
40748
|
+
${mainSvg}
|
|
40749
|
+
<span class="fpm__text fpm__main-text">\u6DFB\u52A0</span>
|
|
40750
|
+
</div>
|
|
40751
|
+
<div class="fpm__ui-item fpm__exit">
|
|
40752
|
+
${exitSvg}
|
|
40753
|
+
<span class="fpm__text fpm__exit-text">\u9000\u51FA</span>
|
|
40754
|
+
</div>
|
|
40755
|
+
</div>
|
|
40756
|
+
`;
|
|
40757
|
+
const uiWrapperStyle = {
|
|
40758
|
+
position: "absolute",
|
|
40759
|
+
top: "0",
|
|
40760
|
+
left: "0",
|
|
40761
|
+
width: "100%",
|
|
40762
|
+
height: "100%",
|
|
40763
|
+
opacity: "0",
|
|
40764
|
+
transform: "translate(0, 10px)",
|
|
40765
|
+
transition: "opacity 500ms ease-in-out, transform 500ms ease-in-out"
|
|
40766
|
+
};
|
|
40767
|
+
const operatingSpaceStyle = {
|
|
40768
|
+
position: "absolute",
|
|
40769
|
+
left: "50%",
|
|
40770
|
+
bottom: "32px",
|
|
40771
|
+
transform: "translateX(-50%)",
|
|
40772
|
+
width: "300px",
|
|
40773
|
+
height: "89px",
|
|
40774
|
+
display: "flex",
|
|
40775
|
+
justifyContent: "space-between",
|
|
40776
|
+
fontSize: "16px",
|
|
40777
|
+
pointerEvents: "all",
|
|
40778
|
+
color: "#fff",
|
|
40779
|
+
zIndex: "10"
|
|
40780
|
+
};
|
|
40781
|
+
const buttonGroupStyle = {
|
|
40782
|
+
height: "100%",
|
|
40783
|
+
width: "max-content",
|
|
40784
|
+
display: "flex",
|
|
40785
|
+
flexDirection: "column",
|
|
40786
|
+
justifyContent: "space-between",
|
|
40787
|
+
alignItems: "center"
|
|
40788
|
+
};
|
|
40789
|
+
const controllerBackgroundStyle = {
|
|
40790
|
+
position: "absolute",
|
|
40791
|
+
bottom: "0",
|
|
40792
|
+
left: "0",
|
|
40793
|
+
opacity: "0.5",
|
|
40794
|
+
width: "100%",
|
|
40795
|
+
height: "184px",
|
|
40796
|
+
background: `linear-gradient(180deg, rgba(0,0,0,0.00) 0%, #000000 100%)`,
|
|
40797
|
+
zIndex: "0"
|
|
40798
|
+
};
|
|
40799
|
+
const mainItemStyle = {
|
|
40800
|
+
margin: "0 80px",
|
|
40801
|
+
opacity: "0.7"
|
|
40802
|
+
};
|
|
40803
|
+
const exitItemStyle = {
|
|
40804
|
+
opacity: "0.7"
|
|
40805
|
+
};
|
|
40806
|
+
const mainIconStyle = {
|
|
40807
|
+
width: "60px",
|
|
40808
|
+
height: "60px",
|
|
40809
|
+
backgroundSize: "100%",
|
|
40810
|
+
cursor: "pointer"
|
|
40811
|
+
};
|
|
40812
|
+
const exitIconStyle = {
|
|
40813
|
+
width: "40px",
|
|
40814
|
+
height: "40px",
|
|
40815
|
+
marginTop: "10px",
|
|
40816
|
+
backgroundSize: "100%",
|
|
40817
|
+
cursor: "pointer"
|
|
40818
|
+
};
|
|
40819
|
+
const textStyle = {
|
|
40820
|
+
cursor: "default",
|
|
40821
|
+
userSelect: "none"
|
|
40822
|
+
};
|
|
40823
|
+
class MainBtnController {
|
|
40824
|
+
constructor(measureController, container) {
|
|
40825
|
+
__publicField(this, "container");
|
|
40826
|
+
__publicField(this, "measureController");
|
|
40827
|
+
__publicField(this, "mainIconMaskTween");
|
|
40828
|
+
__publicField(this, "mainElement");
|
|
40829
|
+
__publicField(this, "onMouseEnter", () => {
|
|
40830
|
+
const { mainItem, pathDom } = this.mainElement;
|
|
40831
|
+
mainItem.style.opacity = "1";
|
|
40832
|
+
pathDom.setAttribute("fill", MAIN_MOUSE_ENTER_FILL);
|
|
40833
|
+
});
|
|
40834
|
+
__publicField(this, "onMouseLeave", () => {
|
|
40835
|
+
const { mainItem, pathDom } = this.mainElement;
|
|
40836
|
+
mainItem.style.opacity = "0.7";
|
|
40837
|
+
pathDom.setAttribute("fill", MAIN_MOUSE_LEAVE_FILL);
|
|
40838
|
+
});
|
|
40839
|
+
__publicField(this, "onClick", () => {
|
|
40840
|
+
const mode = this.measureController.getCurrentMode();
|
|
40841
|
+
mode === "Watch" ? this.measureController.changeMode("Edit") : this.measureController.save().changeMode("Watch");
|
|
40842
|
+
});
|
|
40843
|
+
__publicField(this, "editedLineChangeHandler", (lines) => {
|
|
40844
|
+
if (lines.length > 1)
|
|
40845
|
+
return;
|
|
40846
|
+
if (lines.length === 0)
|
|
40847
|
+
return this.change2Cancel(false);
|
|
40848
|
+
this.change2Done();
|
|
40849
|
+
});
|
|
40850
|
+
__publicField(this, "modeChangeHandler", (mode) => {
|
|
40851
|
+
mode === "Watch" ? this.change2Add() : this.change2Cancel();
|
|
40852
|
+
});
|
|
40853
|
+
this.measureController = measureController;
|
|
40854
|
+
this.container = container;
|
|
40855
|
+
this.mainElement = this.getMainElement();
|
|
40856
|
+
Object.assign(this.mainElement.mainIcon.style, mainIconStyle);
|
|
40857
|
+
Object.assign(this.mainElement.mainItem.style, mainItemStyle);
|
|
40858
|
+
this.change2Add();
|
|
40859
|
+
this.measureController.hook.on("modeChange", this.modeChangeHandler);
|
|
40860
|
+
this.mainElement.mainIcon.addEventListener("click", this.onClick);
|
|
40861
|
+
this.mainElement.mainIcon.addEventListener("mouseenter", this.onMouseEnter);
|
|
40862
|
+
this.mainElement.mainIcon.addEventListener("mouseleave", this.onMouseLeave);
|
|
40863
|
+
}
|
|
40864
|
+
dispose() {
|
|
40865
|
+
this.measureController.hook.off("modeChange", this.modeChangeHandler);
|
|
40866
|
+
this.measureController.hook.off("editedLineChange", this.editedLineChangeHandler);
|
|
40867
|
+
this.mainElement.mainIcon.removeEventListener("click", this.onClick);
|
|
40868
|
+
this.mainElement.mainIcon.removeEventListener("mouseenter", this.onMouseEnter);
|
|
40869
|
+
this.mainElement.mainIcon.removeEventListener("mouseleave", this.onMouseLeave);
|
|
40870
|
+
}
|
|
40871
|
+
getMainElement() {
|
|
40872
|
+
const mainTextDom = this.container.querySelector(".fpm__main-text");
|
|
40873
|
+
const mainItem = this.container.querySelector(".fpm__main");
|
|
40874
|
+
const mainIcon = this.container.querySelector(".fpm__main-icon");
|
|
40875
|
+
const pathDom = mainItem == null ? void 0 : mainItem.querySelector(".fpm__main-icon-path");
|
|
40876
|
+
const maskWhiteRect = mainIcon == null ? void 0 : mainIcon.querySelector("#fpm__main-icon-mask-white");
|
|
40877
|
+
if (!mainItem || !mainTextDom || !mainIcon || !pathDom || !maskWhiteRect)
|
|
40878
|
+
throw new Error("cannot find dom");
|
|
40879
|
+
return { mainTextDom, mainItem, mainIcon, pathDom, maskWhiteRect };
|
|
40880
|
+
}
|
|
40881
|
+
change2Add() {
|
|
40882
|
+
this.measureController.hook.off("editedLineChange", this.editedLineChangeHandler);
|
|
40883
|
+
const { mainIcon, mainTextDom, pathDom } = this.mainElement;
|
|
40884
|
+
mainIcon.style.transition = mainTextDom.innerText === "\u5B8C\u6210" ? "none" : "transform 300ms ease-in-out";
|
|
40885
|
+
mainIcon.style.transform = "rotate(0deg)";
|
|
40886
|
+
mainTextDom.innerText = "\u6DFB\u52A0";
|
|
40887
|
+
pathDom == null ? void 0 : pathDom.setAttribute("d", MAIN_NORMAL_PATH);
|
|
40888
|
+
}
|
|
40889
|
+
change2Cancel(withAnime = true) {
|
|
40890
|
+
const { mainIcon, mainTextDom, pathDom } = this.mainElement;
|
|
40891
|
+
pathDom.setAttribute("d", MAIN_NORMAL_PATH);
|
|
40892
|
+
pathDom.setAttribute("mask", "");
|
|
40893
|
+
mainIcon.style.transition = withAnime ? "transform 300ms ease-in-out" : "none";
|
|
40894
|
+
mainIcon.style.transform = "rotate(45deg)";
|
|
40895
|
+
mainTextDom && (mainTextDom.innerText = "\u53D6\u6D88");
|
|
40896
|
+
this.measureController.hook.on("editedLineChange", this.editedLineChangeHandler);
|
|
40897
|
+
}
|
|
40898
|
+
change2Done() {
|
|
40899
|
+
var _a;
|
|
40900
|
+
const { mainTextDom, mainIcon, pathDom, maskWhiteRect } = this.getMainElement();
|
|
40901
|
+
if (mainTextDom.innerText === "\u5B8C\u6210")
|
|
40902
|
+
return;
|
|
40903
|
+
mainIcon.style.transition = "none";
|
|
40904
|
+
mainIcon.style.transform = "rotate(0deg)";
|
|
40905
|
+
mainTextDom.innerText = "\u5B8C\u6210";
|
|
40906
|
+
pathDom.setAttribute("d", MAIN_DONE_PATH);
|
|
40907
|
+
pathDom.setAttribute("mask", `url(#fpm__main-icon-mask)`);
|
|
40908
|
+
(_a = this.mainIconMaskTween) == null ? void 0 : _a.dispose();
|
|
40909
|
+
this.mainIconMaskTween = tweenProgress().easing(exports.Easing.Quartic.InOut).onUpdate(({ progress }) => {
|
|
40910
|
+
maskWhiteRect.setAttribute("width", (progress * 30).toString());
|
|
40911
|
+
}).onComplete(() => {
|
|
40912
|
+
var _a2;
|
|
40913
|
+
return (_a2 = this.mainIconMaskTween) == null ? void 0 : _a2.dispose();
|
|
40914
|
+
}).play();
|
|
40915
|
+
}
|
|
40916
|
+
}
|
|
40917
|
+
class Revoke {
|
|
40918
|
+
constructor(measureController, container) {
|
|
40919
|
+
__publicField(this, "container");
|
|
40920
|
+
__publicField(this, "revokeIcon");
|
|
40921
|
+
__publicField(this, "revokeItem");
|
|
40922
|
+
__publicField(this, "measureController");
|
|
40923
|
+
__publicField(this, "onClick", () => {
|
|
40924
|
+
this.measureController.revoke();
|
|
40925
|
+
});
|
|
40926
|
+
__publicField(this, "onModeChange", (mode) => {
|
|
40927
|
+
if (mode !== "Edit") {
|
|
40928
|
+
this.revokeItem.classList.remove("enabled");
|
|
40929
|
+
return;
|
|
40930
|
+
}
|
|
40931
|
+
this.revokeItem.classList.add("enabled");
|
|
40932
|
+
});
|
|
40933
|
+
__publicField(this, "handleRevoke", () => {
|
|
40934
|
+
return () => {
|
|
40935
|
+
};
|
|
40936
|
+
});
|
|
40937
|
+
this.measureController = measureController;
|
|
40938
|
+
this.container = container;
|
|
40939
|
+
const revokeIcon = this.container.querySelector(".fpm__revoke-icon");
|
|
40940
|
+
const revokeItem = this.container.querySelector(".fpm__revoke");
|
|
40941
|
+
if (!revokeIcon || !revokeItem)
|
|
40942
|
+
throw new Error("\u4E0D\u6B63\u786E\u7684\u9009\u62E9\u5668");
|
|
40943
|
+
this.revokeIcon = revokeIcon;
|
|
40944
|
+
this.revokeItem = revokeItem;
|
|
40945
|
+
this.revokeIcon.addEventListener("click", this.onClick);
|
|
40946
|
+
measureController.hook.on("modeChange", this.onModeChange);
|
|
40947
|
+
}
|
|
40948
|
+
dispose() {
|
|
40949
|
+
this.revokeIcon.removeEventListener("click", this.onClick);
|
|
40950
|
+
this.measureController.hook.off("modeChange", this.onModeChange);
|
|
40951
|
+
}
|
|
40952
|
+
}
|
|
40953
|
+
class UIController {
|
|
40954
|
+
constructor(measureController, params) {
|
|
40955
|
+
__publicField(this, "revoke");
|
|
40956
|
+
__publicField(this, "container");
|
|
40957
|
+
__publicField(this, "mainController");
|
|
40958
|
+
__publicField(this, "disposers", []);
|
|
40959
|
+
__publicField(this, "measureController");
|
|
40960
|
+
__publicField(this, "handleExit", () => {
|
|
40961
|
+
const exitIcon = this.container.querySelector(".fpm__exit-icon");
|
|
40962
|
+
const exitItem = this.container.querySelector(".fpm__exit");
|
|
40963
|
+
if (!exitItem || !exitIcon)
|
|
40964
|
+
throw new Error("cannot find dom");
|
|
40965
|
+
Object.assign(exitItem.style, exitItemStyle);
|
|
40966
|
+
Object.assign(exitIcon == null ? void 0 : exitIcon.style, exitIconStyle);
|
|
40967
|
+
const onMouseEnter = () => exitItem.style.opacity = "1";
|
|
40968
|
+
const onMouseLeave = () => exitItem.style.opacity = "0.7";
|
|
40969
|
+
const handleClick = () => {
|
|
40970
|
+
this.measureController.disable();
|
|
40971
|
+
};
|
|
40972
|
+
exitIcon.addEventListener("click", handleClick);
|
|
40973
|
+
exitIcon.addEventListener("mouseenter", onMouseEnter);
|
|
40974
|
+
exitIcon.addEventListener("mouseleave", onMouseLeave);
|
|
40975
|
+
return () => {
|
|
40976
|
+
exitIcon.removeEventListener("click", handleClick);
|
|
40977
|
+
exitIcon.removeEventListener("mouseenter", onMouseEnter);
|
|
40978
|
+
exitIcon.removeEventListener("mouseleave", onMouseLeave);
|
|
40979
|
+
};
|
|
40980
|
+
});
|
|
40981
|
+
this.measureController = measureController;
|
|
40982
|
+
this.container = document.createElement("div");
|
|
40983
|
+
this.container.innerHTML = htmlString;
|
|
40984
|
+
this.container.classList.add("fpm__ui-controller");
|
|
40985
|
+
params.container.appendChild(this.container);
|
|
40986
|
+
const textDoms = this.container.querySelectorAll(".fpm__text");
|
|
40987
|
+
const UIItems = this.container.querySelectorAll(".fpm__ui-item");
|
|
40988
|
+
const bgDom = this.container.querySelector(".fpm_ui-bg");
|
|
40989
|
+
const operatingSpaceDom = this.container.querySelector(".fpm_operating-space");
|
|
40990
|
+
Object.assign(bgDom == null ? void 0 : bgDom.style, controllerBackgroundStyle);
|
|
40991
|
+
Object.assign(operatingSpaceDom == null ? void 0 : operatingSpaceDom.style, operatingSpaceStyle);
|
|
40992
|
+
Object.assign(this.container.style, uiWrapperStyle);
|
|
40993
|
+
UIItems.forEach((item) => Object.assign(item.style, buttonGroupStyle));
|
|
40994
|
+
textDoms.forEach((item) => Object.assign(item.style, textStyle));
|
|
40995
|
+
}
|
|
40996
|
+
dispose() {
|
|
40997
|
+
this.hide();
|
|
40998
|
+
this.container.remove();
|
|
40999
|
+
}
|
|
41000
|
+
show() {
|
|
41001
|
+
this.container.style.opacity = "1";
|
|
41002
|
+
this.container.style.transform = "translate(0, 0)";
|
|
41003
|
+
this.revoke = new Revoke(this.measureController, this.container);
|
|
41004
|
+
this.mainController = new MainBtnController(this.measureController, this.container);
|
|
41005
|
+
this.disposers.push(this.handleExit());
|
|
41006
|
+
return this;
|
|
41007
|
+
}
|
|
41008
|
+
hide() {
|
|
41009
|
+
var _a, _b;
|
|
41010
|
+
this.container.style.opacity = "0";
|
|
41011
|
+
this.container.style.transform = "translate(0, 10px)";
|
|
41012
|
+
(_a = this.revoke) == null ? void 0 : _a.dispose();
|
|
41013
|
+
(_b = this.mainController) == null ? void 0 : _b.dispose();
|
|
41014
|
+
this.disposers.forEach((disposer) => disposer());
|
|
41015
|
+
this.disposers = [];
|
|
41016
|
+
return this;
|
|
41017
|
+
}
|
|
41018
|
+
}
|
|
41019
|
+
class GuideController {
|
|
41020
|
+
constructor(measureController, params) {
|
|
41021
|
+
__publicField(this, "measureController");
|
|
41022
|
+
__publicField(this, "textDom", document.createElement("span"));
|
|
41023
|
+
__publicField(this, "container", document.createElement("div"));
|
|
41024
|
+
__publicField(this, "hasAnchor", false);
|
|
41025
|
+
__publicField(this, "onModelChange", (mode) => {
|
|
41026
|
+
if (mode === "Watch") {
|
|
41027
|
+
this.textDom.innerText = ``;
|
|
41028
|
+
return;
|
|
41029
|
+
}
|
|
41030
|
+
this.textDom.innerText = `\u8BF7\u9009\u62E9\u7B2C\u4E00\u4E2A\u6D4B\u91CF\u70B9\uFF0CEsc\u6216\u5355\u51FB\u9F20\u6807\u53F3\u952E\u53EF\u53D6\u6D88\u9009\u62E9`;
|
|
41031
|
+
});
|
|
41032
|
+
__publicField(this, "anchorChange", (anchor) => {
|
|
41033
|
+
if (!this.hasAnchor && !!anchor) {
|
|
41034
|
+
this.hasAnchor = true;
|
|
41035
|
+
this.textDom.innerText = `\u9009\u62E9\u4E0B\u4E00\u4E2A\u6D4B\u91CF\u70B9\uFF0CEsc\u6216\u5355\u51FB\u9F20\u6807\u53F3\u952E\u53D6\u6D88\u9009\u62E9`;
|
|
41036
|
+
} else if (!anchor) {
|
|
41037
|
+
this.hasAnchor = false;
|
|
41038
|
+
this.textDom.innerText = `\u8BF7\u9009\u62E9\u7B2C\u4E00\u4E2A\u6D4B\u91CF\u70B9\uFF0CEsc\u6216\u5355\u51FB\u9F20\u6807\u53F3\u952E\u53EF\u53D6\u6D88\u9009\u62E9`;
|
|
41039
|
+
}
|
|
41040
|
+
});
|
|
41041
|
+
__publicField(this, "onEditedLineChange", (lines) => {
|
|
41042
|
+
if (lines.length === 1) {
|
|
41043
|
+
this.textDom.innerText = `\u53EF\u4EE5\u8FDE\u7EED\u9009\u62E9\u6D4B\u91CF\u70B9\uFF0C\u6216\u70B9\u51FB\u4E0B\u65B9\u201C\u5B8C\u6210\u201D\u7ED3\u675F\u6D4B\u91CF\uFF08Esc\u53D6\u6D88\uFF0CCommand+S\u4FDD\u5B58\uFF09`;
|
|
41044
|
+
}
|
|
41045
|
+
});
|
|
41046
|
+
this.initDom();
|
|
41047
|
+
params.container.append(this.container);
|
|
41048
|
+
this.measureController = measureController;
|
|
41049
|
+
measureController.hook.on("modeChange", this.onModelChange);
|
|
41050
|
+
measureController.hook.on("anchorChange", this.anchorChange);
|
|
41051
|
+
measureController.hook.on("editedLineChange", this.onEditedLineChange);
|
|
41052
|
+
}
|
|
41053
|
+
dispose() {
|
|
41054
|
+
this.hide();
|
|
41055
|
+
this.container.remove();
|
|
41056
|
+
}
|
|
41057
|
+
show() {
|
|
41058
|
+
this.container.style.opacity = "1";
|
|
41059
|
+
this.container.style.transform = "translate(0, 0)";
|
|
41060
|
+
return this;
|
|
41061
|
+
}
|
|
41062
|
+
hide() {
|
|
41063
|
+
this.container.style.opacity = "0";
|
|
41064
|
+
this.container.style.transform = "translate(0, -10px)";
|
|
41065
|
+
this.measureController.hook.off("modeChange", this.onModelChange);
|
|
41066
|
+
this.measureController.hook.off("anchorChange", this.anchorChange);
|
|
41067
|
+
this.measureController.hook.off("editedLineChange", this.onEditedLineChange);
|
|
41068
|
+
return this;
|
|
41069
|
+
}
|
|
41070
|
+
initDom() {
|
|
41071
|
+
const container = this.container;
|
|
41072
|
+
const textDom = this.textDom;
|
|
41073
|
+
container.classList.add("fpm__guide-container");
|
|
41074
|
+
container.style.position = "absolute";
|
|
41075
|
+
container.style.top = "0px";
|
|
41076
|
+
container.style.left = "0px";
|
|
41077
|
+
container.style.width = "100%";
|
|
41078
|
+
container.style.height = "110px";
|
|
41079
|
+
container.style.display = "flex";
|
|
41080
|
+
container.style.alignItems = "center";
|
|
41081
|
+
container.style.justifyContent = "center";
|
|
41082
|
+
container.style.transform = "translate(0, -10px)";
|
|
41083
|
+
container.style.background = `linear-gradient(180deg, rgba(0,0,0,0.40) 0%, rgba(0,0,0,0.00) 100%)`;
|
|
41084
|
+
container.style.transition = "opacity 500ms ease-in-out, transform 500ms ease-in-out";
|
|
41085
|
+
container.style.opacity = "0";
|
|
41086
|
+
textDom.classList.add("fpm__guide-text");
|
|
41087
|
+
textDom.style.color = "#fff";
|
|
41088
|
+
textDom.style.fontSize = "20px";
|
|
41089
|
+
textDom.innerText = `\u70B9\u51FB\u4E0B\u65B9\u201C\u6DFB\u52A0\u201D\u5F00\u59CB\u6D4B\u8DDD`;
|
|
41090
|
+
container.appendChild(textDom);
|
|
41091
|
+
}
|
|
41092
|
+
}
|
|
41093
|
+
class ShortcutKeyController {
|
|
41094
|
+
constructor(measureController, five) {
|
|
41095
|
+
__publicField(this, "five");
|
|
41096
|
+
__publicField(this, "measureController");
|
|
41097
|
+
__publicField(this, "onKeyDown", (e) => {
|
|
41098
|
+
if (e.metaKey && e.code === "KeyS") {
|
|
41099
|
+
this.measureController.save().changeMode("Watch");
|
|
41100
|
+
e.preventDefault();
|
|
41101
|
+
return;
|
|
41102
|
+
}
|
|
41103
|
+
if (e.code === "Escape")
|
|
41104
|
+
return this.escape();
|
|
41105
|
+
});
|
|
41106
|
+
__publicField(this, "onMouseDown", (e) => {
|
|
41107
|
+
if (e.button !== 2)
|
|
41108
|
+
return;
|
|
41109
|
+
e.preventDefault();
|
|
41110
|
+
this.escape();
|
|
41111
|
+
});
|
|
41112
|
+
this.five = five;
|
|
41113
|
+
this.measureController = measureController;
|
|
41114
|
+
const fiveElement = this.five.getElement();
|
|
41115
|
+
if (!fiveElement)
|
|
41116
|
+
return;
|
|
41117
|
+
document.body.addEventListener("keydown", this.onKeyDown);
|
|
41118
|
+
fiveElement.addEventListener("mousedown", this.onMouseDown);
|
|
41119
|
+
}
|
|
41120
|
+
dispose() {
|
|
41121
|
+
const fiveElement = this.five.getElement();
|
|
41122
|
+
if (!fiveElement)
|
|
41123
|
+
return;
|
|
41124
|
+
document.body.removeEventListener("keydown", this.onKeyDown);
|
|
41125
|
+
fiveElement.removeEventListener("mousedown", this.onMouseDown);
|
|
41126
|
+
}
|
|
41127
|
+
escape() {
|
|
41128
|
+
if (this.measureController.getCurrentMode() === "Watch")
|
|
41129
|
+
return this.measureController.disable();
|
|
41130
|
+
return this.measureController.changeMode("Watch");
|
|
41131
|
+
}
|
|
41132
|
+
}
|
|
41133
|
+
class MeasureController {
|
|
41134
|
+
constructor(five, params) {
|
|
41135
|
+
__publicField(this, "hasOpen", false);
|
|
41136
|
+
__publicField(this, "hook", new Subscribe());
|
|
41137
|
+
__publicField(this, "five");
|
|
41138
|
+
__publicField(this, "model");
|
|
41139
|
+
__publicField(this, "group");
|
|
41140
|
+
__publicField(this, "magnifier");
|
|
41141
|
+
__publicField(this, "fiveHelper");
|
|
41142
|
+
__publicField(this, "useUIController");
|
|
41143
|
+
__publicField(this, "params");
|
|
41144
|
+
__publicField(this, "useGuideController");
|
|
41145
|
+
__publicField(this, "container", document.createElement("div"));
|
|
41146
|
+
__publicField(this, "shortcutKeyController");
|
|
41147
|
+
__publicField(this, "controller", null);
|
|
41148
|
+
__publicField(this, "controllerParams");
|
|
41149
|
+
__publicField(this, "getCurrentMode", () => {
|
|
41150
|
+
if (this.controller instanceof EditController)
|
|
41151
|
+
return "Edit";
|
|
41152
|
+
if (this.controller instanceof WatchController)
|
|
41153
|
+
return "Watch";
|
|
41154
|
+
return null;
|
|
41155
|
+
});
|
|
41156
|
+
__publicField(this, "changeMode", (mode) => {
|
|
41157
|
+
var _a;
|
|
41158
|
+
if (!this.hasOpen)
|
|
41159
|
+
return;
|
|
41160
|
+
if (this.getCurrentMode() === mode)
|
|
41161
|
+
return;
|
|
41162
|
+
(_a = this.controller) == null ? void 0 : _a.dispose();
|
|
41163
|
+
const controllerMap = {
|
|
41164
|
+
Watch: WatchController,
|
|
41165
|
+
Edit: EditController
|
|
41166
|
+
};
|
|
41167
|
+
if (!controllerMap[mode])
|
|
41168
|
+
throw new Error("\u4E0D\u5B58\u5728\u7684 Mode");
|
|
41169
|
+
this.controller = new controllerMap[mode](this.controllerParams);
|
|
41170
|
+
this.hook.emit("modeChange", mode);
|
|
41171
|
+
});
|
|
41172
|
+
this.five = five;
|
|
41173
|
+
this.params = params;
|
|
41174
|
+
this.model = new Model({ userDistanceItemCreator: this.params.userDistanceItemCreator });
|
|
41175
|
+
this.fiveHelper = new FiveHelper(five);
|
|
41176
|
+
const magnifierSize = 190;
|
|
41177
|
+
const magnifierScale = 2;
|
|
41178
|
+
this.magnifier = new Magnifier(five, { scale: magnifierScale, width: magnifierSize, height: magnifierSize });
|
|
41179
|
+
this.group = new Group$2();
|
|
41180
|
+
this.group.name = "plugin-measure-group";
|
|
41181
|
+
this.container.classList.add("five-plugin-measure-container");
|
|
41182
|
+
this.container.style.position = "relative";
|
|
41183
|
+
this.container.style.pointerEvents = "none";
|
|
41184
|
+
this.container.style.width = "100%";
|
|
41185
|
+
this.container.style.height = "100%";
|
|
41186
|
+
this.container.style.background = "rgba(0, 0, 0, 0.15)";
|
|
41187
|
+
this.controllerParams = {
|
|
41188
|
+
five: this.five,
|
|
41189
|
+
hook: this.hook,
|
|
41190
|
+
group: this.group,
|
|
41191
|
+
model: this.model,
|
|
41192
|
+
magnifier: this.magnifier,
|
|
41193
|
+
container: this.container,
|
|
41194
|
+
fiveHelper: this.fiveHelper,
|
|
41195
|
+
mouseGroup: getMouseGroup(),
|
|
41196
|
+
userDistanceItemCreator: this.params.userDistanceItemCreator
|
|
41197
|
+
};
|
|
41198
|
+
if (this.params.useUIController !== false)
|
|
41199
|
+
this.useUIController = new UIController(this, this.controllerParams);
|
|
41200
|
+
if (this.params.useUIController !== false)
|
|
41201
|
+
this.useGuideController = new GuideController(this, this.controllerParams);
|
|
41202
|
+
}
|
|
41203
|
+
appendTo(parent) {
|
|
41204
|
+
parent.append(this.container);
|
|
41205
|
+
}
|
|
41206
|
+
dispose() {
|
|
41207
|
+
var _a, _b;
|
|
41208
|
+
this.disable();
|
|
41209
|
+
(_a = this.useUIController) == null ? void 0 : _a.dispose();
|
|
41210
|
+
(_b = this.magnifier) == null ? void 0 : _b.dispose();
|
|
41211
|
+
this.five.needsRender = true;
|
|
41212
|
+
}
|
|
41213
|
+
load(data) {
|
|
41214
|
+
this.model.parse(data);
|
|
41215
|
+
this.save();
|
|
41216
|
+
}
|
|
41217
|
+
enable() {
|
|
41218
|
+
var _a, _b;
|
|
41219
|
+
if (this.hasOpen)
|
|
41220
|
+
return;
|
|
41221
|
+
this.hasOpen = true;
|
|
41222
|
+
this.five.scene.add(this.group);
|
|
41223
|
+
this.five.helperVisible = false;
|
|
41224
|
+
this.controller = new WatchController(this.controllerParams);
|
|
41225
|
+
(_a = this.useUIController) == null ? void 0 : _a.show();
|
|
41226
|
+
(_b = this.useGuideController) == null ? void 0 : _b.show();
|
|
41227
|
+
this.shortcutKeyController = new ShortcutKeyController(this, this.five);
|
|
41228
|
+
this.hook.emit("enable", true);
|
|
41229
|
+
}
|
|
41230
|
+
disable() {
|
|
41231
|
+
var _a, _b, _c, _d;
|
|
41232
|
+
this.hasOpen = false;
|
|
41233
|
+
(_a = this.controller) == null ? void 0 : _a.dispose();
|
|
41234
|
+
(_b = this.useUIController) == null ? void 0 : _b.hide();
|
|
41235
|
+
(_c = this.useGuideController) == null ? void 0 : _c.hide();
|
|
41236
|
+
(_d = this.shortcutKeyController) == null ? void 0 : _d.dispose();
|
|
41237
|
+
this.controller = null;
|
|
41238
|
+
this.five.helperVisible = true;
|
|
41239
|
+
this.five.scene.remove(this.group);
|
|
41240
|
+
this.five.needsRender = true;
|
|
41241
|
+
this.hook.emit("disable", true);
|
|
41242
|
+
}
|
|
41243
|
+
revoke() {
|
|
41244
|
+
if (!(this.controller instanceof EditController))
|
|
41245
|
+
return;
|
|
41246
|
+
this.controller.revoke();
|
|
41247
|
+
return;
|
|
41248
|
+
}
|
|
41249
|
+
removeLineByID(lineID) {
|
|
41250
|
+
this.model.removeLineByID(lineID);
|
|
41251
|
+
}
|
|
41252
|
+
highlightLine(lineID) {
|
|
41253
|
+
if (this.getCurrentMode() !== "Watch")
|
|
41254
|
+
return false;
|
|
41255
|
+
const line = this.model.getLineByID(lineID);
|
|
41256
|
+
if (!line)
|
|
41257
|
+
return false;
|
|
41258
|
+
this.controller.highlightLine(line);
|
|
41259
|
+
return true;
|
|
41260
|
+
}
|
|
41261
|
+
clearHighlightLines() {
|
|
41262
|
+
if (this.getCurrentMode() !== "Watch")
|
|
41263
|
+
return false;
|
|
41264
|
+
this.controller.clearHighlightLines();
|
|
41265
|
+
return true;
|
|
41266
|
+
}
|
|
41267
|
+
save() {
|
|
41268
|
+
if (!(this.controller instanceof EditController))
|
|
41269
|
+
return this;
|
|
41270
|
+
this.model.mergeModel(this.controller.model);
|
|
41271
|
+
return this;
|
|
41272
|
+
}
|
|
41273
|
+
toJson() {
|
|
41274
|
+
return this.model.toJson();
|
|
41275
|
+
}
|
|
41276
|
+
}
|
|
41277
|
+
const PanoMeasurePlugin = function MeasurePlugin(five, params) {
|
|
41278
|
+
return new MeasureController(five, params);
|
|
41279
|
+
};
|
|
41280
|
+
export { CSS3DRenderPlugin, CameraMovementPlugin, FLOOR_PLAN_ATTACHED_TO, ModelChassisCompassPlugin, ModelEntryDoorGuidePlugin, ModelFloorplanPlugin, ModelRoomLabelPlugin, ModelViewPlugin, PanoCompassPlugin, PanoCursorRaycasterPlugin, PanoFloorplanRadarPlugin, PanoMeasurePlugin, PanoRulerPlugin, TopviewFloorplanPlugin };
|