@xeokit/xeokit-sdk 2.6.20 → 2.6.23

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.
@@ -12382,10 +12382,10 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
12382
12382
  }
12383
12383
 
12384
12384
  _destroyMarkerDiv() {
12385
- if (this._markerDiv) {
12385
+ if (this.markerDiv) {
12386
12386
  const element = document.getElementById('myMarkerDiv');
12387
12387
  element.parentNode.removeChild(element);
12388
- this._markerDiv = null;
12388
+ this.markerDiv = null;
12389
12389
  }
12390
12390
  }
12391
12391
 
@@ -14099,6 +14099,320 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
14099
14099
  }
14100
14100
  }
14101
14101
 
14102
+ const nop = () => { };
14103
+
14104
+ function transformToNode(from, to, vec) {
14105
+ const fromRec = from.getBoundingClientRect();
14106
+ const toRec = to.getBoundingClientRect();
14107
+ vec[0] += fromRec.left - toRec.left;
14108
+ vec[1] += fromRec.top - toRec.top;
14109
+ }
14110
+ function createDraggableDot3D(cfg) {
14111
+ const extractCFG = function(propName, defaultValue) {
14112
+ if (propName in cfg) {
14113
+ return cfg[propName];
14114
+ } else if (defaultValue !== undefined) {
14115
+ return defaultValue;
14116
+ } else {
14117
+ throw "config missing: " + propName;
14118
+ }
14119
+ };
14120
+
14121
+ const viewer = extractCFG("viewer");
14122
+ const worldPos = extractCFG("worldPos");
14123
+ const color = extractCFG("color");
14124
+ const ray2WorldPos = extractCFG("ray2WorldPos");
14125
+ const handleMouseEvents = extractCFG("handleMouseEvents", false);
14126
+ const handleTouchEvents = extractCFG("handleTouchEvents", false);
14127
+ const onStart = extractCFG("onStart", nop);
14128
+ const onMove = extractCFG("onMove", nop);
14129
+ const onEnd = extractCFG("onEnd", nop);
14130
+
14131
+ const scene = viewer.scene;
14132
+ const canvas = scene.canvas.canvas;
14133
+
14134
+ const marker = new Marker(scene, {});
14135
+
14136
+ const pickWorldPos = canvasPos => {
14137
+ const origin = math.vec3();
14138
+ const direction = math.vec3();
14139
+ math.canvasPosToWorldRay(canvas, scene.camera.viewMatrix, scene.camera.projMatrix, canvasPos, origin, direction);
14140
+ return ray2WorldPos(origin, direction, canvasPos);
14141
+ };
14142
+
14143
+ const onChange = event => {
14144
+ const canvasPos = math.vec2([ event.clientX, event.clientY ]);
14145
+ transformToNode(canvas.ownerDocument.body, canvas, canvasPos);
14146
+
14147
+ const worldPos = pickWorldPos(canvasPos);
14148
+ marker.worldPos = worldPos;
14149
+ updateDotPos();
14150
+ onMove(canvasPos, worldPos);
14151
+ };
14152
+
14153
+ let currentDrag = null;
14154
+
14155
+ const onDragMove = function(event) {
14156
+ const e = currentDrag.matchesEvent(event);
14157
+ if (e)
14158
+ {
14159
+ onChange(e);
14160
+ }
14161
+ };
14162
+
14163
+ const onDragEnd = function(event) {
14164
+ const e = currentDrag.matchesEvent(event);
14165
+ if (e)
14166
+ {
14167
+ dot.setOpacity(idleOpacity);
14168
+ currentDrag.cleanup();
14169
+ onChange(e);
14170
+ onEnd();
14171
+ }
14172
+ };
14173
+
14174
+ const startDrag = function(matchesEvent, cleanupHandlers) {
14175
+ if (currentDrag) {
14176
+ currentDrag.cleanup();
14177
+ }
14178
+
14179
+ dot.setOpacity(1.0);
14180
+ dot.setClickable(false);
14181
+ viewer.cameraControl.active = false;
14182
+
14183
+ currentDrag = {
14184
+ matchesEvent: matchesEvent,
14185
+ cleanup: function() {
14186
+ currentDrag = null;
14187
+ dot.setClickable(true);
14188
+ viewer.cameraControl.active = true;
14189
+ cleanupHandlers();
14190
+ }
14191
+ };
14192
+
14193
+ onStart();
14194
+ };
14195
+
14196
+ const dotCfg = { fillColor: color };
14197
+
14198
+ if (handleMouseEvents)
14199
+ {
14200
+ dotCfg.onMouseOver = () => (! currentDrag) && dot.setOpacity(1.0);
14201
+ dotCfg.onMouseLeave = () => (! currentDrag) && dot.setOpacity(idleOpacity);
14202
+ dotCfg.onMouseDown = event => {
14203
+ if (event.which === 1)
14204
+ {
14205
+ canvas.addEventListener("mousemove", onDragMove);
14206
+ canvas.addEventListener("mouseup", onDragEnd);
14207
+ startDrag(
14208
+ event => (event.which === 1) && event,
14209
+ () => {
14210
+ canvas.removeEventListener("mousemove", onDragMove);
14211
+ canvas.removeEventListener("mouseup", onDragEnd);
14212
+ });
14213
+ }
14214
+ };
14215
+ }
14216
+
14217
+ if (handleTouchEvents)
14218
+ {
14219
+ let touchStartId;
14220
+ dotCfg.onTouchstart = event => {
14221
+ event.preventDefault();
14222
+ if (event.touches.length === 1)
14223
+ {
14224
+ touchStartId = event.touches[0].identifier;
14225
+ startDrag(
14226
+ event => [...event.changedTouches].find(e => e.identifier === touchStartId),
14227
+ () => { touchStartId = null; });
14228
+ }
14229
+ };
14230
+ dotCfg.onTouchmove = event => {
14231
+ event.preventDefault();
14232
+ onDragMove(event);
14233
+ };
14234
+ dotCfg.onTouchend = event => {
14235
+ event.preventDefault();
14236
+ onDragEnd(event);
14237
+ };
14238
+ }
14239
+
14240
+ const dotParent = canvas.ownerDocument.body;
14241
+ const dot = new Dot(dotParent, dotCfg);
14242
+
14243
+ const idleOpacity = 0.5;
14244
+ dot.setOpacity(idleOpacity);
14245
+
14246
+ const updateDotPos = function() {
14247
+ const pos = marker.canvasPos.slice();
14248
+ transformToNode(canvas, dotParent, pos);
14249
+ dot.setPos(pos[0], pos[1]);
14250
+ };
14251
+
14252
+ marker.worldPos = worldPos;
14253
+ updateDotPos();
14254
+
14255
+ const onViewMatrix = scene.camera.on("viewMatrix", updateDotPos);
14256
+ const onProjMatrix = scene.camera.on("projMatrix", updateDotPos);
14257
+
14258
+ return {
14259
+ setActive: value => dot.setClickable(value),
14260
+ getWorldPos: () => marker.worldPos,
14261
+ setWorldPos: pos => { marker.worldPos = pos; updateDotPos(); },
14262
+ destroy: function() {
14263
+ currentDrag && currentDrag.cleanup();
14264
+ scene.camera.off(onViewMatrix);
14265
+ scene.camera.off(onProjMatrix);
14266
+ marker.destroy();
14267
+ dot.destroy();
14268
+ }
14269
+ };
14270
+ }
14271
+ function activateDraggableDots(cfg) {
14272
+ const extractCFG = function(propName, defaultValue) {
14273
+ if (propName in cfg) {
14274
+ return cfg[propName];
14275
+ } else if (defaultValue !== undefined) {
14276
+ return defaultValue;
14277
+ } else {
14278
+ throw "config missing: " + propName;
14279
+ }
14280
+ };
14281
+
14282
+ const viewer = extractCFG("viewer");
14283
+ const handleMouseEvents = extractCFG("handleMouseEvents", false);
14284
+ const handleTouchEvents = extractCFG("handleTouchEvents", false);
14285
+ const snapping = extractCFG("snapping");
14286
+ const pointerLens = extractCFG("pointerLens", null);
14287
+ const color = extractCFG("color");
14288
+ const markers = extractCFG("markers");
14289
+ const onEdit = extractCFG("onEdit", nop);
14290
+
14291
+ const updatePointerLens = (pointerLens
14292
+ ? function(canvasPos) {
14293
+ pointerLens.visible = !! canvasPos;
14294
+ if (canvasPos)
14295
+ {
14296
+ pointerLens.canvasPos = canvasPos;
14297
+ }
14298
+ }
14299
+ : () => { });
14300
+
14301
+ const dots = markers.map(marker => {
14302
+ let initDotPos, initMarkerPos;
14303
+ const setCoord = coord => marker.worldPos = coord;
14304
+
14305
+ const dot = createDraggableDot3D({
14306
+ handleMouseEvents: handleMouseEvents,
14307
+ handleTouchEvents: handleTouchEvents,
14308
+ viewer: viewer,
14309
+ worldPos: marker.worldPos,
14310
+ color: color,
14311
+ ray2WorldPos: (orig, dir, canvasPos) => {
14312
+ const tryPickWorldPos = snap => {
14313
+ const pickResult = viewer.scene.pick({
14314
+ canvasPos: canvasPos,
14315
+ snapToEdge: snap,
14316
+ snapToVertex: snap,
14317
+ pickSurface: true // <<------ This causes picking to find the intersection point on the entity
14318
+ });
14319
+
14320
+ // If - when snapping - no pick found, then try w/o snapping
14321
+ return (pickResult && pickResult.worldPos) ? pickResult.worldPos : (snap && tryPickWorldPos(false));
14322
+ };
14323
+
14324
+ return tryPickWorldPos(!!snapping) || initDotPos;
14325
+ },
14326
+ onStart: () => {
14327
+ initDotPos = dot.getWorldPos().slice();
14328
+ initMarkerPos = marker.worldPos.slice();
14329
+ setOtherDotsActive(false, dot);
14330
+ },
14331
+ onMove: (canvasPos, worldPos) => {
14332
+ updatePointerLens(canvasPos);
14333
+ setCoord(worldPos);
14334
+ },
14335
+ onEnd: () => {
14336
+ if (! math.compareVec3(initMarkerPos, marker.worldPos))
14337
+ {
14338
+ onEdit();
14339
+ }
14340
+ else
14341
+ {
14342
+ dot.setWorldPos(initDotPos);
14343
+ setCoord(initMarkerPos);
14344
+ }
14345
+ updatePointerLens(null);
14346
+ setOtherDotsActive(true, dot);
14347
+ }
14348
+ });
14349
+ return dot;
14350
+ });
14351
+
14352
+ const setOtherDotsActive = (active, dot) => dots.forEach(d => (d !== dot) && d.setActive(active));
14353
+ setOtherDotsActive(true);
14354
+
14355
+ return function() {
14356
+ dots.forEach(m => m.destroy());
14357
+ updatePointerLens(null);
14358
+ };
14359
+ }
14360
+
14361
+ class AngleMeasurementEditControl extends Component {
14362
+
14363
+ /**
14364
+ * Edits {@link AngleMeasurement} with mouse and/or touch input.
14365
+ *
14366
+ * @param {AngleMeasurement} [measurement] The AngleMeasurement to edit.
14367
+ * @param [cfg] Configuration
14368
+ * @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor.
14369
+ * @param {boolean} [cfg.snapping] Whether to enable snap-to-vertex and snap-to-edge.
14370
+ * @param {boolean} [handleMouseEvents] Whether to hangle mouse input.
14371
+ * @param {boolean} [handleTouchEvents] Whether to hangle touch input.
14372
+ */
14373
+ constructor(measurement, cfg, handleMouseEvents, handleTouchEvents) {
14374
+
14375
+ const viewer = measurement.plugin.viewer;
14376
+
14377
+ super(viewer.scene);
14378
+
14379
+ const cleanup = activateDraggableDots({
14380
+ viewer: viewer,
14381
+ handleMouseEvents: handleMouseEvents,
14382
+ handleTouchEvents: handleTouchEvents,
14383
+ snapping: cfg.snapping,
14384
+ pointerLens: cfg.pointerLens,
14385
+ color: measurement.color,
14386
+ markers: [ measurement.origin, measurement.corner, measurement.target ],
14387
+ onEdit: () => this.fire("edited")
14388
+ });
14389
+
14390
+ const destroyCb = measurement.on("destroyed", cleanup);
14391
+
14392
+ this._deactivate = function() {
14393
+ measurement.off("destroyed", destroyCb);
14394
+ cleanup();
14395
+ };
14396
+ }
14397
+
14398
+ deactivate() {
14399
+ this._deactivate();
14400
+ super.destroy();
14401
+ }
14402
+ }
14403
+
14404
+ class AngleMeasurementEditMouseControl extends AngleMeasurementEditControl {
14405
+ constructor(zone, cfg) {
14406
+ super(zone, cfg, true, false);
14407
+ }
14408
+ }
14409
+
14410
+ class AngleMeasurementEditTouchControl extends AngleMeasurementEditControl {
14411
+ constructor(zone, cfg) {
14412
+ super(zone, cfg, false, true);
14413
+ }
14414
+ }
14415
+
14102
14416
  /**
14103
14417
  * A {@link Marker} with an HTML label attached to it, managed by an {@link AnnotationsPlugin}.
14104
14418
  *
@@ -89359,6 +89673,61 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
89359
89673
  }
89360
89674
  }
89361
89675
 
89676
+ class DistanceMeasurementEditControl extends Component {
89677
+
89678
+ /**
89679
+ * Edits {@link DistanceMeasurement} with mouse and/or touch input.
89680
+ *
89681
+ * @param {DistanceMeasurement} [measurement] The DistanceMeasurement to edit.
89682
+ * @param [cfg] Configuration
89683
+ * @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor.
89684
+ * @param {boolean} [cfg.snapping] Whether to enable snap-to-vertex and snap-to-edge.
89685
+ * @param {boolean} [handleMouseEvents] Whether to hangle mouse input.
89686
+ * @param {boolean} [handleTouchEvents] Whether to hangle touch input.
89687
+ */
89688
+ constructor(measurement, cfg, handleMouseEvents, handleTouchEvents) {
89689
+
89690
+ const viewer = measurement.plugin.viewer;
89691
+
89692
+ super(viewer.scene);
89693
+
89694
+ const cleanup = activateDraggableDots({
89695
+ viewer: viewer,
89696
+ handleMouseEvents: handleMouseEvents,
89697
+ handleTouchEvents: handleTouchEvents,
89698
+ snapping: cfg.snapping,
89699
+ pointerLens: cfg.pointerLens,
89700
+ color: measurement.color,
89701
+ markers: [ measurement.origin, measurement.target ],
89702
+ onEdit: () => this.fire("edited")
89703
+ });
89704
+
89705
+ const destroyCb = measurement.on("destroyed", cleanup);
89706
+
89707
+ this._deactivate = function() {
89708
+ measurement.off("destroyed", destroyCb);
89709
+ cleanup();
89710
+ };
89711
+ }
89712
+
89713
+ deactivate() {
89714
+ this._deactivate();
89715
+ super.destroy();
89716
+ }
89717
+ }
89718
+
89719
+ class DistanceMeasurementEditMouseControl extends DistanceMeasurementEditControl {
89720
+ constructor(zone, cfg) {
89721
+ super(zone, cfg, true, false);
89722
+ }
89723
+ }
89724
+
89725
+ class DistanceMeasurementEditTouchControl extends DistanceMeasurementEditControl {
89726
+ constructor(zone, cfg) {
89727
+ super(zone, cfg, false, true);
89728
+ }
89729
+ }
89730
+
89362
89731
  /**
89363
89732
  * {@link Viewer} plugin that makes interaction smoother with large models, by temporarily switching
89364
89733
  * the Viewer to faster, lower-quality rendering modes whenever we interact.
@@ -99453,7 +99822,11 @@ class PropertySet {
99453
99822
  const properties = params.properties;
99454
99823
  for (let i = 0, len = properties.length; i < len; i++) {
99455
99824
  const property = properties[i];
99456
- this.properties.push(new Property(property.name, property.value, property.type, property.valueType, property.description));
99825
+ if (Number.isInteger(property)) { // Will decompress in MetaModel.finalize();
99826
+ this.properties.push(property);
99827
+ } else {
99828
+ this.properties.push(new Property(property.name, property.value, property.type, property.valueType, property.description));
99829
+ }
99457
99830
  }
99458
99831
  }
99459
99832
  }
@@ -99817,6 +100190,8 @@ class MetaModel {
99817
100190
 
99818
100191
  this.metaScene.metaModels[this.id] = this;
99819
100192
 
100193
+ this._propertyLookup = [];
100194
+
99820
100195
  /**
99821
100196
  * True when this MetaModel has been finalized.
99822
100197
  * @type {boolean}
@@ -99831,7 +100206,7 @@ class MetaModel {
99831
100206
  * @type {MetaObject|null}
99832
100207
  */
