@inweb/viewer-three 26.3.2 → 26.4.0
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-three.js +131 -129
- package/dist/viewer-three.js.map +1 -1
- package/dist/viewer-three.min.js +2 -2
- package/dist/viewer-three.module.js +97 -97
- package/dist/viewer-three.module.js.map +1 -1
- package/package.json +5 -5
- package/src/Viewer/commands/ClearSelected.ts +3 -3
- package/src/Viewer/commands/SetSelected.ts +3 -3
package/dist/viewer-three.js
CHANGED
|
@@ -12418,8 +12418,8 @@
|
|
|
12418
12418
|
}
|
|
12419
12419
|
if (!params) params = {};
|
|
12420
12420
|
if (!params.points) params.points = [ {
|
|
12421
|
-
x:
|
|
12422
|
-
y:
|
|
12421
|
+
x: 0,
|
|
12422
|
+
y: 0
|
|
12423
12423
|
}, {
|
|
12424
12424
|
x: 100,
|
|
12425
12425
|
y: 100
|
|
@@ -12527,8 +12527,8 @@
|
|
|
12527
12527
|
}
|
|
12528
12528
|
if (!params) params = {};
|
|
12529
12529
|
if (!params.position) params.position = {
|
|
12530
|
-
x:
|
|
12531
|
-
y:
|
|
12530
|
+
x: 0,
|
|
12531
|
+
y: 0
|
|
12532
12532
|
};
|
|
12533
12533
|
if (!params.text) params.text = "default";
|
|
12534
12534
|
this._ref = new Konva.Text({
|
|
@@ -12634,8 +12634,8 @@
|
|
|
12634
12634
|
}
|
|
12635
12635
|
if (!params) params = {};
|
|
12636
12636
|
if (!params.position) params.position = {
|
|
12637
|
-
x:
|
|
12638
|
-
y:
|
|
12637
|
+
x: 0,
|
|
12638
|
+
y: 0
|
|
12639
12639
|
};
|
|
12640
12640
|
this._ref = new Konva.Rect({
|
|
12641
12641
|
stroke: (_a = params.color) !== null && _a !== undefined ? _a : "#ff0000",
|
|
@@ -12748,8 +12748,8 @@
|
|
|
12748
12748
|
}
|
|
12749
12749
|
if (!params) params = {};
|
|
12750
12750
|
if (!params.position) params.position = {
|
|
12751
|
-
x:
|
|
12752
|
-
y:
|
|
12751
|
+
x: 0,
|
|
12752
|
+
y: 0
|
|
12753
12753
|
};
|
|
12754
12754
|
if (!params.radius) params.radius = {
|
|
12755
12755
|
x: 25,
|
|
@@ -12878,8 +12878,8 @@
|
|
|
12878
12878
|
}
|
|
12879
12879
|
if (!params) params = {};
|
|
12880
12880
|
if (!params.start) params.start = {
|
|
12881
|
-
x:
|
|
12882
|
-
y:
|
|
12881
|
+
x: 0,
|
|
12882
|
+
y: 0
|
|
12883
12883
|
};
|
|
12884
12884
|
if (!params.end) params.end = {
|
|
12885
12885
|
x: 100,
|
|
@@ -12994,8 +12994,8 @@
|
|
|
12994
12994
|
}
|
|
12995
12995
|
if (!params) params = {};
|
|
12996
12996
|
if (!params.position) params.position = {
|
|
12997
|
-
x:
|
|
12998
|
-
y:
|
|
12997
|
+
x: 0,
|
|
12998
|
+
y: 0
|
|
12999
12999
|
};
|
|
13000
13000
|
if (!params.src || !params.src.startsWith(this.BASE64_HEADER_START)) params.src = this.BASE64_NOT_FOUND;
|
|
13001
13001
|
this._canvasImage = new Image;
|
|
@@ -13131,8 +13131,8 @@
|
|
|
13131
13131
|
}
|
|
13132
13132
|
if (!params) params = {};
|
|
13133
13133
|
if (!params.position) params.position = {
|
|
13134
|
-
x:
|
|
13135
|
-
y:
|
|
13134
|
+
x: 0,
|
|
13135
|
+
y: 0
|
|
13136
13136
|
};
|
|
13137
13137
|
const arcRadius = 16;
|
|
13138
13138
|
this._ref = new Konva.Shape({
|
|
@@ -56684,117 +56684,6 @@ void main() {
|
|
|
56684
56684
|
viewer.clearOverlay();
|
|
56685
56685
|
}
|
|
56686
56686
|
|
|
56687
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
56688
|
-
// Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
|
|
56689
|
-
// All rights reserved.
|
|
56690
|
-
//
|
|
56691
|
-
// This software and its documentation and related materials are owned by
|
|
56692
|
-
// the Alliance. The software may only be incorporated into application
|
|
56693
|
-
// programs owned by members of the Alliance, subject to a signed
|
|
56694
|
-
// Membership Agreement and Supplemental Software License Agreement with the
|
|
56695
|
-
// Alliance. The structure and organization of this software are the valuable
|
|
56696
|
-
// trade secrets of the Alliance and its suppliers. The software is also
|
|
56697
|
-
// protected by copyright law and international treaty provisions. Application
|
|
56698
|
-
// programs incorporating this software must include the following statement
|
|
56699
|
-
// with their copyright notices:
|
|
56700
|
-
//
|
|
56701
|
-
// This application incorporates Open Design Alliance software pursuant to a
|
|
56702
|
-
// license agreement with Open Design Alliance.
|
|
56703
|
-
// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
|
|
56704
|
-
// All rights reserved.
|
|
56705
|
-
//
|
|
56706
|
-
// By use of this software, its documentation or related materials, you
|
|
56707
|
-
// acknowledge and accept the above terms.
|
|
56708
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
56709
|
-
class SelectionComponent {
|
|
56710
|
-
constructor(viewer) {
|
|
56711
|
-
this.onPointerDown = (event) => {
|
|
56712
|
-
if (!event.isPrimary || event.button !== 0)
|
|
56713
|
-
return;
|
|
56714
|
-
this.getMousePosition(event, this.downPosition);
|
|
56715
|
-
};
|
|
56716
|
-
this.onPointerUp = (event) => {
|
|
56717
|
-
if (!event.isPrimary)
|
|
56718
|
-
return;
|
|
56719
|
-
const upPosition = this.getMousePosition(event, new Vector2());
|
|
56720
|
-
if (this.downPosition.distanceTo(upPosition) !== 0)
|
|
56721
|
-
return;
|
|
56722
|
-
const intersects = this.getPointerIntersects(upPosition);
|
|
56723
|
-
this.clearSelection();
|
|
56724
|
-
if (intersects.length > 0)
|
|
56725
|
-
this.select(intersects[0].object);
|
|
56726
|
-
this.viewer.update();
|
|
56727
|
-
this.viewer.emitEvent({ type: "select", data: undefined, handles: this.viewer.getSelected() });
|
|
56728
|
-
};
|
|
56729
|
-
this.onDoubleClick = (event) => {
|
|
56730
|
-
if (event.button !== 0)
|
|
56731
|
-
return;
|
|
56732
|
-
this.viewer.executeCommand("zoomToSelected");
|
|
56733
|
-
};
|
|
56734
|
-
this.optionsChange = () => {
|
|
56735
|
-
const { facesColor, facesTransparancy } = this.viewer.options;
|
|
56736
|
-
this.facesMaterial.color.setRGB(facesColor.r / 255, facesColor.g / 255, facesColor.b / 255);
|
|
56737
|
-
this.facesMaterial.opacity = (255 - facesTransparancy) / 255;
|
|
56738
|
-
this.viewer.update();
|
|
56739
|
-
};
|
|
56740
|
-
this.viewer = viewer;
|
|
56741
|
-
this.raycaster = new Raycaster();
|
|
56742
|
-
this.downPosition = new Vector2();
|
|
56743
|
-
const { facesColor, facesTransparancy } = this.viewer.options;
|
|
56744
|
-
this.facesMaterial = new MeshBasicMaterial();
|
|
56745
|
-
this.facesMaterial.color.setRGB(facesColor.r / 255, facesColor.g / 255, facesColor.b / 255);
|
|
56746
|
-
this.facesMaterial.opacity = (255 - facesTransparancy) / 255;
|
|
56747
|
-
this.facesMaterial.transparent = true;
|
|
56748
|
-
this.viewer.addEventListener("pointerdown", this.onPointerDown);
|
|
56749
|
-
this.viewer.addEventListener("pointerup", this.onPointerUp);
|
|
56750
|
-
this.viewer.addEventListener("dblclick", this.onDoubleClick);
|
|
56751
|
-
this.viewer.addEventListener("optionschange", this.optionsChange);
|
|
56752
|
-
}
|
|
56753
|
-
dispose() {
|
|
56754
|
-
this.facesMaterial.dispose();
|
|
56755
|
-
this.viewer.removeEventListener("pointerdown", this.onPointerDown);
|
|
56756
|
-
this.viewer.removeEventListener("pointerup", this.onPointerUp);
|
|
56757
|
-
this.viewer.removeEventListener("dblclick", this.onDoubleClick);
|
|
56758
|
-
this.viewer.removeEventListener("optionschange", this.optionsChange);
|
|
56759
|
-
}
|
|
56760
|
-
getMousePosition(event, target) {
|
|
56761
|
-
return target.set(event.clientX, event.clientY);
|
|
56762
|
-
}
|
|
56763
|
-
getPointerIntersects(mouse) {
|
|
56764
|
-
const rect = this.viewer.canvas.getBoundingClientRect();
|
|
56765
|
-
const x = ((mouse.x - rect.left) / rect.width) * 2 - 1;
|
|
56766
|
-
const y = (-(mouse.y - rect.top) / rect.height) * 2 + 1;
|
|
56767
|
-
const coords = new Vector2(x, y);
|
|
56768
|
-
this.raycaster.setFromCamera(coords, this.viewer.camera);
|
|
56769
|
-
const objects = [];
|
|
56770
|
-
this.viewer.scene.traverseVisible((child) => objects.push(child));
|
|
56771
|
-
this.raycaster.params = this.raycaster.params = {
|
|
56772
|
-
Mesh: {},
|
|
56773
|
-
Line: { threshold: 0.25 },
|
|
56774
|
-
Line2: { threshold: 0.25 },
|
|
56775
|
-
LOD: {},
|
|
56776
|
-
Points: { threshold: 0.1 },
|
|
56777
|
-
Sprite: {},
|
|
56778
|
-
};
|
|
56779
|
-
return this.raycaster.intersectObjects(objects, false);
|
|
56780
|
-
}
|
|
56781
|
-
select(object) {
|
|
56782
|
-
if (object.isSelected)
|
|
56783
|
-
return;
|
|
56784
|
-
object.isSelected = true;
|
|
56785
|
-
object.originalMaterial = object.material;
|
|
56786
|
-
object.material = this.facesMaterial;
|
|
56787
|
-
this.viewer.selected.push(object);
|
|
56788
|
-
}
|
|
56789
|
-
clearSelection() {
|
|
56790
|
-
this.viewer.selected.forEach((object) => {
|
|
56791
|
-
object.isSelected = false;
|
|
56792
|
-
object.material = object.originalMaterial;
|
|
56793
|
-
});
|
|
56794
|
-
this.viewer.selected.length = 0;
|
|
56795
|
-
}
|
|
56796
|
-
}
|
|
56797
|
-
|
|
56798
56687
|
///////////////////////////////////////////////////////////////////////////////
|
|
56799
56688
|
// Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
|
|
56800
56689
|
// All rights reserved.
|
|
@@ -56818,9 +56707,10 @@ void main() {
|
|
|
56818
56707
|
// acknowledge and accept the above terms.
|
|
56819
56708
|
///////////////////////////////////////////////////////////////////////////////
|
|
56820
56709
|
function clearSelected(viewer) {
|
|
56821
|
-
const selection =
|
|
56710
|
+
const selection = viewer.getComponent("SelectionComponent");
|
|
56711
|
+
if (!selection)
|
|
56712
|
+
return;
|
|
56822
56713
|
selection.clearSelection();
|
|
56823
|
-
selection.dispose();
|
|
56824
56714
|
viewer.update();
|
|
56825
56715
|
viewer.emitEvent({ type: "select", data: undefined, handles: [] });
|
|
56826
56716
|
}
|
|
@@ -57127,6 +57017,117 @@ void main() {
|
|
|
57127
57017
|
return viewer.selected.map((object) => { var _a; return (_a = object.userData) === null || _a === undefined ? undefined : _a.handle; }).filter((handle) => handle);
|
|
57128
57018
|
}
|
|
57129
57019
|
|
|
57020
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
57021
|
+
// Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
|
|
57022
|
+
// All rights reserved.
|
|
57023
|
+
//
|
|
57024
|
+
// This software and its documentation and related materials are owned by
|
|
57025
|
+
// the Alliance. The software may only be incorporated into application
|
|
57026
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
57027
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
57028
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
57029
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
57030
|
+
// protected by copyright law and international treaty provisions. Application
|
|
57031
|
+
// programs incorporating this software must include the following statement
|
|
57032
|
+
// with their copyright notices:
|
|
57033
|
+
//
|
|
57034
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
57035
|
+
// license agreement with Open Design Alliance.
|
|
57036
|
+
// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
|
|
57037
|
+
// All rights reserved.
|
|
57038
|
+
//
|
|
57039
|
+
// By use of this software, its documentation or related materials, you
|
|
57040
|
+
// acknowledge and accept the above terms.
|
|
57041
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
57042
|
+
class SelectionComponent {
|
|
57043
|
+
constructor(viewer) {
|
|
57044
|
+
this.onPointerDown = (event) => {
|
|
57045
|
+
if (!event.isPrimary || event.button !== 0)
|
|
57046
|
+
return;
|
|
57047
|
+
this.getMousePosition(event, this.downPosition);
|
|
57048
|
+
};
|
|
57049
|
+
this.onPointerUp = (event) => {
|
|
57050
|
+
if (!event.isPrimary)
|
|
57051
|
+
return;
|
|
57052
|
+
const upPosition = this.getMousePosition(event, new Vector2());
|
|
57053
|
+
if (this.downPosition.distanceTo(upPosition) !== 0)
|
|
57054
|
+
return;
|
|
57055
|
+
const intersects = this.getPointerIntersects(upPosition);
|
|
57056
|
+
this.clearSelection();
|
|
57057
|
+
if (intersects.length > 0)
|
|
57058
|
+
this.select(intersects[0].object);
|
|
57059
|
+
this.viewer.update();
|
|
57060
|
+
this.viewer.emitEvent({ type: "select", data: undefined, handles: this.viewer.getSelected() });
|
|
57061
|
+
};
|
|
57062
|
+
this.onDoubleClick = (event) => {
|
|
57063
|
+
if (event.button !== 0)
|
|
57064
|
+
return;
|
|
57065
|
+
this.viewer.executeCommand("zoomToSelected");
|
|
57066
|
+
};
|
|
57067
|
+
this.optionsChange = () => {
|
|
57068
|
+
const { facesColor, facesTransparancy } = this.viewer.options;
|
|
57069
|
+
this.facesMaterial.color.setRGB(facesColor.r / 255, facesColor.g / 255, facesColor.b / 255);
|
|
57070
|
+
this.facesMaterial.opacity = (255 - facesTransparancy) / 255;
|
|
57071
|
+
this.viewer.update();
|
|
57072
|
+
};
|
|
57073
|
+
this.viewer = viewer;
|
|
57074
|
+
this.raycaster = new Raycaster();
|
|
57075
|
+
this.downPosition = new Vector2();
|
|
57076
|
+
const { facesColor, facesTransparancy } = this.viewer.options;
|
|
57077
|
+
this.facesMaterial = new MeshBasicMaterial();
|
|
57078
|
+
this.facesMaterial.color.setRGB(facesColor.r / 255, facesColor.g / 255, facesColor.b / 255);
|
|
57079
|
+
this.facesMaterial.opacity = (255 - facesTransparancy) / 255;
|
|
57080
|
+
this.facesMaterial.transparent = true;
|
|
57081
|
+
this.viewer.addEventListener("pointerdown", this.onPointerDown);
|
|
57082
|
+
this.viewer.addEventListener("pointerup", this.onPointerUp);
|
|
57083
|
+
this.viewer.addEventListener("dblclick", this.onDoubleClick);
|
|
57084
|
+
this.viewer.addEventListener("optionschange", this.optionsChange);
|
|
57085
|
+
}
|
|
57086
|
+
dispose() {
|
|
57087
|
+
this.facesMaterial.dispose();
|
|
57088
|
+
this.viewer.removeEventListener("pointerdown", this.onPointerDown);
|
|
57089
|
+
this.viewer.removeEventListener("pointerup", this.onPointerUp);
|
|
57090
|
+
this.viewer.removeEventListener("dblclick", this.onDoubleClick);
|
|
57091
|
+
this.viewer.removeEventListener("optionschange", this.optionsChange);
|
|
57092
|
+
}
|
|
57093
|
+
getMousePosition(event, target) {
|
|
57094
|
+
return target.set(event.clientX, event.clientY);
|
|
57095
|
+
}
|
|
57096
|
+
getPointerIntersects(mouse) {
|
|
57097
|
+
const rect = this.viewer.canvas.getBoundingClientRect();
|
|
57098
|
+
const x = ((mouse.x - rect.left) / rect.width) * 2 - 1;
|
|
57099
|
+
const y = (-(mouse.y - rect.top) / rect.height) * 2 + 1;
|
|
57100
|
+
const coords = new Vector2(x, y);
|
|
57101
|
+
this.raycaster.setFromCamera(coords, this.viewer.camera);
|
|
57102
|
+
const objects = [];
|
|
57103
|
+
this.viewer.scene.traverseVisible((child) => objects.push(child));
|
|
57104
|
+
this.raycaster.params = this.raycaster.params = {
|
|
57105
|
+
Mesh: {},
|
|
57106
|
+
Line: { threshold: 0.25 },
|
|
57107
|
+
Line2: { threshold: 0.25 },
|
|
57108
|
+
LOD: {},
|
|
57109
|
+
Points: { threshold: 0.1 },
|
|
57110
|
+
Sprite: {},
|
|
57111
|
+
};
|
|
57112
|
+
return this.raycaster.intersectObjects(objects, false);
|
|
57113
|
+
}
|
|
57114
|
+
select(object) {
|
|
57115
|
+
if (object.isSelected)
|
|
57116
|
+
return;
|
|
57117
|
+
object.isSelected = true;
|
|
57118
|
+
object.originalMaterial = object.material;
|
|
57119
|
+
object.material = this.facesMaterial;
|
|
57120
|
+
this.viewer.selected.push(object);
|
|
57121
|
+
}
|
|
57122
|
+
clearSelection() {
|
|
57123
|
+
this.viewer.selected.forEach((object) => {
|
|
57124
|
+
object.isSelected = false;
|
|
57125
|
+
object.material = object.originalMaterial;
|
|
57126
|
+
});
|
|
57127
|
+
this.viewer.selected.length = 0;
|
|
57128
|
+
}
|
|
57129
|
+
}
|
|
57130
|
+
|
|
57130
57131
|
///////////////////////////////////////////////////////////////////////////////
|
|
57131
57132
|
// Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
|
|
57132
57133
|
// All rights reserved.
|
|
@@ -57362,10 +57363,11 @@ void main() {
|
|
|
57362
57363
|
if (handleSet.has((_a = child.userData) === null || _a === undefined ? undefined : _a.handle))
|
|
57363
57364
|
objects.push(child);
|
|
57364
57365
|
});
|
|
57365
|
-
const selection =
|
|
57366
|
+
const selection = viewer.getComponent("SelectionComponent");
|
|
57367
|
+
if (!selection)
|
|
57368
|
+
return;
|
|
57366
57369
|
selection.clearSelection();
|
|
57367
57370
|
objects.forEach((object) => selection.select(object));
|
|
57368
|
-
selection.dispose();
|
|
57369
57371
|
viewer.update();
|
|
57370
57372
|
viewer.emitEvent({ type: "select", data: undefined, handles });
|
|
57371
57373
|
}
|