@inweb/viewer-visualize 25.8.8 → 25.8.9
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 +29 -16
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +39 -16
- 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,6 +12798,7 @@
|
|
|
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
12804
|
if (ref.height() === 0 || ref.width() === 0) return;
|
|
@@ -12806,14 +12807,14 @@
|
|
|
12806
12807
|
this._ratio = this._ref.height() / this._ref.width();
|
|
12807
12808
|
return;
|
|
12808
12809
|
}
|
|
12809
|
-
if (!params.position || !params.src) return;
|
|
12810
|
+
if (!params || !params.position || !params.src) return;
|
|
12810
12811
|
this._canvasImage = new Image;
|
|
12811
12812
|
this._ref = new Konva.Image({
|
|
12812
12813
|
x: params.position.x,
|
|
12813
12814
|
y: params.position.y,
|
|
12814
12815
|
image: this._canvasImage,
|
|
12815
|
-
width: params.width,
|
|
12816
|
-
height: params.height,
|
|
12816
|
+
width: (_a = params.width) !== null && _a !== void 0 ? _a : 0,
|
|
12817
|
+
height: (_b = params.height) !== null && _b !== void 0 ? _b : 0,
|
|
12817
12818
|
draggable: true
|
|
12818
12819
|
});
|
|
12819
12820
|
this._canvasImage.onload = () => {
|
|
@@ -12921,7 +12922,7 @@
|
|
|
12921
12922
|
this._ref = ref;
|
|
12922
12923
|
return;
|
|
12923
12924
|
}
|
|
12924
|
-
if (!params
|
|
12925
|
+
if (!params || !params.position) return;
|
|
12925
12926
|
const arcRadius = 16;
|
|
12926
12927
|
this._ref = new Konva.Shape({
|
|
12927
12928
|
x: params.position.x,
|
|
@@ -13125,7 +13126,7 @@
|
|
|
13125
13126
|
},
|
|
13126
13127
|
Cloud: {
|
|
13127
13128
|
name: "Cloud",
|
|
13128
|
-
initializer: ref => new KonvaCloud(
|
|
13129
|
+
initializer: (ref, params = null) => new KonvaCloud(params, ref),
|
|
13129
13130
|
zIndex: 1
|
|
13130
13131
|
}
|
|
13131
13132
|
};
|
|
@@ -14560,6 +14561,14 @@
|
|
|
14560
14561
|
pt2[1] -= pt1[1];
|
|
14561
14562
|
return Math.min(pt2[0], pt2[1]) / 120;
|
|
14562
14563
|
}
|
|
14564
|
+
start(x, y) {
|
|
14565
|
+
this.createNewMeasureIfNeed();
|
|
14566
|
+
const point = this.getViewer().getSnapPoint(x, y, this.gripingRadius);
|
|
14567
|
+
if (point) {
|
|
14568
|
+
this.firstPoint = point;
|
|
14569
|
+
this.previewMeasureLine.setStartPoint(this.firstPoint);
|
|
14570
|
+
}
|
|
14571
|
+
}
|
|
14563
14572
|
drag(x, y) {
|
|
14564
14573
|
this.createNewMeasureIfNeed();
|
|
14565
14574
|
const point = this.getViewer().getSnapPoint(x, y, this.gripingRadius);
|
|
@@ -17161,11 +17170,15 @@
|
|
|
17161
17170
|
//return visViewer.activeView.upVector[1] >= 0.95;
|
|
17162
17171
|
}
|
|
17163
17172
|
screenToWorld(position) {
|
|
17164
|
-
|
|
17173
|
+
if (!this.visualizeJs)
|
|
17174
|
+
return { x: position.x, y: position.y, z: 0 };
|
|
17175
|
+
const worldPoint = this.visViewer().screenToWorld(position.x * window.devicePixelRatio, position.y * window.devicePixelRatio);
|
|
17176
|
+
const result = { x: worldPoint[0], y: worldPoint[1], z: worldPoint[2] };
|
|
17177
|
+
return result;
|
|
17165
17178
|
}
|
|
17166
17179
|
worldToScreen(position) {
|
|
17167
17180
|
if (!this.visualizeJs)
|
|
17168
|
-
return position;
|
|
17181
|
+
return { x: position.x, y: position.y };
|
|
17169
17182
|
const activeView = this.visViewer().activeView;
|
|
17170
17183
|
const worldMatrix = activeView.worldToDeviceMatrix;
|
|
17171
17184
|
const worldPoint = this.visLib().Point3d.createFromArray([position.x, position.y, position.z]);
|
|
@@ -17181,15 +17194,15 @@
|
|
|
17181
17194
|
const result = { x: 1.0, y: 1.0, z: 1.0 };
|
|
17182
17195
|
const projMatrix = this.visViewer().activeView.projectionMatrix;
|
|
17183
17196
|
const tolerance = 1.0e-6;
|
|
17184
|
-
const x = projMatrix.get(
|
|
17197
|
+
const x = projMatrix.get(0, 0);
|
|
17185
17198
|
if (x > tolerance || x < -tolerance)
|
|
17186
|
-
result.x = 1 /
|
|
17199
|
+
result.x = 1 / x;
|
|
17187
17200
|
const y = projMatrix.get(1, 1);
|
|
17188
17201
|
if (y > tolerance || y < -tolerance)
|
|
17189
|
-
result.y = 1 /
|
|
17202
|
+
result.y = 1 / y;
|
|
17190
17203
|
const z = projMatrix.get(2, 2);
|
|
17191
17204
|
if (z > tolerance || z < -tolerance)
|
|
17192
|
-
result.z = 1 /
|
|
17205
|
+
result.z = 1 / z;
|
|
17193
17206
|
return result;
|
|
17194
17207
|
}
|
|
17195
17208
|
/**
|