@xeokit/xeokit-sdk 2.6.22 → 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 +387 -162
- package/dist/xeokit-sdk.es.js +384 -163
- package/dist/xeokit-sdk.es5.js +682 -662
- 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/dist/xeokit-sdk.es.js
CHANGED
|
@@ -12382,10 +12382,10 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
12382
12382
|
}
|
|
12383
12383
|
|
|
12384
12384
|
_destroyMarkerDiv() {
|
|
12385
|
-
if (this.
|
|
12385
|
+
if (this.markerDiv) {
|
|
12386
12386
|
const element = document.getElementById('myMarkerDiv');
|
|
12387
12387
|
element.parentNode.removeChild(element);
|
|
12388
|
-
this.
|
|
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.
|
|
@@ -137931,13 +138300,6 @@ const hex2rgb = function(color) {
|
|
|
137931
138300
|
return [ rgb(0), rgb(2), rgb(4) ];
|
|
137932
138301
|
};
|
|
137933
138302
|
|
|
137934
|
-
const transformToNode = function(from, to, vec) {
|
|
137935
|
-
const fromRec = from.getBoundingClientRect();
|
|
137936
|
-
const toRec = to.getBoundingClientRect();
|
|
137937
|
-
vec[0] += fromRec.left - toRec.left;
|
|
137938
|
-
vec[1] += fromRec.top - toRec.top;
|
|
137939
|
-
};
|
|
137940
|
-
|
|
137941
138303
|
const triangulateEarClipping = function(planeCoords) {
|
|
137942
138304
|
|
|
137943
138305
|
const polygonVertices = [ ];
|
|
@@ -138040,148 +138402,6 @@ const triangulateEarClipping = function(planeCoords) {
|
|
|
138040
138402
|
return [ planeCoords, baseTriangles ];
|
|
138041
138403
|
};
|
|
138042
138404
|
|
|
138043
|
-
const draggableDot3D = function(handleMouseEvents, handleTouchEvents, viewer, worldPos, color, ray2WorldPos, onStart, onMove, onEnd) {
|
|
138044
|
-
const scene = viewer.scene;
|
|
138045
|
-
const canvas = scene.canvas.canvas;
|
|
138046
|
-
|
|
138047
|
-
const marker = new Marker(scene, {});
|
|
138048
|
-
|
|
138049
|
-
const pickWorldPos = canvasPos => {
|
|
138050
|
-
const origin = math.vec3();
|
|
138051
|
-
const direction = math.vec3();
|
|
138052
|
-
math.canvasPosToWorldRay(canvas, scene.camera.viewMatrix, scene.camera.projMatrix, canvasPos, origin, direction);
|
|
138053
|
-
return ray2WorldPos(origin, direction);
|
|
138054
|
-
};
|
|
138055
|
-
|
|
138056
|
-
const onChange = event => {
|
|
138057
|
-
const canvasPos = math.vec2([ event.clientX, event.clientY ]);
|
|
138058
|
-
transformToNode(canvas.ownerDocument.body, canvas, canvasPos);
|
|
138059
|
-
|
|
138060
|
-
const worldPos = pickWorldPos(canvasPos);
|
|
138061
|
-
marker.worldPos = worldPos;
|
|
138062
|
-
updateDotPos();
|
|
138063
|
-
onMove(canvasPos, worldPos);
|
|
138064
|
-
};
|
|
138065
|
-
|
|
138066
|
-
let currentDrag = null;
|
|
138067
|
-
|
|
138068
|
-
const onDragMove = function(event) {
|
|
138069
|
-
const e = currentDrag.matchesEvent(event);
|
|
138070
|
-
if (e)
|
|
138071
|
-
{
|
|
138072
|
-
onChange(e);
|
|
138073
|
-
}
|
|
138074
|
-
};
|
|
138075
|
-
|
|
138076
|
-
const onDragEnd = function(event) {
|
|
138077
|
-
const e = currentDrag.matchesEvent(event);
|
|
138078
|
-
if (e)
|
|
138079
|
-
{
|
|
138080
|
-
dot.setOpacity(idleOpacity);
|
|
138081
|
-
currentDrag.cleanup();
|
|
138082
|
-
onChange(e);
|
|
138083
|
-
onEnd();
|
|
138084
|
-
}
|
|
138085
|
-
};
|
|
138086
|
-
|
|
138087
|
-
const startDrag = function(matchesEvent, cleanupHandlers) {
|
|
138088
|
-
if (currentDrag) {
|
|
138089
|
-
currentDrag.cleanup();
|
|
138090
|
-
}
|
|
138091
|
-
|
|
138092
|
-
dot.setOpacity(1.0);
|
|
138093
|
-
dot.setClickable(false);
|
|
138094
|
-
viewer.cameraControl.active = false;
|
|
138095
|
-
|
|
138096
|
-
currentDrag = {
|
|
138097
|
-
matchesEvent: matchesEvent,
|
|
138098
|
-
cleanup: function() {
|
|
138099
|
-
currentDrag = null;
|
|
138100
|
-
dot.setClickable(true);
|
|
138101
|
-
viewer.cameraControl.active = true;
|
|
138102
|
-
cleanupHandlers();
|
|
138103
|
-
}
|
|
138104
|
-
};
|
|
138105
|
-
|
|
138106
|
-
onStart();
|
|
138107
|
-
};
|
|
138108
|
-
|
|
138109
|
-
const dotCfg = { fillColor: color };
|
|
138110
|
-
|
|
138111
|
-
if (handleMouseEvents)
|
|
138112
|
-
{
|
|
138113
|
-
dotCfg.onMouseOver = () => (! currentDrag) && dot.setOpacity(1.0);
|
|
138114
|
-
dotCfg.onMouseLeave = () => (! currentDrag) && dot.setOpacity(idleOpacity);
|
|
138115
|
-
dotCfg.onMouseDown = event => {
|
|
138116
|
-
if (event.which === 1)
|
|
138117
|
-
{
|
|
138118
|
-
canvas.addEventListener("mousemove", onDragMove);
|
|
138119
|
-
canvas.addEventListener("mouseup", onDragEnd);
|
|
138120
|
-
startDrag(
|
|
138121
|
-
event => (event.which === 1) && event,
|
|
138122
|
-
() => {
|
|
138123
|
-
canvas.removeEventListener("mousemove", onDragMove);
|
|
138124
|
-
canvas.removeEventListener("mouseup", onDragEnd);
|
|
138125
|
-
});
|
|
138126
|
-
}
|
|
138127
|
-
};
|
|
138128
|
-
}
|
|
138129
|
-
|
|
138130
|
-
if (handleTouchEvents)
|
|
138131
|
-
{
|
|
138132
|
-
let touchStartId;
|
|
138133
|
-
dotCfg.onTouchstart = event => {
|
|
138134
|
-
event.preventDefault();
|
|
138135
|
-
if (event.touches.length === 1)
|
|
138136
|
-
{
|
|
138137
|
-
touchStartId = event.touches[0].identifier;
|
|
138138
|
-
startDrag(
|
|
138139
|
-
event => [...event.changedTouches].find(e => e.identifier === touchStartId),
|
|
138140
|
-
() => { touchStartId = null; });
|
|
138141
|
-
}
|
|
138142
|
-
};
|
|
138143
|
-
dotCfg.onTouchmove = event => {
|
|
138144
|
-
event.preventDefault();
|
|
138145
|
-
onDragMove(event);
|
|
138146
|
-
};
|
|
138147
|
-
dotCfg.onTouchend = event => {
|
|
138148
|
-
event.preventDefault();
|
|
138149
|
-
onDragEnd(event);
|
|
138150
|
-
};
|
|
138151
|
-
}
|
|
138152
|
-
|
|
138153
|
-
const dotParent = canvas.ownerDocument.body;
|
|
138154
|
-
const dot = new Dot(dotParent, dotCfg);
|
|
138155
|
-
|
|
138156
|
-
const idleOpacity = 0.5;
|
|
138157
|
-
dot.setOpacity(idleOpacity);
|
|
138158
|
-
|
|
138159
|
-
const updateDotPos = function() {
|
|
138160
|
-
const pos = marker.canvasPos.slice();
|
|
138161
|
-
transformToNode(canvas, dotParent, pos);
|
|
138162
|
-
dot.setPos(pos[0], pos[1]);
|
|
138163
|
-
};
|
|
138164
|
-
|
|
138165
|
-
marker.worldPos = worldPos;
|
|
138166
|
-
updateDotPos();
|
|
138167
|
-
|
|
138168
|
-
const onViewMatrix = scene.camera.on("viewMatrix", updateDotPos);
|
|
138169
|
-
const onProjMatrix = scene.camera.on("projMatrix", updateDotPos);
|
|
138170
|
-
|
|
138171
|
-
return {
|
|
138172
|
-
setActive: value => dot.setClickable(value),
|
|
138173
|
-
getWorldPos: () => marker.worldPos,
|
|
138174
|
-
setWorldPos: pos => { marker.worldPos = pos; updateDotPos(); },
|
|
138175
|
-
destroy: function() {
|
|
138176
|
-
currentDrag && currentDrag.cleanup();
|
|
138177
|
-
scene.camera.off(onViewMatrix);
|
|
138178
|
-
scene.camera.off(onProjMatrix);
|
|
138179
|
-
marker.destroy();
|
|
138180
|
-
dot.destroy();
|
|
138181
|
-
}
|
|
138182
|
-
};
|
|
138183
|
-
};
|
|
138184
|
-
|
|
138185
138405
|
const marker3D = function(scene, color) {
|
|
138186
138406
|
const canvas = scene.canvas.canvas;
|
|
138187
138407
|
|
|
@@ -139682,23 +139902,23 @@ class ZoneEditControl extends Component {
|
|
|
139682
139902
|
}
|
|
139683
139903
|
};
|
|
139684
139904
|
|
|
139685
|
-
const dot =
|
|
139686
|
-
handleMouseEvents,
|
|
139687
|
-
handleTouchEvents,
|
|
139688
|
-
zone.plugin.viewer,
|
|
139689
|
-
math.vec3([ planeCoord[0], altitude, planeCoord[1] ]),
|
|
139690
|
-
zone._color,
|
|
139691
|
-
(orig, dir) => planeIntersect(altitude, math.vec3([ 0, 1, 0 ]), orig, dir),
|
|
139692
|
-
() => {
|
|
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: () => {
|
|
139693
139913
|
initWorldPos = dot.getWorldPos().slice();
|
|
139694
139914
|
initPlaneCoord = planeCoord.slice();
|
|
139695
139915
|
set_other_dots_active(false, dot);
|
|
139696
139916
|
},
|
|
139697
|
-
(canvasPos, worldPos) => {
|
|
139917
|
+
onMove: (canvasPos, worldPos) => {
|
|
139698
139918
|
updatePointerLens(canvasPos);
|
|
139699
139919
|
setPlaneCoord([ worldPos[0], worldPos[2] ]);
|
|
139700
139920
|
},
|
|
139701
|
-
() => {
|
|
139921
|
+
onEnd: () => {
|
|
139702
139922
|
if (zone._zoneMesh)
|
|
139703
139923
|
{
|
|
139704
139924
|
self.fire("edited");
|
|
@@ -139710,7 +139930,8 @@ class ZoneEditControl extends Component {
|
|
|
139710
139930
|
}
|
|
139711
139931
|
updatePointerLens(null);
|
|
139712
139932
|
set_other_dots_active(true, dot);
|
|
139713
|
-
}
|
|
139933
|
+
}
|
|
139934
|
+
});
|
|
139714
139935
|
return dot;
|
|
139715
139936
|
});
|
|
139716
139937
|
const set_other_dots_active = (active, dot) => dots.forEach(d => (d !== dot) && d.setActive(active));
|
|
@@ -139933,4 +140154,4 @@ class ZoneTranslateTouchControl extends ZoneTranslateControl {
|
|
|
139933
140154
|
}
|
|
139934
140155
|
}
|
|
139935
140156
|
|
|
139936
|
-
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 };
|