@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.
- package/dist/xeokit-sdk.cjs.js +419 -167
- package/dist/xeokit-sdk.es.js +416 -168
- package/dist/xeokit-sdk.es5.js +743 -721
- package/dist/xeokit-sdk.min.cjs.js +5 -5
- package/dist/xeokit-sdk.min.es.js +5 -5
- package/dist/xeokit-sdk.min.es5.js +4 -4
- package/package.json +1 -1
- package/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js +2 -2
- package/src/plugins/AngleMeasurementsPlugin/index.js +59 -1
- package/src/plugins/DistanceMeasurementsPlugin/index.js +59 -1
- package/src/plugins/ZonesPlugin/index.js +13 -160
- package/src/plugins/lib/ui/index.js +264 -0
- package/src/viewer/metadata/MetaModel.js +27 -4
- package/src/viewer/metadata/PropertySet.js +5 -1
package/dist/xeokit-sdk.cjs.js
CHANGED
|
@@ -12386,10 +12386,10 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
12386
12386
|
}
|
|
12387
12387
|
|
|
12388
12388
|
_destroyMarkerDiv() {
|
|
12389
|
-
if (this.
|
|
12389
|
+
if (this.markerDiv) {
|
|
12390
12390
|
const element = document.getElementById('myMarkerDiv');
|
|
12391
12391
|
element.parentNode.removeChild(element);
|
|
12392
|
-
this.
|
|
12392
|
+
this.markerDiv = null;
|
|
12393
12393
|
}
|
|
12394
12394
|
}
|
|
12395
12395
|
|
|
@@ -14103,6 +14103,320 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
14103
14103
|
}
|
|
14104
14104
|
}
|
|
14105
14105
|
|
|
14106
|
+
const nop = () => { };
|
|
14107
|
+
|
|
14108
|
+
function transformToNode(from, to, vec) {
|
|
14109
|
+
const fromRec = from.getBoundingClientRect();
|
|
14110
|
+
const toRec = to.getBoundingClientRect();
|
|
14111
|
+
vec[0] += fromRec.left - toRec.left;
|
|
14112
|
+
vec[1] += fromRec.top - toRec.top;
|
|
14113
|
+
}
|
|
14114
|
+
function createDraggableDot3D(cfg) {
|
|
14115
|
+
const extractCFG = function(propName, defaultValue) {
|
|
14116
|
+
if (propName in cfg) {
|
|
14117
|
+
return cfg[propName];
|
|
14118
|
+
} else if (defaultValue !== undefined) {
|
|
14119
|
+
return defaultValue;
|
|
14120
|
+
} else {
|
|
14121
|
+
throw "config missing: " + propName;
|
|
14122
|
+
}
|
|
14123
|
+
};
|
|
14124
|
+
|
|
14125
|
+
const viewer = extractCFG("viewer");
|
|
14126
|
+
const worldPos = extractCFG("worldPos");
|
|
14127
|
+
const color = extractCFG("color");
|
|
14128
|
+
const ray2WorldPos = extractCFG("ray2WorldPos");
|
|
14129
|
+
const handleMouseEvents = extractCFG("handleMouseEvents", false);
|
|
14130
|
+
const handleTouchEvents = extractCFG("handleTouchEvents", false);
|
|
14131
|
+
const onStart = extractCFG("onStart", nop);
|
|
14132
|
+
const onMove = extractCFG("onMove", nop);
|
|
14133
|
+
const onEnd = extractCFG("onEnd", nop);
|
|
14134
|
+
|
|
14135
|
+
const scene = viewer.scene;
|
|
14136
|
+
const canvas = scene.canvas.canvas;
|
|
14137
|
+
|
|
14138
|
+
const marker = new Marker(scene, {});
|
|
14139
|
+
|
|
14140
|
+
const pickWorldPos = canvasPos => {
|
|
14141
|
+
const origin = math.vec3();
|
|
14142
|
+
const direction = math.vec3();
|
|
14143
|
+
math.canvasPosToWorldRay(canvas, scene.camera.viewMatrix, scene.camera.projMatrix, canvasPos, origin, direction);
|
|
14144
|
+
return ray2WorldPos(origin, direction, canvasPos);
|
|
14145
|
+
};
|
|
14146
|
+
|
|
14147
|
+
const onChange = event => {
|
|
14148
|
+
const canvasPos = math.vec2([ event.clientX, event.clientY ]);
|
|
14149
|
+
transformToNode(canvas.ownerDocument.body, canvas, canvasPos);
|
|
14150
|
+
|
|
14151
|
+
const worldPos = pickWorldPos(canvasPos);
|
|
14152
|
+
marker.worldPos = worldPos;
|
|
14153
|
+
updateDotPos();
|
|
14154
|
+
onMove(canvasPos, worldPos);
|
|
14155
|
+
};
|
|
14156
|
+
|
|
14157
|
+
let currentDrag = null;
|
|
14158
|
+
|
|
14159
|
+
const onDragMove = function(event) {
|
|
14160
|
+
const e = currentDrag.matchesEvent(event);
|
|
14161
|
+
if (e)
|
|
14162
|
+
{
|
|
14163
|
+
onChange(e);
|
|
14164
|
+
}
|
|
14165
|
+
};
|
|
14166
|
+
|
|
14167
|
+
const onDragEnd = function(event) {
|
|
14168
|
+
const e = currentDrag.matchesEvent(event);
|
|
14169
|
+
if (e)
|
|
14170
|
+
{
|
|
14171
|
+
dot.setOpacity(idleOpacity);
|
|
14172
|
+
currentDrag.cleanup();
|
|
14173
|
+
onChange(e);
|
|
14174
|
+
onEnd();
|
|
14175
|
+
}
|
|
14176
|
+
};
|
|
14177
|
+
|
|
14178
|
+
const startDrag = function(matchesEvent, cleanupHandlers) {
|
|
14179
|
+
if (currentDrag) {
|
|
14180
|
+
currentDrag.cleanup();
|
|
14181
|
+
}
|
|
14182
|
+
|
|
14183
|
+
dot.setOpacity(1.0);
|
|
14184
|
+
dot.setClickable(false);
|
|
14185
|
+
viewer.cameraControl.active = false;
|
|
14186
|
+
|
|
14187
|
+
currentDrag = {
|
|
14188
|
+
matchesEvent: matchesEvent,
|
|
14189
|
+
cleanup: function() {
|
|
14190
|
+
currentDrag = null;
|
|
14191
|
+
dot.setClickable(true);
|
|
14192
|
+
viewer.cameraControl.active = true;
|
|
14193
|
+
cleanupHandlers();
|
|
14194
|
+
}
|
|
14195
|
+
};
|
|
14196
|
+
|
|
14197
|
+
onStart();
|
|
14198
|
+
};
|
|
14199
|
+
|
|
14200
|
+
const dotCfg = { fillColor: color };
|
|
14201
|
+
|
|
14202
|
+
if (handleMouseEvents)
|
|
14203
|
+
{
|
|
14204
|
+
dotCfg.onMouseOver = () => (! currentDrag) && dot.setOpacity(1.0);
|
|
14205
|
+
dotCfg.onMouseLeave = () => (! currentDrag) && dot.setOpacity(idleOpacity);
|
|
14206
|
+
dotCfg.onMouseDown = event => {
|
|
14207
|
+
if (event.which === 1)
|
|
14208
|
+
{
|
|
14209
|
+
canvas.addEventListener("mousemove", onDragMove);
|
|
14210
|
+
canvas.addEventListener("mouseup", onDragEnd);
|
|
14211
|
+
startDrag(
|
|
14212
|
+
event => (event.which === 1) && event,
|
|
14213
|
+
() => {
|
|
14214
|
+
canvas.removeEventListener("mousemove", onDragMove);
|
|
14215
|
+
canvas.removeEventListener("mouseup", onDragEnd);
|
|
14216
|
+
});
|
|
14217
|
+
}
|
|
14218
|
+
};
|
|
14219
|
+
}
|
|
14220
|
+
|
|
14221
|
+
if (handleTouchEvents)
|
|
14222
|
+
{
|
|
14223
|
+
let touchStartId;
|
|
14224
|
+
dotCfg.onTouchstart = event => {
|
|
14225
|
+
event.preventDefault();
|
|
14226
|
+
if (event.touches.length === 1)
|
|
14227
|
+
{
|
|
14228
|
+
touchStartId = event.touches[0].identifier;
|
|
14229
|
+
startDrag(
|
|
14230
|
+
event => [...event.changedTouches].find(e => e.identifier === touchStartId),
|
|
14231
|
+
() => { touchStartId = null; });
|
|
14232
|
+
}
|
|
14233
|
+
};
|
|
14234
|
+
dotCfg.onTouchmove = event => {
|
|
14235
|
+
event.preventDefault();
|
|
14236
|
+
onDragMove(event);
|
|
14237
|
+
};
|
|
14238
|
+
dotCfg.onTouchend = event => {
|
|
14239
|
+
event.preventDefault();
|
|
14240
|
+
onDragEnd(event);
|
|
14241
|
+
};
|
|
14242
|
+
}
|
|
14243
|
+
|
|
14244
|
+
const dotParent = canvas.ownerDocument.body;
|
|
14245
|
+
const dot = new Dot(dotParent, dotCfg);
|
|
14246
|
+
|
|
14247
|
+
const idleOpacity = 0.5;
|
|
14248
|
+
dot.setOpacity(idleOpacity);
|
|
14249
|
+
|
|
14250
|
+
const updateDotPos = function() {
|
|
14251
|
+
const pos = marker.canvasPos.slice();
|
|
14252
|
+
transformToNode(canvas, dotParent, pos);
|
|
14253
|
+
dot.setPos(pos[0], pos[1]);
|
|
14254
|
+
};
|
|
14255
|
+
|
|
14256
|
+
marker.worldPos = worldPos;
|
|
14257
|
+
updateDotPos();
|
|
14258
|
+
|
|
14259
|
+
const onViewMatrix = scene.camera.on("viewMatrix", updateDotPos);
|
|
14260
|
+
const onProjMatrix = scene.camera.on("projMatrix", updateDotPos);
|
|
14261
|
+
|
|
14262
|
+
return {
|
|
14263
|
+
setActive: value => dot.setClickable(value),
|
|
14264
|
+
getWorldPos: () => marker.worldPos,
|
|
14265
|
+
setWorldPos: pos => { marker.worldPos = pos; updateDotPos(); },
|
|
14266
|
+
destroy: function() {
|
|
14267
|
+
currentDrag && currentDrag.cleanup();
|
|
14268
|
+
scene.camera.off(onViewMatrix);
|
|
14269
|
+
scene.camera.off(onProjMatrix);
|
|
14270
|
+
marker.destroy();
|
|
14271
|
+
dot.destroy();
|
|
14272
|
+
}
|
|
14273
|
+
};
|
|
14274
|
+
}
|
|
14275
|
+
function activateDraggableDots(cfg) {
|
|
14276
|
+
const extractCFG = function(propName, defaultValue) {
|
|
14277
|
+
if (propName in cfg) {
|
|
14278
|
+
return cfg[propName];
|
|
14279
|
+
} else if (defaultValue !== undefined) {
|
|
14280
|
+
return defaultValue;
|
|
14281
|
+
} else {
|
|
14282
|
+
throw "config missing: " + propName;
|
|
14283
|
+
}
|
|
14284
|
+
};
|
|
14285
|
+
|
|
14286
|
+
const viewer = extractCFG("viewer");
|
|
14287
|
+
const handleMouseEvents = extractCFG("handleMouseEvents", false);
|
|
14288
|
+
const handleTouchEvents = extractCFG("handleTouchEvents", false);
|
|
14289
|
+
const snapping = extractCFG("snapping");
|
|
14290
|
+
const pointerLens = extractCFG("pointerLens", null);
|
|
14291
|
+
const color = extractCFG("color");
|
|
14292
|
+
const markers = extractCFG("markers");
|
|
14293
|
+
const onEdit = extractCFG("onEdit", nop);
|
|
14294
|
+
|
|
14295
|
+
const updatePointerLens = (pointerLens
|
|
14296
|
+
? function(canvasPos) {
|
|
14297
|
+
pointerLens.visible = !! canvasPos;
|
|
14298
|
+
if (canvasPos)
|
|
14299
|
+
{
|
|
14300
|
+
pointerLens.canvasPos = canvasPos;
|
|
14301
|
+
}
|
|
14302
|
+
}
|
|
14303
|
+
: () => { });
|
|
14304
|
+
|
|
14305
|
+
const dots = markers.map(marker => {
|
|
14306
|
+
let initDotPos, initMarkerPos;
|
|
14307
|
+
const setCoord = coord => marker.worldPos = coord;
|
|
14308
|
+
|
|
14309
|
+
const dot = createDraggableDot3D({
|
|
14310
|
+
handleMouseEvents: handleMouseEvents,
|
|
14311
|
+
handleTouchEvents: handleTouchEvents,
|
|
14312
|
+
viewer: viewer,
|
|
14313
|
+
worldPos: marker.worldPos,
|
|
14314
|
+
color: color,
|
|
14315
|
+
ray2WorldPos: (orig, dir, canvasPos) => {
|
|
14316
|
+
const tryPickWorldPos = snap => {
|
|
14317
|
+
const pickResult = viewer.scene.pick({
|
|
14318
|
+
canvasPos: canvasPos,
|
|
14319
|
+
snapToEdge: snap,
|
|
14320
|
+
snapToVertex: snap,
|
|
14321
|
+
pickSurface: true // <<------ This causes picking to find the intersection point on the entity
|
|
14322
|
+
});
|
|
14323
|
+
|
|
14324
|
+
// If - when snapping - no pick found, then try w/o snapping
|
|
14325
|
+
return (pickResult && pickResult.worldPos) ? pickResult.worldPos : (snap && tryPickWorldPos(false));
|
|
14326
|
+
};
|
|
14327
|
+
|
|
14328
|
+
return tryPickWorldPos(!!snapping) || initDotPos;
|
|
14329
|
+
},
|
|
14330
|
+
onStart: () => {
|
|
14331
|
+
initDotPos = dot.getWorldPos().slice();
|
|
14332
|
+
initMarkerPos = marker.worldPos.slice();
|
|
14333
|
+
setOtherDotsActive(false, dot);
|
|
14334
|
+
},
|
|
14335
|
+
onMove: (canvasPos, worldPos) => {
|
|
14336
|
+
updatePointerLens(canvasPos);
|
|
14337
|
+
setCoord(worldPos);
|
|
14338
|
+
},
|
|
14339
|
+
onEnd: () => {
|
|
14340
|
+
if (! math.compareVec3(initMarkerPos, marker.worldPos))
|
|
14341
|
+
{
|
|
14342
|
+
onEdit();
|
|
14343
|
+
}
|
|
14344
|
+
else
|
|
14345
|
+
{
|
|
14346
|
+
dot.setWorldPos(initDotPos);
|
|
14347
|
+
setCoord(initMarkerPos);
|
|
14348
|
+
}
|
|
14349
|
+
updatePointerLens(null);
|
|
14350
|
+
setOtherDotsActive(true, dot);
|
|
14351
|
+
}
|
|
14352
|
+
});
|
|
14353
|
+
return dot;
|
|
14354
|
+
});
|
|
14355
|
+
|
|
14356
|
+
const setOtherDotsActive = (active, dot) => dots.forEach(d => (d !== dot) && d.setActive(active));
|
|
14357
|
+
setOtherDotsActive(true);
|
|
14358
|
+
|
|
14359
|
+
return function() {
|
|
14360
|
+
dots.forEach(m => m.destroy());
|
|
14361
|
+
updatePointerLens(null);
|
|
14362
|
+
};
|
|
14363
|
+
}
|
|
14364
|
+
|
|
14365
|
+
class AngleMeasurementEditControl extends Component {
|
|
14366
|
+
|
|
14367
|
+
/**
|
|
14368
|
+
* Edits {@link AngleMeasurement} with mouse and/or touch input.
|
|
14369
|
+
*
|
|
14370
|
+
* @param {AngleMeasurement} [measurement] The AngleMeasurement to edit.
|
|
14371
|
+
* @param [cfg] Configuration
|
|
14372
|
+
* @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor.
|
|
14373
|
+
* @param {boolean} [cfg.snapping] Whether to enable snap-to-vertex and snap-to-edge.
|
|
14374
|
+
* @param {boolean} [handleMouseEvents] Whether to hangle mouse input.
|
|
14375
|
+
* @param {boolean} [handleTouchEvents] Whether to hangle touch input.
|
|
14376
|
+
*/
|
|
14377
|
+
constructor(measurement, cfg, handleMouseEvents, handleTouchEvents) {
|
|
14378
|
+
|
|
14379
|
+
const viewer = measurement.plugin.viewer;
|
|
14380
|
+
|
|
14381
|
+
super(viewer.scene);
|
|
14382
|
+
|
|
14383
|
+
const cleanup = activateDraggableDots({
|
|
14384
|
+
viewer: viewer,
|
|
14385
|
+
handleMouseEvents: handleMouseEvents,
|
|
14386
|
+
handleTouchEvents: handleTouchEvents,
|
|
14387
|
+
snapping: cfg.snapping,
|
|
14388
|
+
pointerLens: cfg.pointerLens,
|
|
14389
|
+
color: measurement.color,
|
|
14390
|
+
markers: [ measurement.origin, measurement.corner, measurement.target ],
|
|
14391
|
+
onEdit: () => this.fire("edited")
|
|
14392
|
+
});
|
|
14393
|
+
|
|
14394
|
+
const destroyCb = measurement.on("destroyed", cleanup);
|
|
14395
|
+
|
|
14396
|
+
this._deactivate = function() {
|
|
14397
|
+
measurement.off("destroyed", destroyCb);
|
|
14398
|
+
cleanup();
|
|
14399
|
+
};
|
|
14400
|
+
}
|
|
14401
|
+
|
|
14402
|
+
deactivate() {
|
|
14403
|
+
this._deactivate();
|
|
14404
|
+
super.destroy();
|
|
14405
|
+
}
|
|
14406
|
+
}
|
|
14407
|
+
|
|
14408
|
+
class AngleMeasurementEditMouseControl extends AngleMeasurementEditControl {
|
|
14409
|
+
constructor(zone, cfg) {
|
|
14410
|
+
super(zone, cfg, true, false);
|
|
14411
|
+
}
|
|
14412
|
+
}
|
|
14413
|
+
|
|
14414
|
+
class AngleMeasurementEditTouchControl extends AngleMeasurementEditControl {
|
|
14415
|
+
constructor(zone, cfg) {
|
|
14416
|
+
super(zone, cfg, false, true);
|
|
14417
|
+
}
|
|
14418
|
+
}
|
|
14419
|
+
|
|
14106
14420
|
/**
|
|
14107
14421
|
* A {@link Marker} with an HTML label attached to it, managed by an {@link AnnotationsPlugin}.
|
|
14108
14422
|
*
|
|
@@ -89363,6 +89677,61 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
89363
89677
|
}
|
|
89364
89678
|
}
|
|
89365
89679
|
|
|
89680
|
+
class DistanceMeasurementEditControl extends Component {
|
|
89681
|
+
|
|
89682
|
+
/**
|
|
89683
|
+
* Edits {@link DistanceMeasurement} with mouse and/or touch input.
|
|
89684
|
+
*
|
|
89685
|
+
* @param {DistanceMeasurement} [measurement] The DistanceMeasurement to edit.
|
|
89686
|
+
* @param [cfg] Configuration
|
|
89687
|
+
* @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor.
|
|
89688
|
+
* @param {boolean} [cfg.snapping] Whether to enable snap-to-vertex and snap-to-edge.
|
|
89689
|
+
* @param {boolean} [handleMouseEvents] Whether to hangle mouse input.
|
|
89690
|
+
* @param {boolean} [handleTouchEvents] Whether to hangle touch input.
|
|
89691
|
+
*/
|
|
89692
|
+
constructor(measurement, cfg, handleMouseEvents, handleTouchEvents) {
|
|
89693
|
+
|
|
89694
|
+
const viewer = measurement.plugin.viewer;
|
|
89695
|
+
|
|
89696
|
+
super(viewer.scene);
|
|
89697
|
+
|
|
89698
|
+
const cleanup = activateDraggableDots({
|
|
89699
|
+
viewer: viewer,
|
|
89700
|
+
handleMouseEvents: handleMouseEvents,
|
|
89701
|
+
handleTouchEvents: handleTouchEvents,
|
|
89702
|
+
snapping: cfg.snapping,
|
|
89703
|
+
pointerLens: cfg.pointerLens,
|
|
89704
|
+
color: measurement.color,
|
|
89705
|
+
markers: [ measurement.origin, measurement.target ],
|
|
89706
|
+
onEdit: () => this.fire("edited")
|
|
89707
|
+
});
|
|
89708
|
+
|
|
89709
|
+
const destroyCb = measurement.on("destroyed", cleanup);
|
|
89710
|
+
|
|
89711
|
+
this._deactivate = function() {
|
|
89712
|
+
measurement.off("destroyed", destroyCb);
|
|
89713
|
+
cleanup();
|
|
89714
|
+
};
|
|
89715
|
+
}
|
|
89716
|
+
|
|
89717
|
+
deactivate() {
|
|
89718
|
+
this._deactivate();
|
|
89719
|
+
super.destroy();
|
|
89720
|
+
}
|
|
89721
|
+
}
|
|
89722
|
+
|
|
89723
|
+
class DistanceMeasurementEditMouseControl extends DistanceMeasurementEditControl {
|
|
89724
|
+
constructor(zone, cfg) {
|
|
89725
|
+
super(zone, cfg, true, false);
|
|
89726
|
+
}
|
|
89727
|
+
}
|
|
89728
|
+
|
|
89729
|
+
class DistanceMeasurementEditTouchControl extends DistanceMeasurementEditControl {
|
|
89730
|
+
constructor(zone, cfg) {
|
|
89731
|
+
super(zone, cfg, false, true);
|
|
89732
|
+
}
|
|
89733
|
+
}
|
|
89734
|
+
|
|
89366
89735
|
/**
|
|
89367
89736
|
* {@link Viewer} plugin that makes interaction smoother with large models, by temporarily switching
|
|
89368
89737
|
* the Viewer to faster, lower-quality rendering modes whenever we interact.
|
|
@@ -99457,7 +99826,11 @@ class PropertySet {
|
|
|
99457
99826
|
const properties = params.properties;
|
|
99458
99827
|
for (let i = 0, len = properties.length; i < len; i++) {
|
|
99459
99828
|
const property = properties[i];
|
|
99460
|
-
|
|
99829
|
+
if (Number.isInteger(property)) { // Will decompress in MetaModel.finalize();
|
|
99830
|
+
this.properties.push(property);
|
|
99831
|
+
} else {
|
|
99832
|
+
this.properties.push(new Property(property.name, property.value, property.type, property.valueType, property.description));
|
|
99833
|
+
}
|
|
99461
99834
|
}
|
|
99462
99835
|
}
|
|
99463
99836
|
}
|
|
@@ -99821,6 +100194,8 @@ class MetaModel {
|
|
|
99821
100194
|
|
|
99822
100195
|
this.metaScene.metaModels[this.id] = this;
|
|
99823
100196
|
|
|
100197
|
+
this._propertyLookup = [];
|
|
100198
|
+
|
|
99824
100199
|
/**
|
|
99825
100200
|
* True when this MetaModel has been finalized.
|
|
99826
100201
|
* @type {boolean}
|
|
@@ -99835,7 +100210,7 @@ class MetaModel {
|
|
|
99835
100210
|
* @type {MetaObject|null}
|
|
99836
100211
|
*/
|
|
99837
100212
|
get rootMetaObject() {
|
|
99838
|
-
if (this.rootMetaObjects.length
|
|
100213
|
+
if (this.rootMetaObjects.length === 1) {
|
|
99839
100214
|
return this.rootMetaObjects[0];
|
|
99840
100215
|
}
|
|
99841
100216
|
return null;
|
|
@@ -99856,6 +100231,12 @@ class MetaModel {
|
|
|
99856
100231
|
const metaScene = this.metaScene;
|
|
99857
100232
|
const propertyLookup = metaModelData.properties;
|
|
99858
100233
|
|
|
100234
|
+
if (propertyLookup) {
|
|
100235
|
+
for (let i = 0, len = propertyLookup.length; i < len; i++) {
|
|
100236
|
+
this._propertyLookup.push(propertyLookup[i]);
|
|
100237
|
+
}
|
|
100238
|
+
}
|
|
100239
|
+
|
|
99859
100240
|
// Create global Property Sets
|
|
99860
100241
|
|
|
99861
100242
|
if (metaModelData.propertySets) {
|
|
@@ -99866,9 +100247,6 @@ class MetaModel {
|
|
|
99866
100247
|
}
|
|
99867
100248
|
let propertySet = metaScene.propertySets[propertySetData.id];
|
|
99868
100249
|
if (!propertySet) {
|
|
99869
|
-
if (propertyLookup) {
|
|
99870
|
-
this._decompressProperties(propertyLookup, propertySetData.properties);
|
|
99871
|
-
}
|
|
99872
100250
|
propertySet = new PropertySet({
|
|
99873
100251
|
id: propertySetData.id,
|
|
99874
100252
|
originalSystemId: propertySetData.originalSystemId || propertySetData.id,
|
|
@@ -99915,15 +100293,21 @@ class MetaModel {
|
|
|
99915
100293
|
}
|
|
99916
100294
|
|
|
99917
100295
|
_decompressProperties(propertyLookup, properties) {
|
|
100296
|
+
const propsNotFound = [];
|
|
99918
100297
|
for (let i = 0, len = properties.length; i < len; i++) {
|
|
99919
100298
|
const property = properties[i];
|
|
99920
100299
|
if (Number.isInteger(property)) {
|
|
99921
100300
|
const lookupProperty = propertyLookup[property];
|
|
99922
100301
|
if (lookupProperty) {
|
|
99923
100302
|
properties[i] = lookupProperty;
|
|
100303
|
+
} else {
|
|
100304
|
+
propsNotFound.push(property);
|
|
99924
100305
|
}
|
|
99925
100306
|
}
|
|
99926
100307
|
}
|
|
100308
|
+
if (propsNotFound.length > 0) {
|
|
100309
|
+
console.error(`[MetaModel._decompressProperties] Properties not found: ${propsNotFound}`);
|
|
100310
|
+
}
|
|
99927
100311
|
}
|
|
99928
100312
|
|
|
99929
100313
|
finalize() {
|
|
@@ -99991,6 +100375,18 @@ class MetaModel {
|
|
|
99991
100375
|
(metaScene.metaObjectsByType[type] || (metaScene.metaObjectsByType[type] = {}))[objectId] = metaObject;
|
|
99992
100376
|
}
|
|
99993
100377
|
|
|
100378
|
+
// Decompress properties
|
|
100379
|
+
|
|
100380
|
+
if (this.propertySets) {
|
|
100381
|
+
for (let i = 0, len = this.propertySets.length; i < len; i++) {
|
|
100382
|
+
const propertySet = this.propertySets[i];
|
|
100383
|
+
this._decompressProperties(this._propertyLookup, propertySet.properties);
|
|
100384
|
+
}
|
|
100385
|
+
}
|
|
100386
|
+
|
|
100387
|
+
|
|
100388
|
+
this._propertyLookup = [];
|
|
100389
|
+
|
|
99994
100390
|
this.finalized = true;
|
|
99995
100391
|
|
|
99996
100392
|
this.metaScene.fire("metaModelCreated", this.id);
|
|
@@ -137908,13 +138304,6 @@ const hex2rgb = function(color) {
|
|
|
137908
138304
|
return [ rgb(0), rgb(2), rgb(4) ];
|
|
137909
138305
|
};
|
|
137910
138306
|
|
|
137911
|
-
const transformToNode = function(from, to, vec) {
|
|
137912
|
-
const fromRec = from.getBoundingClientRect();
|
|
137913
|
-
const toRec = to.getBoundingClientRect();
|
|
137914
|
-
vec[0] += fromRec.left - toRec.left;
|
|
137915
|
-
vec[1] += fromRec.top - toRec.top;
|
|
137916
|
-
};
|
|
137917
|
-
|
|
137918
138307
|
const triangulateEarClipping = function(planeCoords) {
|
|
137919
138308
|
|
|
137920
138309
|
const polygonVertices = [ ];
|
|
@@ -138017,148 +138406,6 @@ const triangulateEarClipping = function(planeCoords) {
|
|
|
138017
138406
|
return [ planeCoords, baseTriangles ];
|
|
138018
138407
|
};
|
|
138019
138408
|
|
|
138020
|
-
const draggableDot3D = function(handleMouseEvents, handleTouchEvents, viewer, worldPos, color, ray2WorldPos, onStart, onMove, onEnd) {
|
|
138021
|
-
const scene = viewer.scene;
|
|
138022
|
-
const canvas = scene.canvas.canvas;
|
|
138023
|
-
|
|
138024
|
-
const marker = new Marker(scene, {});
|
|
138025
|
-
|
|
138026
|
-
const pickWorldPos = canvasPos => {
|
|
138027
|
-
const origin = math.vec3();
|
|
138028
|
-
const direction = math.vec3();
|
|
138029
|
-
math.canvasPosToWorldRay(canvas, scene.camera.viewMatrix, scene.camera.projMatrix, canvasPos, origin, direction);
|
|
138030
|
-
return ray2WorldPos(origin, direction);
|
|
138031
|
-
};
|
|
138032
|
-
|
|
138033
|
-
const onChange = event => {
|
|
138034
|
-
const canvasPos = math.vec2([ event.clientX, event.clientY ]);
|
|
138035
|
-
transformToNode(canvas.ownerDocument.body, canvas, canvasPos);
|
|
138036
|
-
|
|
138037
|
-
const worldPos = pickWorldPos(canvasPos);
|
|
138038
|
-
marker.worldPos = worldPos;
|
|
138039
|
-
updateDotPos();
|
|
138040
|
-
onMove(canvasPos, worldPos);
|
|
138041
|
-
};
|
|
138042
|
-
|
|
138043
|
-
let currentDrag = null;
|
|
138044
|
-
|
|
138045
|
-
const onDragMove = function(event) {
|
|
138046
|
-
const e = currentDrag.matchesEvent(event);
|
|
138047
|
-
if (e)
|
|
138048
|
-
{
|
|
138049
|
-
onChange(e);
|
|
138050
|
-
}
|
|
138051
|
-
};
|
|
138052
|
-
|
|
138053
|
-
const onDragEnd = function(event) {
|
|
138054
|
-
const e = currentDrag.matchesEvent(event);
|
|
138055
|
-
if (e)
|
|
138056
|
-
{
|
|
138057
|
-
dot.setOpacity(idleOpacity);
|
|
138058
|
-
currentDrag.cleanup();
|
|
138059
|
-
onChange(e);
|
|
138060
|
-
onEnd();
|
|
138061
|
-
}
|
|
138062
|
-
};
|
|
138063
|
-
|
|
138064
|
-
const startDrag = function(matchesEvent, cleanupHandlers) {
|
|
138065
|
-
if (currentDrag) {
|
|
138066
|
-
currentDrag.cleanup();
|
|
138067
|
-
}
|
|
138068
|
-
|
|
138069
|
-
dot.setOpacity(1.0);
|
|
138070
|
-
dot.setClickable(false);
|
|
138071
|
-
viewer.cameraControl.active = false;
|
|
138072
|
-
|
|
138073
|
-
currentDrag = {
|
|
138074
|
-
matchesEvent: matchesEvent,
|
|
138075
|
-
cleanup: function() {
|
|
138076
|
-
currentDrag = null;
|
|
138077
|
-
dot.setClickable(true);
|
|
138078
|
-
viewer.cameraControl.active = true;
|
|
138079
|
-
cleanupHandlers();
|
|
138080
|
-
}
|
|
138081
|
-
};
|
|
138082
|
-
|
|
138083
|
-
onStart();
|
|
138084
|
-
};
|
|
138085
|
-
|
|
138086
|
-
const dotCfg = { fillColor: color };
|
|
138087
|
-
|
|
138088
|
-
if (handleMouseEvents)
|
|
138089
|
-
{
|
|
138090
|
-
dotCfg.onMouseOver = () => (! currentDrag) && dot.setOpacity(1.0);
|
|
138091
|
-
dotCfg.onMouseLeave = () => (! currentDrag) && dot.setOpacity(idleOpacity);
|
|
138092
|
-
dotCfg.onMouseDown = event => {
|
|
138093
|
-
if (event.which === 1)
|
|
138094
|
-
{
|
|
138095
|
-
canvas.addEventListener("mousemove", onDragMove);
|
|
138096
|
-
canvas.addEventListener("mouseup", onDragEnd);
|
|
138097
|
-
startDrag(
|
|
138098
|
-
event => (event.which === 1) && event,
|
|
138099
|
-
() => {
|
|
138100
|
-
canvas.removeEventListener("mousemove", onDragMove);
|
|
138101
|
-
canvas.removeEventListener("mouseup", onDragEnd);
|
|
138102
|
-
});
|
|
138103
|
-
}
|
|
138104
|
-
};
|
|
138105
|
-
}
|
|
138106
|
-
|
|
138107
|
-
if (handleTouchEvents)
|
|
138108
|
-
{
|
|
138109
|
-
let touchStartId;
|
|
138110
|
-
dotCfg.onTouchstart = event => {
|
|
138111
|
-
event.preventDefault();
|
|
138112
|
-
if (event.touches.length === 1)
|
|
138113
|
-
{
|
|
138114
|
-
touchStartId = event.touches[0].identifier;
|
|
138115
|
-
startDrag(
|
|
138116
|
-
event => [...event.changedTouches].find(e => e.identifier === touchStartId),
|
|
138117
|
-
() => { touchStartId = null; });
|
|
138118
|
-
}
|
|
138119
|
-
};
|
|
138120
|
-
dotCfg.onTouchmove = event => {
|
|
138121
|
-
event.preventDefault();
|
|
138122
|
-
onDragMove(event);
|
|
138123
|
-
};
|
|
138124
|
-
dotCfg.onTouchend = event => {
|
|
138125
|
-
event.preventDefault();
|
|
138126
|
-
onDragEnd(event);
|
|
138127
|
-
};
|
|
138128
|
-
}
|
|
138129
|
-
|
|
138130
|
-
const dotParent = canvas.ownerDocument.body;
|
|
138131
|
-
const dot = new Dot(dotParent, dotCfg);
|
|
138132
|
-
|
|
138133
|
-
const idleOpacity = 0.5;
|
|
138134
|
-
dot.setOpacity(idleOpacity);
|
|
138135
|
-
|
|
138136
|
-
const updateDotPos = function() {
|
|
138137
|
-
const pos = marker.canvasPos.slice();
|
|
138138
|
-
transformToNode(canvas, dotParent, pos);
|
|
138139
|
-
dot.setPos(pos[0], pos[1]);
|
|
138140
|
-
};
|
|
138141
|
-
|
|
138142
|
-
marker.worldPos = worldPos;
|
|
138143
|
-
updateDotPos();
|
|
138144
|
-
|
|
138145
|
-
const onViewMatrix = scene.camera.on("viewMatrix", updateDotPos);
|
|
138146
|
-
const onProjMatrix = scene.camera.on("projMatrix", updateDotPos);
|
|
138147
|
-
|
|
138148
|
-
return {
|
|
138149
|
-
setActive: value => dot.setClickable(value),
|
|
138150
|
-
getWorldPos: () => marker.worldPos,
|
|
138151
|
-
setWorldPos: pos => { marker.worldPos = pos; updateDotPos(); },
|
|
138152
|
-
destroy: function() {
|
|
138153
|
-
currentDrag && currentDrag.cleanup();
|
|
138154
|
-
scene.camera.off(onViewMatrix);
|
|
138155
|
-
scene.camera.off(onProjMatrix);
|
|
138156
|
-
marker.destroy();
|
|
138157
|
-
dot.destroy();
|
|
138158
|
-
}
|
|
138159
|
-
};
|
|
138160
|
-
};
|
|
138161
|
-
|
|
138162
138409
|
const marker3D = function(scene, color) {
|
|
138163
138410
|
const canvas = scene.canvas.canvas;
|
|
138164
138411
|
|
|
@@ -139659,23 +139906,23 @@ class ZoneEditControl extends Component {
|
|
|
139659
139906
|
}
|
|
139660
139907
|
};
|
|
139661
139908
|
|
|
139662
|
-
const dot =
|
|
139663
|
-
handleMouseEvents,
|
|
139664
|
-
handleTouchEvents,
|
|
139665
|
-
zone.plugin.viewer,
|
|
139666
|
-
math.vec3([ planeCoord[0], altitude, planeCoord[1] ]),
|
|
139667
|
-
zone._color,
|
|
139668
|
-
(orig, dir) => planeIntersect(altitude, math.vec3([ 0, 1, 0 ]), orig, dir),
|
|
139669
|
-
() => {
|
|
139909
|
+
const dot = createDraggableDot3D({
|
|
139910
|
+
handleMouseEvents: handleMouseEvents,
|
|
139911
|
+
handleTouchEvents: handleTouchEvents,
|
|
139912
|
+
viewer: zone.plugin.viewer,
|
|
139913
|
+
worldPos: math.vec3([ planeCoord[0], altitude, planeCoord[1] ]),
|
|
139914
|
+
color: zone._color,
|
|
139915
|
+
ray2WorldPos: (orig, dir) => planeIntersect(altitude, math.vec3([ 0, 1, 0 ]), orig, dir),
|
|
139916
|
+
onStart: () => {
|
|
139670
139917
|
initWorldPos = dot.getWorldPos().slice();
|
|
139671
139918
|
initPlaneCoord = planeCoord.slice();
|
|
139672
139919
|
set_other_dots_active(false, dot);
|
|
139673
139920
|
},
|
|
139674
|
-
(canvasPos, worldPos) => {
|
|
139921
|
+
onMove: (canvasPos, worldPos) => {
|
|
139675
139922
|
updatePointerLens(canvasPos);
|
|
139676
139923
|
setPlaneCoord([ worldPos[0], worldPos[2] ]);
|
|
139677
139924
|
},
|
|
139678
|
-
() => {
|
|
139925
|
+
onEnd: () => {
|
|
139679
139926
|
if (zone._zoneMesh)
|
|
139680
139927
|
{
|
|
139681
139928
|
self.fire("edited");
|
|
@@ -139687,7 +139934,8 @@ class ZoneEditControl extends Component {
|
|
|
139687
139934
|
}
|
|
139688
139935
|
updatePointerLens(null);
|
|
139689
139936
|
set_other_dots_active(true, dot);
|
|
139690
|
-
}
|
|
139937
|
+
}
|
|
139938
|
+
});
|
|
139691
139939
|
return dot;
|
|
139692
139940
|
});
|
|
139693
139941
|
const set_other_dots_active = (active, dot) => dots.forEach(d => (d !== dot) && d.setActive(active));
|
|
@@ -139912,6 +140160,8 @@ class ZoneTranslateTouchControl extends ZoneTranslateControl {
|
|
|
139912
140160
|
|
|
139913
140161
|
exports.AlphaFormat = AlphaFormat;
|
|
139914
140162
|
exports.AmbientLight = AmbientLight;
|
|
140163
|
+
exports.AngleMeasurementEditMouseControl = AngleMeasurementEditMouseControl;
|
|
140164
|
+
exports.AngleMeasurementEditTouchControl = AngleMeasurementEditTouchControl;
|
|
139915
140165
|
exports.AngleMeasurementsControl = AngleMeasurementsControl;
|
|
139916
140166
|
exports.AngleMeasurementsMouseControl = AngleMeasurementsMouseControl;
|
|
139917
140167
|
exports.AngleMeasurementsPlugin = AngleMeasurementsPlugin;
|
|
@@ -139936,6 +140186,8 @@ exports.DefaultLoadingManager = DefaultLoadingManager;
|
|
|
139936
140186
|
exports.DepthFormat = DepthFormat;
|
|
139937
140187
|
exports.DepthStencilFormat = DepthStencilFormat;
|
|
139938
140188
|
exports.DirLight = DirLight;
|
|
140189
|
+
exports.DistanceMeasurementEditMouseControl = DistanceMeasurementEditMouseControl;
|
|
140190
|
+
exports.DistanceMeasurementEditTouchControl = DistanceMeasurementEditTouchControl;
|
|
139939
140191
|
exports.DistanceMeasurementsControl = DistanceMeasurementsControl;
|
|
139940
140192
|
exports.DistanceMeasurementsMouseControl = DistanceMeasurementsMouseControl;
|
|
139941
140193
|
exports.DistanceMeasurementsPlugin = DistanceMeasurementsPlugin;
|