@inweb/viewer-visualize 26.1.2 → 26.1.4
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 +554 -586
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +77 -78
- package/dist/viewer-visualize.module.js.map +1 -1
- package/lib/Viewer/Commands/index.d.ts +8 -14
- package/lib/Viewer/Components/index.d.ts +20 -20
- package/lib/Viewer/Draggers/index.d.ts +19 -25
- package/lib/Viewer/Viewer.d.ts +55 -58
- package/package.json +6 -6
- package/src/Viewer/Commands/GetSelected.ts +2 -2
- package/src/Viewer/Commands/index.ts +8 -14
- package/src/Viewer/Components/index.ts +20 -20
- package/src/Viewer/Draggers/index.ts +19 -25
- package/src/Viewer/Viewer.ts +56 -60
|
@@ -35,7 +35,7 @@ class CommandsRegistry {
|
|
|
35
35
|
}
|
|
36
36
|
const {handler: handler, thisArg: thisArg} = command;
|
|
37
37
|
const result = handler.apply(thisArg, [ viewer, ...args ]);
|
|
38
|
-
viewer === null || viewer ===
|
|
38
|
+
viewer === null || viewer === void 0 ? void 0 : viewer.emit({
|
|
39
39
|
type: "command",
|
|
40
40
|
data: id,
|
|
41
41
|
args: args
|
|
@@ -531,8 +531,8 @@ class KonvaLine {
|
|
|
531
531
|
const konvaPoints = [];
|
|
532
532
|
params.points.forEach((point => konvaPoints.push(point.x, point.y)));
|
|
533
533
|
this._ref = new Konva.Line({
|
|
534
|
-
stroke: (_a = params.color) !== null && _a !==
|
|
535
|
-
strokeWidth: (_b = params.width) !== null && _b !==
|
|
534
|
+
stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
|
|
535
|
+
strokeWidth: (_b = params.width) !== null && _b !== void 0 ? _b : 4,
|
|
536
536
|
globalCompositeOperation: "source-over",
|
|
537
537
|
lineCap: "round",
|
|
538
538
|
lineJoin: "round",
|
|
@@ -639,12 +639,12 @@ class KonvaText {
|
|
|
639
639
|
x: params.position.x,
|
|
640
640
|
y: params.position.y,
|
|
641
641
|
text: params.text,
|
|
642
|
-
fontSize: (_a = params.fontSize) !== null && _a !==
|
|
642
|
+
fontSize: (_a = params.fontSize) !== null && _a !== void 0 ? _a : 34,
|
|
643
643
|
fontFamily: this.TEXT_FONT_FAMILY,
|
|
644
|
-
fill: (_b = params.color) !== null && _b !==
|
|
644
|
+
fill: (_b = params.color) !== null && _b !== void 0 ? _b : "#ff0000",
|
|
645
645
|
align: "left",
|
|
646
646
|
draggable: true,
|
|
647
|
-
rotation: (_c = params.rotation) !== null && _c !==
|
|
647
|
+
rotation: (_c = params.rotation) !== null && _c !== void 0 ? _c : 0
|
|
648
648
|
});
|
|
649
649
|
this._ref.width(this._ref.getTextWidth());
|
|
650
650
|
this._ref.on("transform", (e => {
|
|
@@ -742,15 +742,15 @@ class KonvaRectangle {
|
|
|
742
742
|
y: 100
|
|
743
743
|
};
|
|
744
744
|
this._ref = new Konva.Rect({
|
|
745
|
-
stroke: (_a = params.color) !== null && _a !==
|
|
746
|
-
strokeWidth: (_b = params.lineWidth) !== null && _b !==
|
|
745
|
+
stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
|
|
746
|
+
strokeWidth: (_b = params.lineWidth) !== null && _b !== void 0 ? _b : 4,
|
|
747
747
|
globalCompositeOperation: "source-over",
|
|
748
748
|
lineCap: "round",
|
|
749
749
|
lineJoin: "round",
|
|
750
750
|
x: params.position.x,
|
|
751
751
|
y: params.position.y,
|
|
752
|
-
width: (_c = params.width) !== null && _c !==
|
|
753
|
-
height: (_d = params.height) !== null && _d !==
|
|
752
|
+
width: (_c = params.width) !== null && _c !== void 0 ? _c : 200,
|
|
753
|
+
height: (_d = params.height) !== null && _d !== void 0 ? _d : 200,
|
|
754
754
|
draggable: true,
|
|
755
755
|
strokeScaleEnabled: false
|
|
756
756
|
});
|
|
@@ -860,8 +860,8 @@ class KonvaEllipse {
|
|
|
860
860
|
y: 25
|
|
861
861
|
};
|
|
862
862
|
this._ref = new Konva.Ellipse({
|
|
863
|
-
stroke: (_a = params.color) !== null && _a !==
|
|
864
|
-
strokeWidth: (_b = params.lineWidth) !== null && _b !==
|
|
863
|
+
stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
|
|
864
|
+
strokeWidth: (_b = params.lineWidth) !== null && _b !== void 0 ? _b : 4,
|
|
865
865
|
globalCompositeOperation: "source-over",
|
|
866
866
|
lineCap: "round",
|
|
867
867
|
lineJoin: "round",
|
|
@@ -990,8 +990,8 @@ class KonvaArrow {
|
|
|
990
990
|
y: 100
|
|
991
991
|
};
|
|
992
992
|
this._ref = new Konva.Arrow({
|
|
993
|
-
stroke: (_a = params.color) !== null && _a !==
|
|
994
|
-
fill: (_b = params.color) !== null && _b !==
|
|
993
|
+
stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
|
|
994
|
+
fill: (_b = params.color) !== null && _b !== void 0 ? _b : "#ff0000",
|
|
995
995
|
strokeWidth: 4,
|
|
996
996
|
globalCompositeOperation: "source-over",
|
|
997
997
|
lineCap: "round",
|
|
@@ -1131,8 +1131,8 @@ class KonvaImage {
|
|
|
1131
1131
|
x: params.position.x,
|
|
1132
1132
|
y: params.position.y,
|
|
1133
1133
|
image: this._canvasImage,
|
|
1134
|
-
width: (_a = params.width) !== null && _a !==
|
|
1135
|
-
height: (_b = params.height) !== null && _b !==
|
|
1134
|
+
width: (_a = params.width) !== null && _a !== void 0 ? _a : 0,
|
|
1135
|
+
height: (_b = params.height) !== null && _b !== void 0 ? _b : 0,
|
|
1136
1136
|
draggable: true
|
|
1137
1137
|
});
|
|
1138
1138
|
this._ref.on("transform", (e => {
|
|
@@ -1242,10 +1242,10 @@ class KonvaCloud {
|
|
|
1242
1242
|
this._ref = new Konva.Shape({
|
|
1243
1243
|
x: params.position.x,
|
|
1244
1244
|
y: params.position.y,
|
|
1245
|
-
width: (_a = params.width) !== null && _a !==
|
|
1246
|
-
height: (_b = params.height) !== null && _b !==
|
|
1247
|
-
stroke: (_c = params.color) !== null && _c !==
|
|
1248
|
-
strokeWidth: (_d = params.lineWidth) !== null && _d !==
|
|
1245
|
+
width: (_a = params.width) !== null && _a !== void 0 ? _a : 200,
|
|
1246
|
+
height: (_b = params.height) !== null && _b !== void 0 ? _b : 200,
|
|
1247
|
+
stroke: (_c = params.color) !== null && _c !== void 0 ? _c : "#ff0000",
|
|
1248
|
+
strokeWidth: (_d = params.lineWidth) !== null && _d !== void 0 ? _d : 4,
|
|
1249
1249
|
draggable: true,
|
|
1250
1250
|
strokeScaleEnabled: false,
|
|
1251
1251
|
globalCompositeOperation: "source-over",
|
|
@@ -1494,9 +1494,9 @@ class KonvaMarkup {
|
|
|
1494
1494
|
initialize(container, containerEvents, viewer, worldTransformer) {
|
|
1495
1495
|
if (!Konva) throw new Error('Markup error: Konva is not initialized. Forgot to add <script src="https://unpkg.com/konva@9/konva.min.js"><\/script> to your page?');
|
|
1496
1496
|
this._viewer = viewer;
|
|
1497
|
-
this._worldTransformer = worldTransformer !== null && worldTransformer !==
|
|
1497
|
+
this._worldTransformer = worldTransformer !== null && worldTransformer !== void 0 ? worldTransformer : new WorldTransform;
|
|
1498
1498
|
this._container = container;
|
|
1499
|
-
this._containerEvents = containerEvents !== null && containerEvents !==
|
|
1499
|
+
this._containerEvents = containerEvents !== null && containerEvents !== void 0 ? containerEvents : [];
|
|
1500
1500
|
this._markupContainer = document.createElement("div");
|
|
1501
1501
|
this._markupContainer.id = "markup-container";
|
|
1502
1502
|
this._markupContainer.style.position = "absolute";
|
|
@@ -1524,9 +1524,9 @@ class KonvaMarkup {
|
|
|
1524
1524
|
this._viewer.removeEventListener("changeactivedragger", this.changeActiveDragger);
|
|
1525
1525
|
}
|
|
1526
1526
|
this.destroyKonva();
|
|
1527
|
-
(_a = this._resizeObserver) === null || _a ===
|
|
1527
|
+
(_a = this._resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
1528
1528
|
this._resizeObserver = undefined;
|
|
1529
|
-
(_b = this._markupContainer) === null || _b ===
|
|
1529
|
+
(_b = this._markupContainer) === null || _b === void 0 ? void 0 : _b.remove();
|
|
1530
1530
|
this._markupContainer = undefined;
|
|
1531
1531
|
this._container = undefined;
|
|
1532
1532
|
this._viewer = undefined;
|
|
@@ -1558,14 +1558,14 @@ class KonvaMarkup {
|
|
|
1558
1558
|
const hexColor = new MarkupColor(r, g, b).asHex();
|
|
1559
1559
|
this.getObjects().filter((obj => {
|
|
1560
1560
|
var _a;
|
|
1561
|
-
return (_a = obj.setColor) === null || _a ===
|
|
1561
|
+
return (_a = obj.setColor) === null || _a === void 0 ? void 0 : _a.call(obj, hexColor);
|
|
1562
1562
|
}));
|
|
1563
1563
|
}
|
|
1564
1564
|
colorizeSelectedMarkups(r, g, b) {
|
|
1565
1565
|
const hexColor = new MarkupColor(r, g, b).asHex();
|
|
1566
1566
|
this.getSelectedObjects().filter((obj => {
|
|
1567
1567
|
var _a;
|
|
1568
|
-
return (_a = obj.setColor) === null || _a ===
|
|
1568
|
+
return (_a = obj.setColor) === null || _a === void 0 ? void 0 : _a.call(obj, hexColor);
|
|
1569
1569
|
}));
|
|
1570
1570
|
}
|
|
1571
1571
|
setViewpoint(viewpoint) {
|
|
@@ -1581,13 +1581,13 @@ class KonvaMarkup {
|
|
|
1581
1581
|
x: 0,
|
|
1582
1582
|
y: 0
|
|
1583
1583
|
});
|
|
1584
|
-
const markupColor = ((_a = viewpoint.custom_fields) === null || _a ===
|
|
1584
|
+
const markupColor = ((_a = viewpoint.custom_fields) === null || _a === void 0 ? void 0 : _a.markup_color) || {
|
|
1585
1585
|
r: 255,
|
|
1586
1586
|
g: 0,
|
|
1587
1587
|
b: 0
|
|
1588
1588
|
};
|
|
1589
1589
|
this.setMarkupColor(markupColor.r, markupColor.g, markupColor.b);
|
|
1590
|
-
(_b = viewpoint.lines) === null || _b ===
|
|
1590
|
+
(_b = viewpoint.lines) === null || _b === void 0 ? void 0 : _b.forEach((line => {
|
|
1591
1591
|
const linePoints = [];
|
|
1592
1592
|
line.points.forEach((point => {
|
|
1593
1593
|
const screenPoint = this._worldTransformer.worldToScreen(point);
|
|
@@ -1596,28 +1596,28 @@ class KonvaMarkup {
|
|
|
1596
1596
|
}));
|
|
1597
1597
|
this.addLine(linePoints, line.color, line.type, line.width, line.id);
|
|
1598
1598
|
}));
|
|
1599
|
-
(_c = viewpoint.texts) === null || _c ===
|
|
1599
|
+
(_c = viewpoint.texts) === null || _c === void 0 ? void 0 : _c.forEach((text => {
|
|
1600
1600
|
const screenPoint = this._worldTransformer.worldToScreen(text.position);
|
|
1601
1601
|
this.addText(text.text, screenPoint, text.angle, text.color, text.text_size, text.font_size, text.id);
|
|
1602
1602
|
}));
|
|
1603
|
-
(_d = viewpoint.rectangles) === null || _d ===
|
|
1603
|
+
(_d = viewpoint.rectangles) === null || _d === void 0 ? void 0 : _d.forEach((rect => {
|
|
1604
1604
|
const screenPoint = this._worldTransformer.worldToScreen(rect.position);
|
|
1605
1605
|
this.addRectangle(screenPoint, rect.width, rect.height, rect.line_width, rect.color, rect.id);
|
|
1606
1606
|
}));
|
|
1607
|
-
(_e = viewpoint.ellipses) === null || _e ===
|
|
1607
|
+
(_e = viewpoint.ellipses) === null || _e === void 0 ? void 0 : _e.forEach((ellipse => {
|
|
1608
1608
|
const screenPoint = this._worldTransformer.worldToScreen(ellipse.position);
|
|
1609
1609
|
this.addEllipse(screenPoint, ellipse.radius, ellipse.line_width, ellipse.color, ellipse.id);
|
|
1610
1610
|
}));
|
|
1611
|
-
(_f = viewpoint.arrows) === null || _f ===
|
|
1611
|
+
(_f = viewpoint.arrows) === null || _f === void 0 ? void 0 : _f.forEach((arrow => {
|
|
1612
1612
|
const startPoint = this._worldTransformer.worldToScreen(arrow.start);
|
|
1613
1613
|
const endPoint = this._worldTransformer.worldToScreen(arrow.end);
|
|
1614
1614
|
this.addArrow(startPoint, endPoint, arrow.color, arrow.id);
|
|
1615
1615
|
}));
|
|
1616
|
-
(_g = viewpoint.clouds) === null || _g ===
|
|
1616
|
+
(_g = viewpoint.clouds) === null || _g === void 0 ? void 0 : _g.forEach((cloud => {
|
|
1617
1617
|
const screenPoint = this._worldTransformer.worldToScreen(cloud.position);
|
|
1618
1618
|
this.addCloud(screenPoint, cloud.width, cloud.height, cloud.line_width, cloud.color, cloud.id);
|
|
1619
1619
|
}));
|
|
1620
|
-
(_h = viewpoint.images) === null || _h ===
|
|
1620
|
+
(_h = viewpoint.images) === null || _h === void 0 ? void 0 : _h.forEach((image => {
|
|
1621
1621
|
const screenPoint = this._worldTransformer.worldToScreen(image.position);
|
|
1622
1622
|
this.addImage(screenPoint, image.src, image.width, image.height, image.id);
|
|
1623
1623
|
}));
|
|
@@ -1911,7 +1911,7 @@ class KonvaMarkup {
|
|
|
1911
1911
|
this.removeTextInput();
|
|
1912
1912
|
this.removeImageInput();
|
|
1913
1913
|
this.clearOverlay();
|
|
1914
|
-
(_a = this._konvaStage) === null || _a ===
|
|
1914
|
+
(_a = this._konvaStage) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
1915
1915
|
this._groupImages = undefined;
|
|
1916
1916
|
this._groupGeometry = undefined;
|
|
1917
1917
|
this._groupTexts = undefined;
|
|
@@ -2161,7 +2161,7 @@ class KonvaMarkup {
|
|
|
2161
2161
|
}
|
|
2162
2162
|
removeTextInput() {
|
|
2163
2163
|
var _a;
|
|
2164
|
-
(_a = this._textInputRef) === null || _a ===
|
|
2164
|
+
(_a = this._textInputRef) === null || _a === void 0 ? void 0 : _a.remove();
|
|
2165
2165
|
this._textInputRef = null;
|
|
2166
2166
|
this._textInputPos = null;
|
|
2167
2167
|
this._textInputAngle = 0;
|
|
@@ -2204,14 +2204,14 @@ class KonvaMarkup {
|
|
|
2204
2204
|
}
|
|
2205
2205
|
removeImageInput() {
|
|
2206
2206
|
var _a;
|
|
2207
|
-
(_a = this._imageInputRef) === null || _a ===
|
|
2207
|
+
(_a = this._imageInputRef) === null || _a === void 0 ? void 0 : _a.remove();
|
|
2208
2208
|
this._imageInputRef = null;
|
|
2209
2209
|
this._imageInputPos = null;
|
|
2210
2210
|
}
|
|
2211
2211
|
addText(text, position, angle, color, textSize, fontSize, id) {
|
|
2212
2212
|
var _a;
|
|
2213
2213
|
if (!text) return;
|
|
2214
|
-
(_a = this.getSelectedObjects().at(0)) === null || _a ===
|
|
2214
|
+
(_a = this.getSelectedObjects().at(0)) === null || _a === void 0 ? void 0 : _a.delete();
|
|
2215
2215
|
this.clearSelected();
|
|
2216
2216
|
this.removeTextInput();
|
|
2217
2217
|
const tolerance = 1e-6;
|
|
@@ -2286,7 +2286,7 @@ class KonvaMarkup {
|
|
|
2286
2286
|
addImage(position, src, width, height, id) {
|
|
2287
2287
|
var _a;
|
|
2288
2288
|
if (!position || !src) return;
|
|
2289
|
-
(_a = this.getSelectedObjects().at(0)) === null || _a ===
|
|
2289
|
+
(_a = this.getSelectedObjects().at(0)) === null || _a === void 0 ? void 0 : _a.delete();
|
|
2290
2290
|
this.clearSelected();
|
|
2291
2291
|
this.removeImageInput();
|
|
2292
2292
|
const konvaImage = new KonvaImage({
|
|
@@ -2309,7 +2309,7 @@ class OdaGeAction {
|
|
|
2309
2309
|
var _a;
|
|
2310
2310
|
const extView = this.m_module.getViewer().getActiveTvExtendedView();
|
|
2311
2311
|
extView.setView(params.position, params.target, params.upVector, params.viewFieldWidth, params.viewFieldHeight, params.perspective);
|
|
2312
|
-
(_a = extView.delete) === null || _a ===
|
|
2312
|
+
(_a = extView.delete) === null || _a === void 0 ? void 0 : _a.call(extView);
|
|
2313
2313
|
};
|
|
2314
2314
|
this.getViewParams = () => {
|
|
2315
2315
|
var _a;
|
|
@@ -2322,7 +2322,7 @@ class OdaGeAction {
|
|
|
2322
2322
|
viewFieldHeight: view.viewFieldHeight,
|
|
2323
2323
|
perspective: view.perspective
|
|
2324
2324
|
};
|
|
2325
|
-
(_a = view.delete) === null || _a ===
|
|
2325
|
+
(_a = view.delete) === null || _a === void 0 ? void 0 : _a.call(view);
|
|
2326
2326
|
return obj;
|
|
2327
2327
|
};
|
|
2328
2328
|
this.m_module = module;
|
|
@@ -2544,7 +2544,7 @@ class OdBaseDragger extends OdaGeAction {
|
|
|
2544
2544
|
deleteAll(objects) {
|
|
2545
2545
|
var _a;
|
|
2546
2546
|
for (const obj of objects) {
|
|
2547
|
-
(_a = obj === null || obj ===
|
|
2547
|
+
(_a = obj === null || obj === void 0 ? void 0 : obj.delete) === null || _a === void 0 ? void 0 : _a.call(obj);
|
|
2548
2548
|
}
|
|
2549
2549
|
}
|
|
2550
2550
|
updatePreview() {}
|
|
@@ -2913,7 +2913,7 @@ class MeasureLineDragger extends OdBaseDragger {
|
|
|
2913
2913
|
};
|
|
2914
2914
|
this.items = [];
|
|
2915
2915
|
this.canvasEvents.push("resize");
|
|
2916
|
-
this.oldRulerUnit = (_a = subject.options.rulerUnit) !== null && _a !==
|
|
2916
|
+
this.oldRulerUnit = (_a = subject.options.rulerUnit) !== null && _a !== void 0 ? _a : "Default";
|
|
2917
2917
|
this.optionsChange = this.optionsChange.bind(this);
|
|
2918
2918
|
}
|
|
2919
2919
|
initialize() {
|
|
@@ -3022,7 +3022,7 @@ class MeasureLineDragger extends OdBaseDragger {
|
|
|
3022
3022
|
optionsChange(event) {
|
|
3023
3023
|
var _a;
|
|
3024
3024
|
const options = event.data;
|
|
3025
|
-
const toUnitName = (_a = options.rulerUnit) !== null && _a !==
|
|
3025
|
+
const toUnitName = (_a = options.rulerUnit) !== null && _a !== void 0 ? _a : "Default";
|
|
3026
3026
|
if (this.oldRulerUnit === toUnitName) return;
|
|
3027
3027
|
this.oldRulerUnit = toUnitName;
|
|
3028
3028
|
const drawingUnit = this.m_module.getViewer().getUnit();
|
|
@@ -3147,7 +3147,7 @@ class OdaWalkDragger extends OdBaseDragger {
|
|
|
3147
3147
|
const model = this.viewer.getActiveModel();
|
|
3148
3148
|
model.removeEntity(this.cameraId);
|
|
3149
3149
|
model.delete();
|
|
3150
|
-
(_a = this.cameraWalker) === null || _a ===
|
|
3150
|
+
(_a = this.cameraWalker) === null || _a === void 0 ? void 0 : _a.delete();
|
|
3151
3151
|
}
|
|
3152
3152
|
if (this.viewParams) {
|
|
3153
3153
|
this.setViewParams(this.viewParams);
|
|
@@ -3502,7 +3502,7 @@ class OrbitAction {
|
|
|
3502
3502
|
const extView = this.getViewer().getActiveTvExtendedView();
|
|
3503
3503
|
extView.setView(viewParams.position, viewParams.target, viewParams.upVector, viewParams.viewFieldWidth, viewParams.viewFieldHeight, viewParams.perspective);
|
|
3504
3504
|
extView.delete();
|
|
3505
|
-
(_b = (_a = this._subject.activeDragger()) === null || _a ===
|
|
3505
|
+
(_b = (_a = this._subject.activeDragger()) === null || _a === void 0 ? void 0 : _a.updatePreview) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
3506
3506
|
}
|
|
3507
3507
|
endAction() {
|
|
3508
3508
|
this._endInteractivity();
|
|
@@ -3607,7 +3607,7 @@ class OrbitAction {
|
|
|
3607
3607
|
deleteAll(objects) {
|
|
3608
3608
|
var _a;
|
|
3609
3609
|
for (const obj of objects) {
|
|
3610
|
-
(_a = obj === null || obj ===
|
|
3610
|
+
(_a = obj === null || obj === void 0 ? void 0 : obj.delete) === null || _a === void 0 ? void 0 : _a.call(obj);
|
|
3611
3611
|
}
|
|
3612
3612
|
}
|
|
3613
3613
|
}
|
|
@@ -3674,7 +3674,7 @@ class PanAction {
|
|
|
3674
3674
|
targetWithDelta.delete();
|
|
3675
3675
|
position.delete();
|
|
3676
3676
|
positionWithDelta.delete();
|
|
3677
|
-
(_b = (_a = this._subject.activeDragger()) === null || _a ===
|
|
3677
|
+
(_b = (_a = this._subject.activeDragger()) === null || _a === void 0 ? void 0 : _a.updatePreview) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
3678
3678
|
this._subject.emitEvent({
|
|
3679
3679
|
type: "pan",
|
|
3680
3680
|
x: absoluteX,
|
|
@@ -3727,7 +3727,7 @@ class ZoomAction {
|
|
|
3727
3727
|
const viewer = this._m_module.getViewer();
|
|
3728
3728
|
viewer.zoomAt(zoomFactor, x, y);
|
|
3729
3729
|
this._subject.deviceAutoRegeneration();
|
|
3730
|
-
(_b = (_a = this._subject.activeDragger()) === null || _a ===
|
|
3730
|
+
(_b = (_a = this._subject.activeDragger()) === null || _a === void 0 ? void 0 : _a.updatePreview) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
3731
3731
|
this._subject.emitEvent({
|
|
3732
3732
|
type: "zoomat",
|
|
3733
3733
|
data: zoomFactor,
|
|
@@ -4089,7 +4089,7 @@ function applyModelTransform(viewer, model) {
|
|
|
4089
4089
|
}
|
|
4090
4090
|
}
|
|
4091
4091
|
modelItr.delete();
|
|
4092
|
-
(_a = visViewer.clearViewExtentsCache) === null || _a ===
|
|
4092
|
+
(_a = visViewer.clearViewExtentsCache) === null || _a === void 0 ? void 0 : _a.call(visViewer);
|
|
4093
4093
|
viewer.update();
|
|
4094
4094
|
}
|
|
4095
4095
|
|
|
@@ -4116,7 +4116,7 @@ function clearSlices(viewer) {
|
|
|
4116
4116
|
function createPreview(viewer, type = "image/jpeg", encoderOptions = .25) {
|
|
4117
4117
|
var _a;
|
|
4118
4118
|
if (!viewer.visualizeJs) return "";
|
|
4119
|
-
return ((_a = viewer.canvas) === null || _a ===
|
|
4119
|
+
return ((_a = viewer.canvas) === null || _a === void 0 ? void 0 : _a.toDataURL(type, encoderOptions)) || "";
|
|
4120
4120
|
}
|
|
4121
4121
|
|
|
4122
4122
|
function explode(viewer, index = 0) {
|
|
@@ -4276,7 +4276,7 @@ function setSelected(viewer, handles = []) {
|
|
|
4276
4276
|
const visLib = viewer.visLib();
|
|
4277
4277
|
const visViewer = visLib.getViewer();
|
|
4278
4278
|
const selectionSet = new visLib.OdTvSelectionSet;
|
|
4279
|
-
handles === null || handles ===
|
|
4279
|
+
handles === null || handles === void 0 ? void 0 : handles.forEach((handle => {
|
|
4280
4280
|
const entityId = visViewer.getEntityByOriginalHandle(handle + "");
|
|
4281
4281
|
if (!entityId.isNull()) selectionSet.appendEntity(entityId);
|
|
4282
4282
|
}));
|
|
@@ -4325,7 +4325,7 @@ function zoomToObjects(viewer, handles = []) {
|
|
|
4325
4325
|
const entityId = visViewer.getEntityByOriginalHandle(handle + "");
|
|
4326
4326
|
if (!entityId.isNull()) selectionSet.appendEntity(entityId);
|
|
4327
4327
|
}));
|
|
4328
|
-
(_a = visViewer.zoomToObjects) === null || _a ===
|
|
4328
|
+
(_a = visViewer.zoomToObjects) === null || _a === void 0 ? void 0 : _a.call(visViewer, selectionSet);
|
|
4329
4329
|
viewer.deviceAutoRegeneration();
|
|
4330
4330
|
viewer.update();
|
|
4331
4331
|
viewer.emitEvent({
|
|
@@ -4339,7 +4339,7 @@ function zoomToSelected(viewer) {
|
|
|
4339
4339
|
if (!viewer.visualizeJs) return;
|
|
4340
4340
|
const visViewer = viewer.visViewer();
|
|
4341
4341
|
const selectionSet = visViewer.getSelected();
|
|
4342
|
-
(_a = visViewer.zoomToObjects) === null || _a ===
|
|
4342
|
+
(_a = visViewer.zoomToObjects) === null || _a === void 0 ? void 0 : _a.call(visViewer, selectionSet);
|
|
4343
4343
|
viewer.deviceAutoRegeneration();
|
|
4344
4344
|
viewer.update();
|
|
4345
4345
|
viewer.emitEvent({
|
|
@@ -4397,7 +4397,7 @@ async function autoTransformAllModelsToCentralPoint(viewer, model) {
|
|
|
4397
4397
|
modelPtr.delete();
|
|
4398
4398
|
}
|
|
4399
4399
|
modelItr.delete();
|
|
4400
|
-
(_a = visViewer.clearViewExtentsCache) === null || _a ===
|
|
4400
|
+
(_a = visViewer.clearViewExtentsCache) === null || _a === void 0 ? void 0 : _a.call(visViewer);
|
|
4401
4401
|
viewer.update();
|
|
4402
4402
|
}
|
|
4403
4403
|
|
|
@@ -5275,7 +5275,7 @@ class OdaTextDragger extends OdBaseDragger {
|
|
|
5275
5275
|
dispose() {
|
|
5276
5276
|
var _a;
|
|
5277
5277
|
super.dispose();
|
|
5278
|
-
(_a = this.textRef) === null || _a ===
|
|
5278
|
+
(_a = this.textRef) === null || _a === void 0 ? void 0 : _a.remove();
|
|
5279
5279
|
this.textRef = null;
|
|
5280
5280
|
}
|
|
5281
5281
|
_finishInput() {
|
|
@@ -5283,7 +5283,7 @@ class OdaTextDragger extends OdBaseDragger {
|
|
|
5283
5283
|
if (this.textRef && this.textRef.value.trimLeft()) {
|
|
5284
5284
|
this._updateFrame();
|
|
5285
5285
|
}
|
|
5286
|
-
(_a = this.textRef) === null || _a ===
|
|
5286
|
+
(_a = this.textRef) === null || _a === void 0 ? void 0 : _a.remove();
|
|
5287
5287
|
this.textRef = null;
|
|
5288
5288
|
}
|
|
5289
5289
|
start(x, y, absoluteX, absoluteY) {
|
|
@@ -5327,7 +5327,7 @@ class OdaTextDragger extends OdBaseDragger {
|
|
|
5327
5327
|
const projMtrx = view.projectionMatrix;
|
|
5328
5328
|
const mtrxNumber = projMtrx.get(1, 1);
|
|
5329
5329
|
const tol = 1e-6;
|
|
5330
|
-
if (!(mtrxNumber < tol && mtrxNumber > -
|
|
5330
|
+
if (!(mtrxNumber < tol && mtrxNumber > -tol)) {
|
|
5331
5331
|
textScale = 1 / mtrxNumber;
|
|
5332
5332
|
}
|
|
5333
5333
|
const geomData = entityPtr.appendText(this.toGePoint(this.m_center), this.textRef.value.trimLeft());
|
|
@@ -5562,7 +5562,7 @@ class Viewer extends EventEmitter2 {
|
|
|
5562
5562
|
this._renderTime = 0;
|
|
5563
5563
|
this.canvasEvents = CANVAS_EVENTS.slice();
|
|
5564
5564
|
this.canvaseventlistener = event => this.emit(event);
|
|
5565
|
-
this._enableAutoUpdate = (_a = params.enableAutoUpdate) !== null && _a !==
|
|
5565
|
+
this._enableAutoUpdate = (_a = params.enableAutoUpdate) !== null && _a !== void 0 ? _a : true;
|
|
5566
5566
|
this._isNeedRender = false;
|
|
5567
5567
|
this._isRunAsyncUpdate = false;
|
|
5568
5568
|
this.render = this.render.bind(this);
|
|
@@ -5579,7 +5579,7 @@ class Viewer extends EventEmitter2 {
|
|
|
5579
5579
|
return this._markup;
|
|
5580
5580
|
}
|
|
5581
5581
|
configure(params) {
|
|
5582
|
-
this._visualizeJsUrl = params.visualizeJsUrl || "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/
|
|
5582
|
+
this._visualizeJsUrl = params.visualizeJsUrl || "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/26.1/Visualize.js";
|
|
5583
5583
|
return this;
|
|
5584
5584
|
}
|
|
5585
5585
|
async initialize(canvas, onProgress) {
|
|
@@ -5616,7 +5616,7 @@ class Viewer extends EventEmitter2 {
|
|
|
5616
5616
|
this.canvas = canvas;
|
|
5617
5617
|
this.canvasEvents.forEach((x => canvas.addEventListener(x, this.canvaseventlistener)));
|
|
5618
5618
|
this._markup.initialize(this.canvas, this.canvasEvents, this, this);
|
|
5619
|
-
for (
|
|
5619
|
+
for (let name of components.getComponents().keys()) {
|
|
5620
5620
|
this._components.push(components.createComponent(name, this));
|
|
5621
5621
|
}
|
|
5622
5622
|
this.syncOpenCloudVisualStyle(true);
|
|
@@ -5658,7 +5658,7 @@ class Viewer extends EventEmitter2 {
|
|
|
5658
5658
|
const visViewer = this.visualizeJs.getViewer();
|
|
5659
5659
|
if (visViewer.isRunningAnimation() || this._isNeedRender) {
|
|
5660
5660
|
visViewer.update();
|
|
5661
|
-
(_b = (_a = this._activeDragger) === null || _a ===
|
|
5661
|
+
(_b = (_a = this._activeDragger) === null || _a === void 0 ? void 0 : _a.updatePreview) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
5662
5662
|
this._isNeedRender = !visViewer.getActiveDevice().isValid();
|
|
5663
5663
|
const deltaTime = (time - this._renderTime) / 1e3;
|
|
5664
5664
|
this._renderTime = time;
|
|
@@ -5689,8 +5689,8 @@ class Viewer extends EventEmitter2 {
|
|
|
5689
5689
|
var _a, _b, _c;
|
|
5690
5690
|
if (this._enableAutoUpdate) {
|
|
5691
5691
|
if (force) {
|
|
5692
|
-
(_a = this.visViewer()) === null || _a ===
|
|
5693
|
-
(_c = (_b = this._activeDragger) === null || _b ===
|
|
5692
|
+
(_a = this.visViewer()) === null || _a === void 0 ? void 0 : _a.update();
|
|
5693
|
+
(_c = (_b = this._activeDragger) === null || _b === void 0 ? void 0 : _b.updatePreview) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
5694
5694
|
} else {
|
|
5695
5695
|
this._isNeedRender = true;
|
|
5696
5696
|
}
|
|
@@ -5743,7 +5743,7 @@ class Viewer extends EventEmitter2 {
|
|
|
5743
5743
|
}
|
|
5744
5744
|
visViewer() {
|
|
5745
5745
|
var _a;
|
|
5746
|
-
return (_a = this.visualizeJs) === null || _a ===
|
|
5746
|
+
return (_a = this.visualizeJs) === null || _a === void 0 ? void 0 : _a.getViewer();
|
|
5747
5747
|
}
|
|
5748
5748
|
syncOpenCloudVisualStyle(isInitializing) {
|
|
5749
5749
|
if (!this.visualizeJs) return this;
|
|
@@ -5894,7 +5894,7 @@ class Viewer extends EventEmitter2 {
|
|
|
5894
5894
|
newDragger = draggers.createDragger(name, this);
|
|
5895
5895
|
if (newDragger) {
|
|
5896
5896
|
this._activeDragger = newDragger;
|
|
5897
|
-
(_b = (_a = this._activeDragger).initialize) === null || _b ===
|
|
5897
|
+
(_b = (_a = this._activeDragger).initialize) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
5898
5898
|
}
|
|
5899
5899
|
}
|
|
5900
5900
|
const canvas = this.canvas;
|
|
@@ -6005,11 +6005,11 @@ class Viewer extends EventEmitter2 {
|
|
|
6005
6005
|
const projMatrix = this.visViewer().activeView.projectionMatrix;
|
|
6006
6006
|
const tolerance = 1e-6;
|
|
6007
6007
|
const x = projMatrix.get(0, 0);
|
|
6008
|
-
if (x > tolerance || x < -
|
|
6008
|
+
if (x > tolerance || x < -tolerance) result.x = 1 / x;
|
|
6009
6009
|
const y = projMatrix.get(1, 1);
|
|
6010
|
-
if (y > tolerance || y < -
|
|
6010
|
+
if (y > tolerance || y < -tolerance) result.y = 1 / y;
|
|
6011
6011
|
const z = projMatrix.get(2, 2);
|
|
6012
|
-
if (z > tolerance || z < -
|
|
6012
|
+
if (z > tolerance || z < -tolerance) result.z = 1 / z;
|
|
6013
6013
|
return result;
|
|
6014
6014
|
}
|
|
6015
6015
|
getSelected() {
|
|
@@ -6041,14 +6041,14 @@ class Viewer extends EventEmitter2 {
|
|
|
6041
6041
|
if (!this.visualizeJs) return this;
|
|
6042
6042
|
if (!this.client) return this;
|
|
6043
6043
|
const abortController = new AbortController;
|
|
6044
|
-
(_a = this._abortControllerForReferences) === null || _a ===
|
|
6044
|
+
(_a = this._abortControllerForReferences) === null || _a === void 0 ? void 0 : _a.abort();
|
|
6045
6045
|
this._abortControllerForReferences = abortController;
|
|
6046
6046
|
let references = [];
|
|
6047
6047
|
await model.getReferences(abortController.signal).then((data => references = data.references)).catch((e => console.error("Cannot load model references.", e)));
|
|
6048
6048
|
for (const file of references) {
|
|
6049
6049
|
await this.client.downloadFile(file.id, undefined, abortController.signal).then((arrayBuffer => {
|
|
6050
6050
|
var _a;
|
|
6051
|
-
return (_a = this.visualizeJs) === null || _a ===
|
|
6051
|
+
return (_a = this.visualizeJs) === null || _a === void 0 ? void 0 : _a.getViewer().addEmbeddedFile(file.name, new Uint8Array(arrayBuffer));
|
|
6052
6052
|
})).catch((e => console.error(`Cannot load reference file ${file.name}.`, e)));
|
|
6053
6053
|
}
|
|
6054
6054
|
return this;
|
|
@@ -6191,11 +6191,11 @@ class Viewer extends EventEmitter2 {
|
|
|
6191
6191
|
}
|
|
6192
6192
|
cancel() {
|
|
6193
6193
|
var _a, _b, _c;
|
|
6194
|
-
(_a = this._abortControllerForReferences) === null || _a ===
|
|
6194
|
+
(_a = this._abortControllerForReferences) === null || _a === void 0 ? void 0 : _a.abort();
|
|
6195
6195
|
this._abortControllerForReferences = undefined;
|
|
6196
|
-
(_b = this._abortController) === null || _b ===
|
|
6196
|
+
(_b = this._abortController) === null || _b === void 0 ? void 0 : _b.abort();
|
|
6197
6197
|
this._abortController = undefined;
|
|
6198
|
-
(_c = this._abortControllerForRequestMap) === null || _c ===
|
|
6198
|
+
(_c = this._abortControllerForRequestMap) === null || _c === void 0 ? void 0 : _c.forEach((controller => controller.abort()));
|
|
6199
6199
|
this._abortControllerForRequestMap = undefined;
|
|
6200
6200
|
this.emitEvent({
|
|
6201
6201
|
type: "cancel"
|
|
@@ -6253,7 +6253,7 @@ class Viewer extends EventEmitter2 {
|
|
|
6253
6253
|
drawViewpoint(viewpoint) {
|
|
6254
6254
|
var _a;
|
|
6255
6255
|
if (!this.visualizeJs) return;
|
|
6256
|
-
const draggerName = (_a = this._activeDragger) === null || _a ===
|
|
6256
|
+
const draggerName = (_a = this._activeDragger) === null || _a === void 0 ? void 0 : _a.name;
|
|
6257
6257
|
this.setActiveDragger();
|
|
6258
6258
|
this.clearSlices();
|
|
6259
6259
|
this.clearOverlay();
|
|
@@ -6303,8 +6303,7 @@ class Viewer extends EventEmitter2 {
|
|
|
6303
6303
|
direction: this.getPoint3dFromArray(activeView.viewTarget),
|
|
6304
6304
|
up_vector: this.getPoint3dFromArray(activeView.upVector),
|
|
6305
6305
|
field_width: activeView.viewFieldWidth,
|
|
6306
|
-
field_height: activeView.viewFieldHeight
|
|
6307
|
-
view_to_world_scale: 1
|
|
6306
|
+
field_height: activeView.viewFieldHeight
|
|
6308
6307
|
};
|
|
6309
6308
|
}
|
|
6310
6309
|
setOrthogonalCameraSettings(settings) {
|
|
@@ -6347,7 +6346,7 @@ class Viewer extends EventEmitter2 {
|
|
|
6347
6346
|
})));
|
|
6348
6347
|
}
|
|
6349
6348
|
setSelection(selection) {
|
|
6350
|
-
this.setSelected(selection === null || selection ===
|
|
6349
|
+
this.setSelected(selection === null || selection === void 0 ? void 0 : selection.map((component => component.handle)));
|
|
6351
6350
|
}
|
|
6352
6351
|
executeCommand(id, ...args) {
|
|
6353
6352
|
return commands.executeCommand(id, this, ...args);
|