99833
100208
  get rootMetaObject() {
99834
- if (this.rootMetaObjects.length == 1) {
100209
+ if (this.rootMetaObjects.length === 1) {
99835
100210
  return this.rootMetaObjects[0];
99836
100211
  }
99837
100212
  return null;
@@ -99852,6 +100227,12 @@ class MetaModel {
99852
100227
  const metaScene = this.metaScene;
99853
100228
  const propertyLookup = metaModelData.properties;
99854
100229
 
100230
+ if (propertyLookup) {
100231
+ for (let i = 0, len = propertyLookup.length; i < len; i++) {
100232
+ this._propertyLookup.push(propertyLookup[i]);
100233
+ }
100234
+ }
100235
+
99855
100236
  // Create global Property Sets
99856
100237
 
99857
100238
  if (metaModelData.propertySets) {
@@ -99862,9 +100243,6 @@ class MetaModel {
99862
100243
  }
99863
100244
  let propertySet = metaScene.propertySets[propertySetData.id];
99864
100245
  if (!propertySet) {
99865
- if (propertyLookup) {
99866
- this._decompressProperties(propertyLookup, propertySetData.properties);
99867
- }
99868
100246
  propertySet = new PropertySet({
99869
100247
  id: propertySetData.id,
99870
100248
  originalSystemId: propertySetData.originalSystemId || propertySetData.id,
@@ -99911,15 +100289,21 @@ class MetaModel {
99911
100289
  }
99912
100290
 
99913
100291
  _decompressProperties(propertyLookup, properties) {
100292
+ const propsNotFound = [];
99914
100293
  for (let i = 0, len = properties.length; i < len; i++) {
99915
100294
  const property = properties[i];
99916
100295
  if (Number.isInteger(property)) {
99917
100296
  const lookupProperty = propertyLookup[property];
99918
100297
  if (lookupProperty) {
99919
100298
  properties[i] = lookupProperty;
100299
+ } else {
100300
+ propsNotFound.push(property);
99920
100301
  }
99921
100302
  }
99922
100303
  }
100304
+ if (propsNotFound.length > 0) {
100305
+ console.error(`[MetaModel._decompressProperties] Properties not found: ${propsNotFound}`);
100306
+ }
99923
100307
  }
99924
100308
 
99925
100309
  finalize() {
@@ -99987,6 +100371,18 @@ class MetaModel {
99987
100371
  (metaScene.metaObjectsByType[type] || (metaScene.metaObjectsByType[type] = {}))[objectId] = metaObject;
99988
100372
  }
99989
100373
 
100374
+ // Decompress properties
100375
+
100376
+ if (this.propertySets) {
100377
+ for (let i = 0, len = this.propertySets.length; i < len; i++) {
100378
+ const propertySet = this.propertySets[i];
100379
+ this._decompressProperties(this._propertyLookup, propertySet.properties);
100380
+ }
100381
+ }
100382
+
100383
+
100384
+ this._propertyLookup = [];
100385
+
99990
100386
  this.finalized = true;
99991
100387
 
99992
100388
  this.metaScene.fire("metaModelCreated", this.id);
@@ -137904,13 +138300,6 @@ const hex2rgb = function(color) {
137904
138300
  return [ rgb(0), rgb(2), rgb(4) ];
137905
138301
  };
137906
138302
 
137907
- const transformToNode = function(from, to, vec) {
137908
- const fromRec = from.getBoundingClientRect();
137909
- const toRec = to.getBoundingClientRect();
137910
- vec[0] += fromRec.left - toRec.left;
137911
- vec[1] += fromRec.top - toRec.top;
137912
- };
137913
-
137914
138303
  const triangulateEarClipping = function(planeCoords) {
137915
138304
 
137916
138305
  const polygonVertices = [ ];
@@ -138013,148 +138402,6 @@ const triangulateEarClipping = function(planeCoords) {
138013
138402
  return [ planeCoords, baseTriangles ];
138014
138403
  };
138015
138404
 
138016
- const draggableDot3D = function(handleMouseEvents, handleTouchEvents, viewer, worldPos, color, ray2WorldPos, onStart, onMove, onEnd) {
138017
- const scene = viewer.scene;
138018
- const canvas = scene.canvas.canvas;
138019
-
138020
- const marker = new Marker(scene, {});
138021
-
138022
- const pickWorldPos = canvasPos => {
138023
- const origin = math.vec3();
138024
- const direction = math.vec3();
138025
- math.canvasPosToWorldRay(canvas, scene.camera.viewMatrix, scene.camera.projMatrix, canvasPos, origin, direction);
138026
- return ray2WorldPos(origin, direction);
138027
- };
138028
-
138029
- const onChange = event => {
138030
- const canvasPos = math.vec2([ event.clientX, event.clientY ]);
138031
- transformToNode(canvas.ownerDocument.body, canvas, canvasPos);
138032
-
138033
- const worldPos = pickWorldPos(canvasPos);
138034
- marker.worldPos = worldPos;
138035
- updateDotPos();
138036
- onMove(canvasPos, worldPos);
138037
- };
138038
-
138039
- let currentDrag = null;
138040
-
138041
- const onDragMove = function(event) {
138042
- const e = currentDrag.matchesEvent(event);
138043
- if (e)
138044
- {
138045
- onChange(e);
138046
- }
138047
- };
138048
-
138049
- const onDragEnd = function(event) {
138050
- const e = currentDrag.matchesEvent(event);
138051
- if (e)
138052
- {
138053
- dot.setOpacity(idleOpacity);
138054
- currentDrag.cleanup();
138055
- onChange(e);
138056
- onEnd();
138057
- }
138058
- };
138059
-
138060
- const startDrag = function(matchesEvent, cleanupHandlers) {
138061
- if (currentDrag) {
138062
- currentDrag.cleanup();
138063
- }
138064
-
138065
- dot.setOpacity(1.0);
138066
- dot.setClickable(false);
138067
- viewer.cameraControl.active = false;
138068
-
138069
- currentDrag = {
138070
- matchesEvent: matchesEvent,
138071
- cleanup: function() {
138072
- currentDrag = null;
138073
- dot.setClickable(true);
138074
- viewer.cameraControl.active = true;
138075
- cleanupHandlers();
138076
- }
138077
- };
138078
-
138079
- onStart();
138080
- };
138081
-
138082
- const dotCfg = { fillColor: color };
138083
-
138084
- if (handleMouseEvents)
138085
- {
138086
- dotCfg.onMouseOver = () => (! currentDrag) && dot.setOpacity(1.0);
138087
- dotCfg.onMouseLeave = () => (! currentDrag) && dot.setOpacity(idleOpacity);
138088
- dotCfg.onMouseDown = event => {
138089
- if (event.which === 1)
138090
- {
138091
- canvas.addEventListener("mousemove", onDragMove);
138092
- canvas.addEventListener("mouseup", onDragEnd);
138093
- startDrag(
138094
- event => (event.which === 1) && event,
138095
- () => {
138096
- canvas.removeEventListener("mousemove", onDragMove);
138097
- canvas.removeEventListener("mouseup", onDragEnd);
138098
- });
138099
- }
138100
- };
138101
- }
138102
-
138103
- if (handleTouchEvents)
138104
- {
138105
- let touchStartId;
138106
- dotCfg.onTouchstart = event => {
138107
- event.preventDefault();
138108
- if (event.touches.length === 1)
138109
- {
138110
- touchStartId = event.touches[0].identifier;
138111
- startDrag(
138112
- event => [...event.changedTouches].find(e => e.identifier === touchStartId),
138113
- () => { touchStartId = null; });
138114
- }
138115
- };
138116
- dotCfg.onTouchmove = event => {
138117
- event.preventDefault();
138118
- onDragMove(event);
138119
- };
138120
- dotCfg.onTouchend = event => {
138121
- event.preventDefault();
138122
- onDragEnd(event);
138123
- };
138124
- }
138125
-
138126
- const dotParent = canvas.ownerDocument.body;
138127
- const dot = new Dot(dotParent, dotCfg);
138128
-
138129
- const idleOpacity = 0.5;
138130
- dot.setOpacity(idleOpacity);
138131
-
138132
- const updateDotPos = function() {
138133
- const pos = marker.canvasPos.slice();
138134
- transformToNode(canvas, dotParent, pos);
138135
- dot.setPos(pos[0], pos[1]);
138136
- };
138137
-
138138
- marker.worldPos = worldPos;
138139
- updateDotPos();
138140
-
138141
- const onViewMatrix = scene.camera.on("viewMatrix", updateDotPos);
138142
- const onProjMatrix = scene.camera.on("projMatrix", updateDotPos);
138143
-
138144
- return {
138145
- setActive: value => dot.setClickable(value),
138146
- getWorldPos: () => marker.worldPos,
138147
- setWorldPos: pos => { marker.worldPos = pos; updateDotPos(); },
138148
- destroy: function() {
138149
- currentDrag && currentDrag.cleanup();
138150
- scene.camera.off(onViewMatrix);
138151
- scene.camera.off(onProjMatrix);
138152
- marker.destroy();
138153
- dot.destroy();
138154
- }
138155
- };
138156
- };
138157
-
138158
138405
  const marker3D = function(scene, color) {
138159
138406
  const canvas = scene.canvas.canvas;
138160
138407
 
@@ -139655,23 +139902,23 @@ class ZoneEditControl extends Component {
139655
139902
  }
139656
139903
  };
139657
139904
 
139658
- const dot = draggableDot3D(
139659
- handleMouseEvents,
139660
- handleTouchEvents,
139661
- zone.plugin.viewer,
139662
- math.vec3([ planeCoord[0], altitude, planeCoord[1] ]),
139663
- zone._color,
139664
- (orig, dir) => planeIntersect(altitude, math.vec3([ 0, 1, 0 ]), orig, dir),
139665
- () => {
139905
+ const dot = createDraggableDot3D({
139906
+ handleMouseEvents: handleMouseEvents,
139907
+ handleTouchEvents: handleTouchEvents,
139908
+ viewer: zone.plugin.viewer,
139909
+ worldPos: math.vec3([ planeCoord[0], altitude, planeCoord[1] ]),
139910
+ color: zone._color,
139911
+ ray2WorldPos: (orig, dir) => planeIntersect(altitude, math.vec3([ 0, 1, 0 ]), orig, dir),
139912
+ onStart: () => {
139666
139913
  initWorldPos = dot.getWorldPos().slice();
139667
139914
  initPlaneCoord = planeCoord.slice();
139668
139915
  set_other_dots_active(false, dot);
139669
139916
  },
139670
- (canvasPos, worldPos) => {
139917
+ onMove: (canvasPos, worldPos) => {
139671
139918
  updatePointerLens(canvasPos);
139672
139919
  setPlaneCoord([ worldPos[0], worldPos[2] ]);
139673
139920
  },
139674
- () => {
139921
+ onEnd: () => {
139675
139922
  if (zone._zoneMesh)
139676
139923
  {
139677
139924
  self.fire("edited");
@@ -139683,7 +139930,8 @@ class ZoneEditControl extends Component {
139683
139930
  }
139684
139931
  updatePointerLens(null);
139685
139932
  set_other_dots_active(true, dot);
139686
- });
139933
+ }
139934
+ });
139687
139935
  return dot;
139688
139936
  });
139689
139937
  const set_other_dots_active = (active, dot) => dots.forEach(d => (d !== dot) && d.setActive(active));
@@ -139906,4 +140154,4 @@ class ZoneTranslateTouchControl extends ZoneTranslateControl {
139906
140154
  }
139907
140155
  }
139908
140156
 
139909
- export { AlphaFormat, AmbientLight, AngleMeasurementsControl, AngleMeasurementsMouseControl, AngleMeasurementsPlugin, AngleMeasurementsTouchControl, AnnotationsPlugin, AxisGizmoPlugin, BCFViewpointsPlugin, Bitmap, ByteType, CameraMemento, CameraPath, CameraPathAnimation, CityJSONLoaderPlugin, ClampToEdgeWrapping, Component, CompressedMediaType, Configs, ContextMenu, CubicBezierCurve, Curve, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DirLight, DistanceMeasurementsControl, DistanceMeasurementsMouseControl, DistanceMeasurementsPlugin, DistanceMeasurementsTouchControl, DotBIMDefaultDataSource, DotBIMLoaderPlugin, EdgeMaterial, EmphasisMaterial, FaceAlignedSectionPlanesPlugin, FastNavPlugin, FloatType, Fresnel, Frustum$1 as Frustum, FrustumPlane, GIFMediaType, GLTFDefaultDataSource, GLTFLoaderPlugin, HalfFloatType, ImagePlane, IntType, JPEGMediaType, KTX2TextureTranscoder, LASLoaderPlugin, LambertMaterial, LightMap, LineSet, LinearEncoding, LinearFilter, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, Loader, LoadingManager, LocaleService, LuminanceAlphaFormat, LuminanceFormat, Map$1 as Map, Marker, MarqueePicker, MarqueePickerMouseControl, Mesh, MetallicMaterial, MirroredRepeatWrapping, ModelMemento, NavCubePlugin, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, Node$2 as Node, OBJLoaderPlugin, ObjectsKdTree3, ObjectsMemento, PNGMediaType, Path, PerformanceModel, PhongMaterial, PickResult, Plugin, PointLight, PointerCircle, PointerLens, QuadraticBezierCurve, Queue, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, ReadableGeometry, RedFormat, RedIntegerFormat, ReflectionMap, RepeatWrapping, STLDefaultDataSource, STLLoaderPlugin, SceneModel, SceneModelMesh, SceneModelTransform, SectionPlane, SectionPlanesPlugin, ShortType, Skybox, SkyboxesPlugin, SpecularMaterial, SplineCurve, SpriteMarker, StoreyViewsPlugin, Texture, TextureTranscoder, TreeViewPlugin, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VBOGeometry, ViewCullPlugin, Viewer, WebIFCLoaderPlugin, WorkerPool$1 as WorkerPool, XKTDefaultDataSource, XKTLoaderPlugin, XML3DLoaderPlugin, ZoneEditControl, ZoneEditMouseControl, ZoneEditTouchControl, ZoneTranslateControl, ZoneTranslateMouseControl, ZoneTranslateTouchControl, ZonesMouseControl, ZonesPlugin, ZonesPolysurfaceMouseControl, ZonesPolysurfaceTouchControl, ZonesTouchControl, buildBoxGeometry, buildBoxLinesGeometry, buildBoxLinesGeometryFromAABB, buildCylinderGeometry, buildGridGeometry, buildPlaneGeometry, buildPolylineGeometry, buildPolylineGeometryFromCurve, buildSphereGeometry, buildTorusGeometry, buildVectorTextGeometry, createRTCViewMat, frustumIntersectsAABB3, getKTX2TextureTranscoder, getPlaneRTCPos, load3DSGeometry, loadOBJGeometry, math, rtcToWorldPos, sRGBEncoding, setFrustum, stats, utils, worldToRTCPos, worldToRTCPositions };
140157
+ export { AlphaFormat, AmbientLight, AngleMeasurementEditMouseControl, AngleMeasurementEditTouchControl, AngleMeasurementsControl, AngleMeasurementsMouseControl, AngleMeasurementsPlugin, AngleMeasurementsTouchControl, AnnotationsPlugin, AxisGizmoPlugin, BCFViewpointsPlugin, Bitmap, ByteType, CameraMemento, CameraPath, CameraPathAnimation, CityJSONLoaderPlugin, ClampToEdgeWrapping, Component, CompressedMediaType, Configs, ContextMenu, CubicBezierCurve, Curve, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DirLight, DistanceMeasurementEditMouseControl, DistanceMeasurementEditTouchControl, DistanceMeasurementsControl, DistanceMeasurementsMouseControl, DistanceMeasurementsPlugin, DistanceMeasurementsTouchControl, DotBIMDefaultDataSource, DotBIMLoaderPlugin, EdgeMaterial, EmphasisMaterial, FaceAlignedSectionPlanesPlugin, FastNavPlugin, FloatType, Fresnel, Frustum$1 as Frustum, FrustumPlane, GIFMediaType, GLTFDefaultDataSource, GLTFLoaderPlugin, HalfFloatType, ImagePlane, IntType, JPEGMediaType, KTX2TextureTranscoder, LASLoaderPlugin, LambertMaterial, LightMap, LineSet, LinearEncoding, LinearFilter, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, Loader, LoadingManager, LocaleService, LuminanceAlphaFormat, LuminanceFormat, Map$1 as Map, Marker, MarqueePicker, MarqueePickerMouseControl, Mesh, MetallicMaterial, MirroredRepeatWrapping, ModelMemento, NavCubePlugin, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, Node$2 as Node, OBJLoaderPlugin, ObjectsKdTree3, ObjectsMemento, PNGMediaType, Path, PerformanceModel, PhongMaterial, PickResult, Plugin, PointLight, PointerCircle, PointerLens, QuadraticBezierCurve, Queue, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, ReadableGeometry, RedFormat, RedIntegerFormat, ReflectionMap, RepeatWrapping, STLDefaultDataSource, STLLoaderPlugin, SceneModel, SceneModelMesh, SceneModelTransform, SectionPlane, SectionPlanesPlugin, ShortType, Skybox, SkyboxesPlugin, SpecularMaterial, SplineCurve, SpriteMarker, StoreyViewsPlugin, Texture, TextureTranscoder, TreeViewPlugin, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VBOGeometry, ViewCullPlugin, Viewer, WebIFCLoaderPlugin, WorkerPool$1 as WorkerPool, XKTDefaultDataSource, XKTLoaderPlugin, XML3DLoaderPlugin, ZoneEditControl, ZoneEditMouseControl, ZoneEditTouchControl, ZoneTranslateControl, ZoneTranslateMouseControl, ZoneTranslateTouchControl, ZonesMouseControl, ZonesPlugin, ZonesPolysurfaceMouseControl, ZonesPolysurfaceTouchControl, ZonesTouchControl, buildBoxGeometry, buildBoxLinesGeometry, buildBoxLinesGeometryFromAABB, buildCylinderGeometry, buildGridGeometry, buildPlaneGeometry, buildPolylineGeometry, buildPolylineGeometryFromCurve, buildSphereGeometry, buildTorusGeometry, buildVectorTextGeometry, createRTCViewMat, frustumIntersectsAABB3, getKTX2TextureTranscoder, getPlaneRTCPos, load3DSGeometry, loadOBJGeometry, math, rtcToWorldPos, sRGBEncoding, setFrustum, stats, utils, worldToRTCPos, worldToRTCPositions };