@inweb/viewer-visualize 25.8.8 → 25.8.10
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/viewer-visualize.js +30 -18
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +40 -18
- package/dist/viewer-visualize.module.js.map +1 -1
- package/lib/Viewer/Draggers/MeasureLineDragger/index.d.ts +1 -0
- package/package.json +5 -5
- package/src/Viewer/Draggers/MeasureLineDragger/index.ts +10 -0
- package/src/Viewer/Viewer.ts +14 -6
package/dist/viewer-visualize.js
CHANGED
|
@@ -12268,7 +12268,7 @@
|
|
|
12268
12268
|
this._ref = ref;
|
|
12269
12269
|
return;
|
|
12270
12270
|
}
|
|
12271
|
-
if (!params.points) return;
|
|
12271
|
+
if (!params || !params.points) return;
|
|
12272
12272
|
const konvaPoints = [];
|
|
12273
12273
|
params.points.forEach((point => konvaPoints.push(point.x, point.y)));
|
|
12274
12274
|
this._ref = new Konva.Line({
|
|
@@ -12370,7 +12370,7 @@
|
|
|
12370
12370
|
this._ref = ref;
|
|
12371
12371
|
return;
|
|
12372
12372
|
}
|
|
12373
|
-
if (!params || !params.text) return;
|
|
12373
|
+
if (!params || !params.position || !params.text) return;
|
|
12374
12374
|
this._ref = new Konva.Text({
|
|
12375
12375
|
x: params.position.x,
|
|
12376
12376
|
y: params.position.y,
|
|
@@ -12472,7 +12472,7 @@
|
|
|
12472
12472
|
this._ref = ref;
|
|
12473
12473
|
return;
|
|
12474
12474
|
}
|
|
12475
|
-
if (!params.position) return;
|
|
12475
|
+
if (!params || !params.position) return;
|
|
12476
12476
|
this._ref = new Konva.Rect({
|
|
12477
12477
|
stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
|
|
12478
12478
|
strokeWidth: (_b = params.lineWidth) !== null && _b !== void 0 ? _b : 4,
|
|
@@ -12582,7 +12582,7 @@
|
|
|
12582
12582
|
this._ref = ref;
|
|
12583
12583
|
return;
|
|
12584
12584
|
}
|
|
12585
|
-
if (!params.position) return;
|
|
12585
|
+
if (!params || !params.position || !params.radius) return;
|
|
12586
12586
|
this._ref = new Konva.Ellipse({
|
|
12587
12587
|
stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
|
|
12588
12588
|
strokeWidth: (_b = params.lineWidth) !== null && _b !== void 0 ? _b : 4,
|
|
@@ -12704,7 +12704,7 @@
|
|
|
12704
12704
|
this._ref = ref;
|
|
12705
12705
|
return;
|
|
12706
12706
|
}
|
|
12707
|
-
if (!params.start || !params.end) return;
|
|
12707
|
+
if (!params || !params.start || !params.end) return;
|
|
12708
12708
|
this._ref = new Konva.Arrow({
|
|
12709
12709
|
stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
|
|
12710
12710
|
fill: (_b = params.color) !== null && _b !== void 0 ? _b : "#ff0000",
|
|
@@ -12798,22 +12798,22 @@
|
|
|
12798
12798
|
|
|
12799
12799
|
class KonvaImage {
|
|
12800
12800
|
constructor(params, ref = null) {
|
|
12801
|
+
var _a, _b;
|
|
12801
12802
|
this._ratio = 1;
|
|
12802
12803
|
if (ref) {
|
|
12803
|
-
if (ref.height() === 0 || ref.width() === 0) return;
|
|
12804
12804
|
this._ref = ref;
|
|
12805
12805
|
this._canvasImage = ref.image();
|
|
12806
|
-
this._ratio = this._ref.height() / this._ref.width();
|
|
12806
|
+
this._ratio = this._ref.height() === 0 || this._ref.width() === 0 ? 1 : this._ref.height() / this._ref.width();
|
|
12807
12807
|
return;
|
|
12808
12808
|
}
|
|
12809
|
-
if (!params.position || !params.src) return;
|
|
12809
|
+
if (!params || !params.position || !params.src) return;
|
|
12810
12810
|
this._canvasImage = new Image;
|
|
12811
12811
|
this._ref = new Konva.Image({
|
|
12812
12812
|
x: params.position.x,
|
|
12813
12813
|
y: params.position.y,
|
|
12814
12814
|
image: this._canvasImage,
|
|
12815
|
-
width: params.width,
|
|
12816
|
-
height: params.height,
|
|
12815
|
+
width: (_a = params.width) !== null && _a !== void 0 ? _a : 0,
|
|
12816
|
+
height: (_b = params.height) !== null && _b !== void 0 ? _b : 0,
|
|
12817
12817
|
draggable: true
|
|
12818
12818
|
});
|
|
12819
12819
|
this._canvasImage.onload = () => {
|
|
@@ -12921,7 +12921,7 @@
|
|
|
12921
12921
|
this._ref = ref;
|
|
12922
12922
|
return;
|
|
12923
12923
|
}
|
|
12924
|
-
if (!params
|
|
12924
|
+
if (!params || !params.position) return;
|
|
12925
12925
|
const arcRadius = 16;
|
|
12926
12926
|
this._ref = new Konva.Shape({
|
|
12927
12927
|
x: params.position.x,
|
|
@@ -13125,7 +13125,7 @@
|
|
|
13125
13125
|
},
|
|
13126
13126
|
Cloud: {
|
|
13127
13127
|
name: "Cloud",
|
|
13128
|
-
initializer: ref => new KonvaCloud(
|
|
13128
|
+
initializer: (ref, params = null) => new KonvaCloud(params, ref),
|
|
13129
13129
|
zIndex: 1
|
|
13130
13130
|
}
|
|
13131
13131
|
};
|
|
@@ -14560,6 +14560,14 @@
|
|
|
14560
14560
|
pt2[1] -= pt1[1];
|
|
14561
14561
|
return Math.min(pt2[0], pt2[1]) / 120;
|
|
14562
14562
|
}
|
|
14563
|
+
start(x, y) {
|
|
14564
|
+
this.createNewMeasureIfNeed();
|
|
14565
|
+
const point = this.getViewer().getSnapPoint(x, y, this.gripingRadius);
|
|
14566
|
+
if (point) {
|
|
14567
|
+
this.firstPoint = point;
|
|
14568
|
+
this.previewMeasureLine.setStartPoint(this.firstPoint);
|
|
14569
|
+
}
|
|
14570
|
+
}
|
|
14563
14571
|
drag(x, y) {
|
|
14564
14572
|
this.createNewMeasureIfNeed();
|
|
14565
14573
|
const point = this.getViewer().getSnapPoint(x, y, this.gripingRadius);
|
|
@@ -17161,11 +17169,15 @@
|
|
|
17161
17169
|
//return visViewer.activeView.upVector[1] >= 0.95;
|
|
17162
17170
|
}
|
|
17163
17171
|
screenToWorld(position) {
|
|
17164
|
-
|
|
17172
|
+
if (!this.visualizeJs)
|
|
17173
|
+
return { x: position.x, y: position.y, z: 0 };
|
|
17174
|
+
const worldPoint = this.visViewer().screenToWorld(position.x * window.devicePixelRatio, position.y * window.devicePixelRatio);
|
|
17175
|
+
const result = { x: worldPoint[0], y: worldPoint[1], z: worldPoint[2] };
|
|
17176
|
+
return result;
|
|
17165
17177
|
}
|
|
17166
17178
|
worldToScreen(position) {
|
|
17167
17179
|
if (!this.visualizeJs)
|
|
17168
|
-
return position;
|
|
17180
|
+
return { x: position.x, y: position.y };
|
|
17169
17181
|
const activeView = this.visViewer().activeView;
|
|
17170
17182
|
const worldMatrix = activeView.worldToDeviceMatrix;
|
|
17171
17183
|
const worldPoint = this.visLib().Point3d.createFromArray([position.x, position.y, position.z]);
|
|
@@ -17181,15 +17193,15 @@
|
|
|
17181
17193
|
const result = { x: 1.0, y: 1.0, z: 1.0 };
|
|
17182
17194
|
const projMatrix = this.visViewer().activeView.projectionMatrix;
|
|
17183
17195
|
const tolerance = 1.0e-6;
|
|
17184
|
-
const x = projMatrix.get(
|
|
17196
|
+
const x = projMatrix.get(0, 0);
|
|
17185
17197
|
if (x > tolerance || x < -tolerance)
|
|
17186
|
-
result.x = 1 /
|
|
17198
|
+
result.x = 1 / x;
|
|
17187
17199
|
const y = projMatrix.get(1, 1);
|
|
17188
17200
|
if (y > tolerance || y < -tolerance)
|
|
17189
|
-
result.y = 1 /
|
|
17201
|
+
result.y = 1 / y;
|
|
17190
17202
|
const z = projMatrix.get(2, 2);
|
|
17191
17203
|
if (z > tolerance || z < -tolerance)
|
|
17192
|
-
result.z = 1 /
|
|
17204
|
+
result.z = 1 / z;
|
|
17193
17205
|
return result;
|
|
17194
17206
|
}
|
|
17195
17207
|
/**
|