@xeokit/xeokit-sdk 2.5.2-beta-7 → 2.5.2-beta-8
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 +16 -4
- package/dist/xeokit-sdk.es.js +112 -100
- package/dist/xeokit-sdk.es5.js +2 -2
- package/dist/xeokit-sdk.min.cjs.js +2 -2
- package/dist/xeokit-sdk.min.es.js +2 -2
- package/dist/xeokit-sdk.min.es5.js +2 -2
- package/package.json +1 -1
- package/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js +7 -2
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js +9 -2
- package/types/viewer/scene/models/SceneModel.d.ts +46 -48
package/dist/xeokit-sdk.cjs.js
CHANGED
|
@@ -12154,8 +12154,13 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
12154
12154
|
mouseHoverCanvasPos.set(canvasPos);
|
|
12155
12155
|
switch (this._mouseState) {
|
|
12156
12156
|
case MOUSE_FINDING_ORIGIN:
|
|
12157
|
-
|
|
12158
|
-
|
|
12157
|
+
const canvasBoundRect = canvas.getBoundingClientRect();
|
|
12158
|
+
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
|
|
12159
|
+
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
12160
|
+
const canvasLeftEdge = canvasBoundRect.left + scrollLeft;
|
|
12161
|
+
const canvasTopEdge = canvasBoundRect.top + scrollTop;
|
|
12162
|
+
this._markerDiv.style.marginLeft = `${canvasLeftEdge + canvasPos[0] - 5}px`;
|
|
12163
|
+
this._markerDiv.style.marginTop = `${canvasTopEdge + canvasPos[1] - 5}px`;
|
|
12159
12164
|
break;
|
|
12160
12165
|
case MOUSE_FINDING_CORNER:
|
|
12161
12166
|
if (this._currentAngleMeasurement) {
|
|
@@ -85533,8 +85538,15 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
85533
85538
|
pointerWorldPos.set(event.worldPos);
|
|
85534
85539
|
pointerCanvasPos.set(event.canvasPos);
|
|
85535
85540
|
if (this._mouseState === MOUSE_FIRST_CLICK_EXPECTED) {
|
|
85536
|
-
|
|
85537
|
-
|
|
85541
|
+
|
|
85542
|
+
const canvasBoundRect = canvas.getBoundingClientRect();
|
|
85543
|
+
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
|
|
85544
|
+
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
85545
|
+
const canvasLeftEdge = canvasBoundRect.left + scrollLeft;
|
|
85546
|
+
const canvasTopEdge = canvasBoundRect.top + scrollTop;
|
|
85547
|
+
|
|
85548
|
+
this._markerDiv.style.marginLeft = `${canvasLeftEdge + canvasPos[0] - 5}px`;
|
|
85549
|
+
this._markerDiv.style.marginTop = `${canvasTopEdge + canvasPos[1] - 5}px`;
|
|
85538
85550
|
this._markerDiv.style.background = "pink";
|
|
85539
85551
|
if (event.snappedToVertex || event.snappedToEdge) {
|
|
85540
85552
|
if (this.pointerLens) {
|
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -12150,8 +12150,13 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
12150
12150
|
mouseHoverCanvasPos.set(canvasPos);
|
|
12151
12151
|
switch (this._mouseState) {
|
|
12152
12152
|
case MOUSE_FINDING_ORIGIN:
|
|
12153
|
-
|
|
12154
|
-
|
|
12153
|
+
const canvasBoundRect = canvas.getBoundingClientRect();
|
|
12154
|
+
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
|
|
12155
|
+
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
12156
|
+
const canvasLeftEdge = canvasBoundRect.left + scrollLeft;
|
|
12157
|
+
const canvasTopEdge = canvasBoundRect.top + scrollTop;
|
|
12158
|
+
this._markerDiv.style.marginLeft = `${canvasLeftEdge + canvasPos[0] - 5}px`;
|
|
12159
|
+
this._markerDiv.style.marginTop = `${canvasTopEdge + canvasPos[1] - 5}px`;
|
|
12155
12160
|
break;
|
|
12156
12161
|
case MOUSE_FINDING_CORNER:
|
|
12157
12162
|
if (this._currentAngleMeasurement) {
|
|
@@ -81897,7 +81902,7 @@ class SceneModel extends Component {
|
|
|
81897
81902
|
* @param {Number} [cfg.opacity=1] Opacity in range ````[0..1]````. Overridden by texture set ````colorTexture````.
|
|
81898
81903
|
* @param {Number} [cfg.metallic=0] Metallic factor in range ````[0..1]````. Overridden by texture set ````metallicRoughnessTexture````.
|
|
81899
81904
|
* @param {Number} [cfg.roughness=1] Roughness factor in range ````[0..1]````. Overridden by texture set ````metallicRoughnessTexture````.
|
|
81900
|
-
* @returns {Boolean} True
|
|
81905
|
+
* @returns {Boolean} True = successfully mesh was created. False = error during creation of a mesh.
|
|
81901
81906
|
*/
|
|
81902
81907
|
createMesh(cfg) {
|
|
81903
81908
|
|
|
@@ -82611,15 +82616,15 @@ class SceneModel extends Component {
|
|
|
82611
82616
|
let meshes = [];
|
|
82612
82617
|
for (let i = 0, len = cfg.meshIds.length; i < len; i++) {
|
|
82613
82618
|
const meshId = cfg.meshIds[i];
|
|
82614
|
-
let mesh = this._meshes[meshId];
|
|
82615
|
-
if (!mesh) {
|
|
82616
|
-
let meshCfg = this._meshesCfgsBeforeMeshCreation[meshId];
|
|
82617
|
-
if (!meshCfg) {
|
|
82618
|
-
this.error(`Mesh with this ID not found: "${meshId}" - ignoring this mesh`);
|
|
82619
|
+
let mesh = this._meshes[meshId]; // Trying to get already created mesh
|
|
82620
|
+
if (!mesh) { // Checks if there is already created mesh for this meshId
|
|
82621
|
+
let meshCfg = this._meshesCfgsBeforeMeshCreation[meshId]; // Trying to get already created cfg
|
|
82622
|
+
if (!meshCfg) { // Checks if there is already created cfg for this meshId
|
|
82623
|
+
this.error(`Mesh with this ID not found: "${meshId}" - ignoring this mesh`); // There is no such cfg
|
|
82619
82624
|
continue;
|
|
82620
82625
|
}
|
|
82621
|
-
mesh = this._createMesh(meshCfg);
|
|
82622
|
-
this._meshes[cfg.id] = mesh;
|
|
82626
|
+
mesh = this._createMesh(meshCfg); // There is no such mesh yet, but there is already created cfg, so it creates this mesh
|
|
82627
|
+
this._meshes[cfg.id] = mesh; // Now it will also add this mesh to dictionary of created meshes
|
|
82623
82628
|
}
|
|
82624
82629
|
if (mesh.parent) {
|
|
82625
82630
|
this.error(`Mesh with ID "${meshId}" already belongs to object with ID "${mesh.parent.id}" - ignoring this mesh`);
|
|
@@ -85529,8 +85534,15 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
85529
85534
|
pointerWorldPos.set(event.worldPos);
|
|
85530
85535
|
pointerCanvasPos.set(event.canvasPos);
|
|
85531
85536
|
if (this._mouseState === MOUSE_FIRST_CLICK_EXPECTED) {
|
|
85532
|
-
|
|
85533
|
-
|
|
85537
|
+
|
|
85538
|
+
const canvasBoundRect = canvas.getBoundingClientRect();
|
|
85539
|
+
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
|
|
85540
|
+
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
85541
|
+
const canvasLeftEdge = canvasBoundRect.left + scrollLeft;
|
|
85542
|
+
const canvasTopEdge = canvasBoundRect.top + scrollTop;
|
|
85543
|
+
|
|
85544
|
+
this._markerDiv.style.marginLeft = `${canvasLeftEdge + canvasPos[0] - 5}px`;
|
|
85545
|
+
this._markerDiv.style.marginTop = `${canvasTopEdge + canvasPos[1] - 5}px`;
|
|
85534
85546
|
this._markerDiv.style.background = "pink";
|
|
85535
85547
|
if (event.snappedToVertex || event.snappedToEdge) {
|
|
85536
85548
|
if (this.pointerLens) {
|
|
@@ -97224,94 +97236,94 @@ function arrayToMap(array) {
|
|
|
97224
97236
|
* Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
|
|
97225
97237
|
* Released under MIT License
|
|
97226
97238
|
*/
|
|
97227
|
-
/*! *****************************************************************************
|
|
97228
|
-
Copyright (c) Microsoft Corporation.
|
|
97229
|
-
|
|
97230
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
97231
|
-
purpose with or without fee is hereby granted.
|
|
97232
|
-
|
|
97233
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
97234
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
97235
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
97236
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
97237
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
97238
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
97239
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
97240
|
-
***************************************************************************** */
|
|
97241
|
-
/* global Reflect, Promise */
|
|
97242
|
-
|
|
97243
|
-
var extendStatics = function(d, b) {
|
|
97244
|
-
extendStatics = Object.setPrototypeOf ||
|
|
97245
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
97246
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
97247
|
-
return extendStatics(d, b);
|
|
97248
|
-
};
|
|
97249
|
-
|
|
97250
|
-
function __extends(d, b) {
|
|
97251
|
-
if (typeof b !== "function" && b !== null)
|
|
97252
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
97253
|
-
extendStatics(d, b);
|
|
97254
|
-
function __() { this.constructor = d; }
|
|
97255
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
97256
|
-
}
|
|
97257
|
-
|
|
97258
|
-
var __assign = function() {
|
|
97259
|
-
__assign = Object.assign || function __assign(t) {
|
|
97260
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
97261
|
-
s = arguments[i];
|
|
97262
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
97263
|
-
}
|
|
97264
|
-
return t;
|
|
97265
|
-
};
|
|
97266
|
-
return __assign.apply(this, arguments);
|
|
97267
|
-
};
|
|
97268
|
-
|
|
97269
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
97270
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
97271
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
97272
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
97273
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
97274
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
97275
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
97276
|
-
});
|
|
97277
|
-
}
|
|
97278
|
-
|
|
97279
|
-
function __generator(thisArg, body) {
|
|
97280
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
97281
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
97282
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
97283
|
-
function step(op) {
|
|
97284
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
97285
|
-
while (_) try {
|
|
97286
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
97287
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
97288
|
-
switch (op[0]) {
|
|
97289
|
-
case 0: case 1: t = op; break;
|
|
97290
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
97291
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
97292
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
97293
|
-
default:
|
|
97294
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
97295
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
97296
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
97297
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
97298
|
-
if (t[2]) _.ops.pop();
|
|
97299
|
-
_.trys.pop(); continue;
|
|
97300
|
-
}
|
|
97301
|
-
op = body.call(thisArg, _);
|
|
97302
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
97303
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
97304
|
-
}
|
|
97305
|
-
}
|
|
97306
|
-
|
|
97307
|
-
function __spreadArray(to, from, pack) {
|
|
97308
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
97309
|
-
if (ar || !(i in from)) {
|
|
97310
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
97311
|
-
ar[i] = from[i];
|
|
97312
|
-
}
|
|
97313
|
-
}
|
|
97314
|
-
return to.concat(ar || from);
|
|
97239
|
+
/*! *****************************************************************************
|
|
97240
|
+
Copyright (c) Microsoft Corporation.
|
|
97241
|
+
|
|
97242
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
97243
|
+
purpose with or without fee is hereby granted.
|
|
97244
|
+
|
|
97245
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
97246
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
97247
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
97248
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
97249
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
97250
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
97251
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
97252
|
+
***************************************************************************** */
|
|
97253
|
+
/* global Reflect, Promise */
|
|
97254
|
+
|
|
97255
|
+
var extendStatics = function(d, b) {
|
|
97256
|
+
extendStatics = Object.setPrototypeOf ||
|
|
97257
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
97258
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
97259
|
+
return extendStatics(d, b);
|
|
97260
|
+
};
|
|
97261
|
+
|
|
97262
|
+
function __extends(d, b) {
|
|
97263
|
+
if (typeof b !== "function" && b !== null)
|
|
97264
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
97265
|
+
extendStatics(d, b);
|
|
97266
|
+
function __() { this.constructor = d; }
|
|
97267
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
97268
|
+
}
|
|
97269
|
+
|
|
97270
|
+
var __assign = function() {
|
|
97271
|
+
__assign = Object.assign || function __assign(t) {
|
|
97272
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
97273
|
+
s = arguments[i];
|
|
97274
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
97275
|
+
}
|
|
97276
|
+
return t;
|
|
97277
|
+
};
|
|
97278
|
+
return __assign.apply(this, arguments);
|
|
97279
|
+
};
|
|
97280
|
+
|
|
97281
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
97282
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
97283
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
97284
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
97285
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
97286
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
97287
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
97288
|
+
});
|
|
97289
|
+
}
|
|
97290
|
+
|
|
97291
|
+
function __generator(thisArg, body) {
|
|
97292
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
97293
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
97294
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
97295
|
+
function step(op) {
|
|
97296
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
97297
|
+
while (_) try {
|
|
97298
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
97299
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
97300
|
+
switch (op[0]) {
|
|
97301
|
+
case 0: case 1: t = op; break;
|
|
97302
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
97303
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
97304
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
97305
|
+
default:
|
|
97306
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
97307
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
97308
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
97309
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
97310
|
+
if (t[2]) _.ops.pop();
|
|
97311
|
+
_.trys.pop(); continue;
|
|
97312
|
+
}
|
|
97313
|
+
op = body.call(thisArg, _);
|
|
97314
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
97315
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
97316
|
+
}
|
|
97317
|
+
}
|
|
97318
|
+
|
|
97319
|
+
function __spreadArray(to, from, pack) {
|
|
97320
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
97321
|
+
if (ar || !(i in from)) {
|
|
97322
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
97323
|
+
ar[i] = from[i];
|
|
97324
|
+
}
|
|
97325
|
+
}
|
|
97326
|
+
return to.concat(ar || from);
|
|
97315
97327
|
}
|
|
97316
97328
|
|
|
97317
97329
|
var Bounds = /** @class */ (function () {
|
package/dist/xeokit-sdk.es5.js
CHANGED
|
@@ -2979,7 +2979,7 @@ _this18._initMarkerDiv();_this18._onMouseHoverSurface=null;_this18._onHoverNothi
|
|
|
2979
2979
|
*/function get(){return this._snapping;}/**
|
|
2980
2980
|
* Activates this AngleMeasurementsMouseControl, ready to respond to input.
|
|
2981
2981
|
*/,set:function set(snapping){if(snapping!==this._snapping){this._snapping=snapping;this.deactivate();this.activate();}else{this._snapping=snapping;}}},{key:"activate",value:function activate(){var _this19=this;if(this._active){return;}if(!this.markerDiv){this._initMarkerDiv();// if the marker is destroyed after deactivation, we recreate it
|
|
2982
|
-
}this.angleMeasurementsPlugin;var scene=this.scene;scene.input;var canvas=scene.canvas.canvas;var clickTolerance=20;var cameraControl=this.angleMeasurementsPlugin.viewer.cameraControl;var pointerLens=this.pointerLens;var mouseHovering=false;var hoveredEntity=null;var lastMouseCanvasX=0;var lastMouseCanvasY=0;var mouseWorldPos=math.vec3();var mouseHoverCanvasPos=math.vec2();this._currentAngleMeasurement=null;this._onMouseHoverSurface=cameraControl.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",function(event){if(event.snappedToVertex||event.snappedToEdge){if(pointerLens){pointerLens.visible=true;pointerLens.canvasPos=event.canvasPos;pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;pointerLens.snapped=true;}_this19.markerDiv.style.background="greenyellow";_this19.markerDiv.style.border="2px solid green";}else{if(pointerLens){pointerLens.visible=true;pointerLens.canvasPos=event.canvasPos;pointerLens.snappedCanvasPos=event.canvasPos;pointerLens.snapped=false;}_this19.markerDiv.style.background="pink";_this19.markerDiv.style.border="2px solid red";}var canvasPos=event.snappedCanvasPos||event.canvasPos;mouseHovering=true;hoveredEntity=event.entity;mouseWorldPos.set(event.worldPos);mouseHoverCanvasPos.set(canvasPos);switch(_this19._mouseState){case MOUSE_FINDING_ORIGIN:_this19.
|
|
2982
|
+
}this.angleMeasurementsPlugin;var scene=this.scene;scene.input;var canvas=scene.canvas.canvas;var clickTolerance=20;var cameraControl=this.angleMeasurementsPlugin.viewer.cameraControl;var pointerLens=this.pointerLens;var mouseHovering=false;var hoveredEntity=null;var lastMouseCanvasX=0;var lastMouseCanvasY=0;var mouseWorldPos=math.vec3();var mouseHoverCanvasPos=math.vec2();this._currentAngleMeasurement=null;this._onMouseHoverSurface=cameraControl.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",function(event){if(event.snappedToVertex||event.snappedToEdge){if(pointerLens){pointerLens.visible=true;pointerLens.canvasPos=event.canvasPos;pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;pointerLens.snapped=true;}_this19.markerDiv.style.background="greenyellow";_this19.markerDiv.style.border="2px solid green";}else{if(pointerLens){pointerLens.visible=true;pointerLens.canvasPos=event.canvasPos;pointerLens.snappedCanvasPos=event.canvasPos;pointerLens.snapped=false;}_this19.markerDiv.style.background="pink";_this19.markerDiv.style.border="2px solid red";}var canvasPos=event.snappedCanvasPos||event.canvasPos;mouseHovering=true;hoveredEntity=event.entity;mouseWorldPos.set(event.worldPos);mouseHoverCanvasPos.set(canvasPos);switch(_this19._mouseState){case MOUSE_FINDING_ORIGIN:var canvasBoundRect=canvas.getBoundingClientRect();var scrollLeft=window.pageXOffset||document.documentElement.scrollLeft;var scrollTop=window.pageYOffset||document.documentElement.scrollTop;var canvasLeftEdge=canvasBoundRect.left+scrollLeft;var canvasTopEdge=canvasBoundRect.top+scrollTop;_this19._markerDiv.style.marginLeft="".concat(canvasLeftEdge+canvasPos[0]-5,"px");_this19._markerDiv.style.marginTop="".concat(canvasTopEdge+canvasPos[1]-5,"px");break;case MOUSE_FINDING_CORNER:if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.originWireVisible=true;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.cornerVisible=true;_this19._currentAngleMeasurement.angleVisible=false;_this19._currentAngleMeasurement.corner.worldPos=event.worldPos;_this19._currentAngleMeasurement.corner.entity=event.entity;}_this19.markerDiv.style.marginLeft="-10000px";_this19.markerDiv.style.marginTop="-10000px";canvas.style.cursor="pointer";break;case MOUSE_FINDING_TARGET:if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.targetWireVisible=true;_this19._currentAngleMeasurement.targetVisible=true;_this19._currentAngleMeasurement.angleVisible=true;_this19._currentAngleMeasurement.target.worldPos=event.worldPos;_this19._currentAngleMeasurement.target.entity=event.entity;}_this19.markerDiv.style.marginLeft="-10000px";_this19.markerDiv.style.marginTop="-10000px";canvas.style.cursor="pointer";break;}});canvas.addEventListener('mousedown',this._onMouseDown=function(e){if(e.which!==1){return;}lastMouseCanvasX=e.clientX;lastMouseCanvasY=e.clientY;});canvas.addEventListener("mouseup",this._onMouseUp=function(e){if(e.which!==1){return;}if(e.clientX>lastMouseCanvasX+clickTolerance||e.clientX<lastMouseCanvasX-clickTolerance||e.clientY>lastMouseCanvasY+clickTolerance||e.clientY<lastMouseCanvasY-clickTolerance){return;}switch(_this19._mouseState){case MOUSE_FINDING_ORIGIN:if(mouseHovering){_this19._currentAngleMeasurement=_this19.angleMeasurementsPlugin.createMeasurement({id:math.createUUID(),origin:{worldPos:mouseWorldPos},corner:{worldPos:mouseWorldPos},target:{worldPos:mouseWorldPos},approximate:true});_this19._currentAngleMeasurement.clickable=false;_this19._currentAngleMeasurement.originVisible=true;_this19._currentAngleMeasurement.originWireVisible=true;_this19._currentAngleMeasurement.cornerVisible=false;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.targetVisible=false;_this19._currentAngleMeasurement.angleVisible=false;_this19._currentAngleMeasurement.origin.entity=hoveredEntity;_this19._mouseState=MOUSE_FINDING_CORNER;_this19.angleMeasurementsPlugin.fire("measurementStart",_this19._currentAngleMeasurement);}break;case MOUSE_FINDING_CORNER:if(mouseHovering){_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.targetVisible=true;_this19._currentAngleMeasurement.angleVisible=true;_this19._currentAngleMeasurement.corner.entity=hoveredEntity;_this19._mouseState=MOUSE_FINDING_TARGET;}else{if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.destroy();_this19._currentAngleMeasurement=null;hoveredEntity=null;_this19._mouseState=MOUSE_FINDING_ORIGIN;_this19.angleMeasurementsPlugin.fire("measurementCancel",_this19._currentAngleMeasurement);}}break;case MOUSE_FINDING_TARGET:if(mouseHovering){_this19._currentAngleMeasurement.targetVisible=true;_this19._currentAngleMeasurement.angleVisible=true;_this19._currentAngleMeasurement.target.entity=hoveredEntity;_this19._currentAngleMeasurement.clickable=true;hoveredEntity=null;_this19.angleMeasurementsPlugin.fire("measurementEnd",_this19._currentAngleMeasurement);_this19._currentAngleMeasurement=null;_this19._mouseState=MOUSE_FINDING_ORIGIN;}else{if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.destroy();_this19._currentAngleMeasurement=null;hoveredEntity=null;_this19._mouseState=MOUSE_FINDING_ORIGIN;_this19.angleMeasurementsPlugin.fire("measurementCancel",_this19._currentAngleMeasurement);}}break;}});this._onMouseHoverOff=cameraControl.on(this._snapping?"hoverSnapOrSurfaceOff":"hoverOff",function(event){mouseHovering=false;if(pointerLens){pointerLens.visible=true;pointerLens.pointerPos=event.canvasPos;pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;pointerLens.snapped=false;}_this19.markerDiv.style.marginLeft="-100px";_this19.markerDiv.style.marginTop="-100px";if(_this19._currentAngleMeasurement){switch(_this19._mouseState){case MOUSE_FINDING_ORIGIN:_this19._currentAngleMeasurement.originVisible=false;break;case MOUSE_FINDING_CORNER:_this19._currentAngleMeasurement.cornerVisible=false;_this19._currentAngleMeasurement.originWireVisible=false;_this19._currentAngleMeasurement.targetVisible=false;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.angleVisible=false;break;case MOUSE_FINDING_TARGET:_this19._currentAngleMeasurement.targetVisible=false;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.angleVisible=false;break;}canvas.style.cursor="default";}});this._active=true;}/**
|
|
2983
2983
|
* Deactivates this AngleMeasurementsMouseControl, making it unresponsive to input.
|
|
2984
2984
|
*
|
|
2985
2985
|
* Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl.
|
|
@@ -18947,7 +18947,7 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s
|
|
|
18947
18947
|
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
|
|
18948
18948
|
*/function get(){return this._snapping;}/**
|
|
18949
18949
|
* Activates this DistanceMeasurementsMouseControl, ready to respond to input.
|
|
18950
|
-
*/,set:function set(snapping){if(snapping!==this._snapping){this._snapping=snapping;this.deactivate();this.activate();}else{this._snapping=snapping;}}},{key:"activate",value:function activate(){var _this82=this;if(this._active){return;}if(!this._markerDiv){this._initMarkerDiv();}this.fire("activated",true);var distanceMeasurementsPlugin=this.distanceMeasurementsPlugin;var scene=this.scene;var cameraControl=distanceMeasurementsPlugin.viewer.cameraControl;var canvas=scene.canvas.canvas;scene.input;var mouseHovering=false;var pointerWorldPos=math.vec3();var pointerCanvasPos=math.vec2();var pointerDownCanvasX;var pointerDownCanvasY;var clickTolerance=20;var hoveredEntity=null;this._mouseState=MOUSE_FIRST_CLICK_EXPECTED;this._onCameraControlHoverSnapOrSurface=cameraControl.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",function(event){var canvasPos=event.snappedCanvasPos||event.canvasPos;mouseHovering=true;pointerWorldPos.set(event.worldPos);pointerCanvasPos.set(event.canvasPos);if(_this82._mouseState===MOUSE_FIRST_CLICK_EXPECTED){_this82._markerDiv.style.marginLeft="".concat(canvasPos[0]-5,"px");_this82._markerDiv.style.marginTop="".concat(canvasPos[1]-5,"px");_this82._markerDiv.style.background="pink";if(event.snappedToVertex||event.snappedToEdge){if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;_this82.pointerLens.snapped=true;}_this82._markerDiv.style.background="greenyellow";_this82._markerDiv.style.border="2px solid green";}else{if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.canvasPos;_this82.pointerLens.snapped=false;}_this82._markerDiv.style.background="pink";_this82._markerDiv.style.border="2px solid red";}hoveredEntity=event.entity;}else{_this82._markerDiv.style.marginLeft="-10000px";_this82._markerDiv.style.marginTop="-10000px";}canvas.style.cursor="pointer";if(_this82._currentDistanceMeasurement){_this82._currentDistanceMeasurement.wireVisible=_this82._currentDistanceMeasurementInitState.wireVisible;_this82._currentDistanceMeasurement.axisVisible=_this82._currentDistanceMeasurementInitState.axisVisible&&_this82.distanceMeasurementsPlugin.defaultAxisVisible;_this82._currentDistanceMeasurement.xAxisVisible=_this82._currentDistanceMeasurementInitState.xAxisVisible&&_this82.distanceMeasurementsPlugin.defaultXAxisVisible;_this82._currentDistanceMeasurement.yAxisVisible=_this82._currentDistanceMeasurementInitState.yAxisVisible&&_this82.distanceMeasurementsPlugin.defaultYAxisVisible;_this82._currentDistanceMeasurement.zAxisVisible=_this82._currentDistanceMeasurementInitState.zAxisVisible&&_this82.distanceMeasurementsPlugin.defaultZAxisVisible;_this82._currentDistanceMeasurement.targetVisible=_this82._currentDistanceMeasurementInitState.targetVisible;_this82._currentDistanceMeasurement.target.worldPos=pointerWorldPos.slice();_this82._markerDiv.style.marginLeft="-10000px";_this82._markerDiv.style.marginTop="-10000px";}});canvas.addEventListener('mousedown',this._onMouseDown=function(e){if(e.which!==1){return;}pointerDownCanvasX=e.clientX;pointerDownCanvasY=e.clientY;});canvas.addEventListener("mouseup",this._onMouseUp=function(e){if(e.which!==1){return;}if(e.clientX>pointerDownCanvasX+clickTolerance||e.clientX<pointerDownCanvasX-clickTolerance||e.clientY>pointerDownCanvasY+clickTolerance||e.clientY<pointerDownCanvasY-clickTolerance){return;}if(_this82._currentDistanceMeasurement){if(mouseHovering){_this82._currentDistanceMeasurement.target.entity=hoveredEntity;hoveredEntity=null;_this82._currentDistanceMeasurement.clickable=true;_this82.distanceMeasurementsPlugin.fire("measurementEnd",_this82._currentDistanceMeasurement);_this82._currentDistanceMeasurement=null;}else{_this82._currentDistanceMeasurement.destroy();_this82.distanceMeasurementsPlugin.fire("measurementCancel",_this82._currentDistanceMeasurement);_this82._currentDistanceMeasurement=null;hoveredEntity=null;}}else{if(mouseHovering){_this82._currentDistanceMeasurement=distanceMeasurementsPlugin.createMeasurement({id:math.createUUID(),origin:{worldPos:pointerWorldPos.slice()},target:{worldPos:pointerWorldPos.slice()},approximate:true});_this82._currentDistanceMeasurementInitState.axisVisible=_this82._currentDistanceMeasurement.axisVisible&&_this82.distanceMeasurementsPlugin.defaultAxisVisible;_this82._currentDistanceMeasurementInitState.xAxisVisible=_this82._currentDistanceMeasurement.xAxisVisible&&_this82.distanceMeasurementsPlugin.defaultXAxisVisible;_this82._currentDistanceMeasurementInitState.yAxisVisible=_this82._currentDistanceMeasurement.yAxisVisible&&_this82.distanceMeasurementsPlugin.defaultYAxisVisible;_this82._currentDistanceMeasurementInitState.zAxisVisible=_this82._currentDistanceMeasurement.zAxisVisible&&_this82.distanceMeasurementsPlugin.defaultZAxisVisible;_this82._currentDistanceMeasurementInitState.wireVisible=_this82._currentDistanceMeasurement.wireVisible;_this82._currentDistanceMeasurementInitState.targetVisible=_this82._currentDistanceMeasurement.targetVisible;_this82._currentDistanceMeasurement.clickable=false;_this82._currentDistanceMeasurement.origin.entity=hoveredEntity;hoveredEntity=null;_this82.fire("measurementStart",_this82._currentDistanceMeasurement);}}});this._onCameraControlHoverSnapOrSurfaceOff=cameraControl.on(this._snapping?"hoverSnapOrSurfaceOff":"hoverOff",function(event){if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;}mouseHovering=false;_this82._markerDiv.style.marginLeft="-100px";_this82._markerDiv.style.marginTop="-100px";if(_this82._currentDistanceMeasurement){_this82._currentDistanceMeasurement.wireVisible=false;_this82._currentDistanceMeasurement.targetVisible=false;_this82._currentDistanceMeasurement.axisVisible=false;}canvas.style.cursor="default";});this._active=true;}/**
|
|
18950
|
+
*/,set:function set(snapping){if(snapping!==this._snapping){this._snapping=snapping;this.deactivate();this.activate();}else{this._snapping=snapping;}}},{key:"activate",value:function activate(){var _this82=this;if(this._active){return;}if(!this._markerDiv){this._initMarkerDiv();}this.fire("activated",true);var distanceMeasurementsPlugin=this.distanceMeasurementsPlugin;var scene=this.scene;var cameraControl=distanceMeasurementsPlugin.viewer.cameraControl;var canvas=scene.canvas.canvas;scene.input;var mouseHovering=false;var pointerWorldPos=math.vec3();var pointerCanvasPos=math.vec2();var pointerDownCanvasX;var pointerDownCanvasY;var clickTolerance=20;var hoveredEntity=null;this._mouseState=MOUSE_FIRST_CLICK_EXPECTED;this._onCameraControlHoverSnapOrSurface=cameraControl.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",function(event){var canvasPos=event.snappedCanvasPos||event.canvasPos;mouseHovering=true;pointerWorldPos.set(event.worldPos);pointerCanvasPos.set(event.canvasPos);if(_this82._mouseState===MOUSE_FIRST_CLICK_EXPECTED){var canvasBoundRect=canvas.getBoundingClientRect();var scrollLeft=window.pageXOffset||document.documentElement.scrollLeft;var scrollTop=window.pageYOffset||document.documentElement.scrollTop;var canvasLeftEdge=canvasBoundRect.left+scrollLeft;var canvasTopEdge=canvasBoundRect.top+scrollTop;_this82._markerDiv.style.marginLeft="".concat(canvasLeftEdge+canvasPos[0]-5,"px");_this82._markerDiv.style.marginTop="".concat(canvasTopEdge+canvasPos[1]-5,"px");_this82._markerDiv.style.background="pink";if(event.snappedToVertex||event.snappedToEdge){if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;_this82.pointerLens.snapped=true;}_this82._markerDiv.style.background="greenyellow";_this82._markerDiv.style.border="2px solid green";}else{if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.canvasPos;_this82.pointerLens.snapped=false;}_this82._markerDiv.style.background="pink";_this82._markerDiv.style.border="2px solid red";}hoveredEntity=event.entity;}else{_this82._markerDiv.style.marginLeft="-10000px";_this82._markerDiv.style.marginTop="-10000px";}canvas.style.cursor="pointer";if(_this82._currentDistanceMeasurement){_this82._currentDistanceMeasurement.wireVisible=_this82._currentDistanceMeasurementInitState.wireVisible;_this82._currentDistanceMeasurement.axisVisible=_this82._currentDistanceMeasurementInitState.axisVisible&&_this82.distanceMeasurementsPlugin.defaultAxisVisible;_this82._currentDistanceMeasurement.xAxisVisible=_this82._currentDistanceMeasurementInitState.xAxisVisible&&_this82.distanceMeasurementsPlugin.defaultXAxisVisible;_this82._currentDistanceMeasurement.yAxisVisible=_this82._currentDistanceMeasurementInitState.yAxisVisible&&_this82.distanceMeasurementsPlugin.defaultYAxisVisible;_this82._currentDistanceMeasurement.zAxisVisible=_this82._currentDistanceMeasurementInitState.zAxisVisible&&_this82.distanceMeasurementsPlugin.defaultZAxisVisible;_this82._currentDistanceMeasurement.targetVisible=_this82._currentDistanceMeasurementInitState.targetVisible;_this82._currentDistanceMeasurement.target.worldPos=pointerWorldPos.slice();_this82._markerDiv.style.marginLeft="-10000px";_this82._markerDiv.style.marginTop="-10000px";}});canvas.addEventListener('mousedown',this._onMouseDown=function(e){if(e.which!==1){return;}pointerDownCanvasX=e.clientX;pointerDownCanvasY=e.clientY;});canvas.addEventListener("mouseup",this._onMouseUp=function(e){if(e.which!==1){return;}if(e.clientX>pointerDownCanvasX+clickTolerance||e.clientX<pointerDownCanvasX-clickTolerance||e.clientY>pointerDownCanvasY+clickTolerance||e.clientY<pointerDownCanvasY-clickTolerance){return;}if(_this82._currentDistanceMeasurement){if(mouseHovering){_this82._currentDistanceMeasurement.target.entity=hoveredEntity;hoveredEntity=null;_this82._currentDistanceMeasurement.clickable=true;_this82.distanceMeasurementsPlugin.fire("measurementEnd",_this82._currentDistanceMeasurement);_this82._currentDistanceMeasurement=null;}else{_this82._currentDistanceMeasurement.destroy();_this82.distanceMeasurementsPlugin.fire("measurementCancel",_this82._currentDistanceMeasurement);_this82._currentDistanceMeasurement=null;hoveredEntity=null;}}else{if(mouseHovering){_this82._currentDistanceMeasurement=distanceMeasurementsPlugin.createMeasurement({id:math.createUUID(),origin:{worldPos:pointerWorldPos.slice()},target:{worldPos:pointerWorldPos.slice()},approximate:true});_this82._currentDistanceMeasurementInitState.axisVisible=_this82._currentDistanceMeasurement.axisVisible&&_this82.distanceMeasurementsPlugin.defaultAxisVisible;_this82._currentDistanceMeasurementInitState.xAxisVisible=_this82._currentDistanceMeasurement.xAxisVisible&&_this82.distanceMeasurementsPlugin.defaultXAxisVisible;_this82._currentDistanceMeasurementInitState.yAxisVisible=_this82._currentDistanceMeasurement.yAxisVisible&&_this82.distanceMeasurementsPlugin.defaultYAxisVisible;_this82._currentDistanceMeasurementInitState.zAxisVisible=_this82._currentDistanceMeasurement.zAxisVisible&&_this82.distanceMeasurementsPlugin.defaultZAxisVisible;_this82._currentDistanceMeasurementInitState.wireVisible=_this82._currentDistanceMeasurement.wireVisible;_this82._currentDistanceMeasurementInitState.targetVisible=_this82._currentDistanceMeasurement.targetVisible;_this82._currentDistanceMeasurement.clickable=false;_this82._currentDistanceMeasurement.origin.entity=hoveredEntity;hoveredEntity=null;_this82.fire("measurementStart",_this82._currentDistanceMeasurement);}}});this._onCameraControlHoverSnapOrSurfaceOff=cameraControl.on(this._snapping?"hoverSnapOrSurfaceOff":"hoverOff",function(event){if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;}mouseHovering=false;_this82._markerDiv.style.marginLeft="-100px";_this82._markerDiv.style.marginTop="-100px";if(_this82._currentDistanceMeasurement){_this82._currentDistanceMeasurement.wireVisible=false;_this82._currentDistanceMeasurement.targetVisible=false;_this82._currentDistanceMeasurement.axisVisible=false;}canvas.style.cursor="default";});this._active=true;}/**
|
|
18951
18951
|
* Deactivates this DistanceMeasurementsMouseControl, making it unresponsive to input.
|
|
18952
18952
|
*
|
|
18953
18953
|
* Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.
|