@inweb/viewer-visualize 27.2.2 → 27.3.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-visualize.js +58 -60
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +58 -60
- package/dist/viewer-visualize.module.js.map +1 -1
- package/lib/Viewer/Draggers/OdBaseCuttingPlaneDragger.d.ts +4 -6
- package/package.json +5 -5
- package/src/Viewer/Draggers/OdBaseCuttingPlaneDragger.ts +36 -42
- package/src/Viewer/Draggers/OdCuttingPlaneXAxisDragger.ts +9 -8
- package/src/Viewer/Draggers/OdCuttingPlaneYAxisDragger.ts +9 -8
- package/src/Viewer/Draggers/OdCuttingPlaneZAxisDragger.ts +9 -8
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import { Viewer } from "../Viewer";
|
|
2
|
-
import {
|
|
2
|
+
import { Point3d } from "./Common/Geometry";
|
|
3
3
|
import { OdBaseDragger } from "./Common/OdBaseDragger";
|
|
4
4
|
export declare class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
5
|
-
protected
|
|
6
|
-
protected m_size_y: number;
|
|
7
|
-
protected m_size_z: number;
|
|
5
|
+
protected m_size: number;
|
|
8
6
|
protected m_center: Point3d;
|
|
9
7
|
protected m_normal: number[];
|
|
10
8
|
protected index: number;
|
|
11
9
|
protected m_model: any;
|
|
12
10
|
protected m_entity: any;
|
|
13
|
-
protected
|
|
11
|
+
protected m_planePreview: any;
|
|
14
12
|
protected m_last: Point3d;
|
|
15
|
-
protected m_click: Point2d;
|
|
16
13
|
constructor(subject: Viewer);
|
|
17
14
|
dispose(): void;
|
|
18
15
|
createNormal(): number[];
|
|
@@ -21,6 +18,7 @@ export declare class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
|
21
18
|
start(x: number, y: number): void;
|
|
22
19
|
drag(x: number, y: number): void;
|
|
23
20
|
end(x: number, y: number): void;
|
|
21
|
+
dblclick(ev: MouseEvent): void;
|
|
24
22
|
createPreview(): void;
|
|
25
23
|
drawPreview(): void;
|
|
26
24
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inweb/viewer-visualize",
|
|
3
|
-
"version": "27.
|
|
3
|
+
"version": "27.3.0",
|
|
4
4
|
"description": "JavaScript library for rendering CAD and BIM files in a browser using VisualizeJS",
|
|
5
5
|
"homepage": "https://cloud.opendesign.com/docs/index.html",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"docs": "typedoc"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@inweb/client": "~27.
|
|
33
|
-
"@inweb/eventemitter2": "~27.
|
|
34
|
-
"@inweb/markup": "~27.
|
|
35
|
-
"@inweb/viewer-core": "~27.
|
|
32
|
+
"@inweb/client": "~27.3.0",
|
|
33
|
+
"@inweb/eventemitter2": "~27.3.0",
|
|
34
|
+
"@inweb/markup": "~27.3.0",
|
|
35
|
+
"@inweb/viewer-core": "~27.3.0"
|
|
36
36
|
},
|
|
37
37
|
"visualizeJS": "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/master/Visualize.js"
|
|
38
38
|
}
|
|
@@ -21,21 +21,18 @@
|
|
|
21
21
|
// acknowledge and accept the above terms.
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
import { Viewer } from "../Viewer";
|
|
24
|
-
import {
|
|
24
|
+
import { Point3d } from "./Common/Geometry";
|
|
25
25
|
import { OdBaseDragger } from "./Common/OdBaseDragger";
|
|
26
26
|
|
|
27
27
|
export class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
28
|
-
protected
|
|
29
|
-
protected m_size_y: number;
|
|
30
|
-
protected m_size_z: number;
|
|
28
|
+
protected m_size: number;
|
|
31
29
|
protected m_center: Point3d;
|
|
32
30
|
protected m_normal: number[];
|
|
33
31
|
protected index: number;
|
|
34
32
|
protected m_model: any;
|
|
35
33
|
protected m_entity: any;
|
|
36
|
-
protected
|
|
34
|
+
protected m_planePreview: any;
|
|
37
35
|
protected m_last: Point3d;
|
|
38
|
-
protected m_click: Point2d;
|
|
39
36
|
|
|
40
37
|
constructor(subject: Viewer) {
|
|
41
38
|
super(subject);
|
|
@@ -47,9 +44,11 @@ export class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
|
47
44
|
const min = ext.min();
|
|
48
45
|
const max = ext.max();
|
|
49
46
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
const sizeX = Math.abs(max[0] - min[0]);
|
|
48
|
+
const sizeY = Math.abs(max[1] - min[1]);
|
|
49
|
+
const sizeZ = Math.abs(max[2] - min[2]);
|
|
50
|
+
|
|
51
|
+
this.m_size = Math.sqrt(sizeX * sizeX + sizeY * sizeY + sizeZ * sizeZ) || 1;
|
|
53
52
|
|
|
54
53
|
this.m_center = this.toPoint(ext.center());
|
|
55
54
|
this.m_normal = this.createNormal();
|
|
@@ -63,7 +62,7 @@ export class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
|
63
62
|
|
|
64
63
|
const { red, green, blue } = this.subject.options.cuttingPlaneFillColor;
|
|
65
64
|
avp.setEnableCuttingPlaneFill(true, red, green, blue);
|
|
66
|
-
avp.setCuttingPlaneFillPatternEnabled(true, this.m_module.CuttingPlaneFillStyle.
|
|
65
|
+
avp.setCuttingPlaneFillPatternEnabled(true, this.m_module.CuttingPlaneFillStyle.kSlantRight, 0x0, 0x0, 0x0);
|
|
67
66
|
|
|
68
67
|
this.m_model = this.getModel();
|
|
69
68
|
this.createPreview();
|
|
@@ -76,9 +75,9 @@ export class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
|
76
75
|
|
|
77
76
|
if (this.m_entity) {
|
|
78
77
|
this.m_model.removeEntity(this.m_entity);
|
|
79
|
-
this.deleteAll([this.m_model, this.m_entity, this.
|
|
78
|
+
this.deleteAll([this.m_model, this.m_entity, this.m_planePreview, this.m_center]);
|
|
80
79
|
this.m_entity = null;
|
|
81
|
-
this.
|
|
80
|
+
this.m_planePreview = null;
|
|
82
81
|
this.subject.update();
|
|
83
82
|
}
|
|
84
83
|
}
|
|
@@ -98,7 +97,6 @@ export class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
|
98
97
|
override start(x: number, y: number): void {
|
|
99
98
|
this.press = true;
|
|
100
99
|
this.m_last = this.screenToWorld(x, y);
|
|
101
|
-
this.m_click = { x, y };
|
|
102
100
|
}
|
|
103
101
|
|
|
104
102
|
override drag(x: number, y: number): void {
|
|
@@ -114,12 +112,12 @@ export class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
|
114
112
|
|
|
115
113
|
const avp = this.getViewer().activeView;
|
|
116
114
|
const plane = this.createPlane();
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
plane.set(this.toGePoint(this.m_center), this.m_normal);
|
|
116
|
+
avp.updateCuttingPlane(this.index, plane);
|
|
119
117
|
|
|
120
118
|
this.drawPreview();
|
|
121
119
|
|
|
122
|
-
this.deleteAll([avp, plane, oldCenter, delta, oldLast
|
|
120
|
+
this.deleteAll([avp, plane, oldCenter, delta, oldLast]);
|
|
123
121
|
|
|
124
122
|
const device = this.getViewer().getActiveDevice();
|
|
125
123
|
device.invalidate(device.getSize());
|
|
@@ -128,19 +126,20 @@ export class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
|
128
126
|
|
|
129
127
|
override end(x: number, y: number): void {
|
|
130
128
|
this.press = false;
|
|
131
|
-
|
|
132
|
-
this.m_normal = [this.m_normal[0] * -1, this.m_normal[1] * -1, this.m_normal[2] * -1];
|
|
129
|
+
}
|
|
133
130
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
plane.set(this.toGePoint(this.m_center), this.m_normal);
|
|
137
|
-
avp.updateCuttingPlane(this.index, plane);
|
|
131
|
+
override dblclick(ev: MouseEvent): void {
|
|
132
|
+
this.m_normal = [this.m_normal[0] * -1, this.m_normal[1] * -1, this.m_normal[2] * -1];
|
|
138
133
|
|
|
139
|
-
|
|
134
|
+
const avp = this.getViewer().activeView;
|
|
135
|
+
const plane = this.createPlane();
|
|
136
|
+
plane.set(this.toGePoint(this.m_center), this.m_normal);
|
|
137
|
+
avp.updateCuttingPlane(this.index, plane);
|
|
140
138
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
139
|
+
this.deleteAll([avp, plane, this.m_last]);
|
|
140
|
+
|
|
141
|
+
const device = this.getViewer().getActiveDevice();
|
|
142
|
+
device.invalidate(device.getSize());
|
|
144
143
|
}
|
|
145
144
|
|
|
146
145
|
createPreview(): void {
|
|
@@ -148,35 +147,30 @@ export class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
|
148
147
|
|
|
149
148
|
const GeometryTypes = this.m_module.GeometryTypes;
|
|
150
149
|
|
|
151
|
-
const
|
|
152
|
-
const
|
|
150
|
+
const facesColorDef = new this.m_module.OdTvColorDef(0xf0, 0xf0, 0xf0);
|
|
151
|
+
const facesTransparencyDef = new this.m_module.OdTvTransparencyDef(0.7);
|
|
153
152
|
|
|
154
|
-
|
|
153
|
+
const edgesColorDef = new this.m_module.OdTvColorDef(0xd0, 0xd0, 0xd0);
|
|
155
154
|
|
|
156
155
|
const entityPtr = this.m_entity.openObject();
|
|
157
|
-
entityPtr.setColor(colorDef, GeometryTypes.kFaces.value);
|
|
158
156
|
|
|
159
|
-
|
|
160
|
-
entityPtr.
|
|
157
|
+
entityPtr.setColor(facesColorDef, GeometryTypes.kFaces);
|
|
158
|
+
entityPtr.setTransparency(facesTransparencyDef, GeometryTypes.kFaces);
|
|
161
159
|
|
|
162
|
-
entityPtr.
|
|
160
|
+
entityPtr.setColor(edgesColorDef, GeometryTypes.kEdges);
|
|
163
161
|
|
|
164
|
-
entityPtr.
|
|
165
|
-
transparencyDef.setValue(1.0);
|
|
166
|
-
entityPtr.setTransparency(transparencyDef, GeometryTypes.kEdges);
|
|
162
|
+
entityPtr.setLineWeight(2);
|
|
167
163
|
|
|
168
|
-
this.
|
|
169
|
-
const polygonPtr = this.
|
|
164
|
+
this.m_planePreview = entityPtr.appendPolygon(this.getPlanePreviewCoordinate());
|
|
165
|
+
const polygonPtr = this.m_planePreview.openAsPolygon();
|
|
170
166
|
polygonPtr.setFilled(true);
|
|
171
167
|
|
|
172
|
-
this.deleteAll([
|
|
173
|
-
this.subject.syncOverlay();
|
|
168
|
+
this.deleteAll([facesColorDef, facesTransparencyDef, edgesColorDef, entityPtr, polygonPtr, GeometryTypes]);
|
|
174
169
|
}
|
|
175
170
|
|
|
176
171
|
drawPreview(): void {
|
|
177
|
-
const polygonPtr = this.
|
|
172
|
+
const polygonPtr = this.m_planePreview.openAsPolygon();
|
|
178
173
|
polygonPtr.setPoints(this.getPlanePreviewCoordinate());
|
|
179
174
|
this.deleteAll([polygonPtr]);
|
|
180
|
-
this.subject.syncOverlay();
|
|
181
175
|
}
|
|
182
176
|
}
|
|
@@ -35,19 +35,20 @@ export class OdCuttingPlaneXAxisDragger extends OdBaseCuttingPlaneDragger {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
override getPlanePreviewCoordinate(): number[] {
|
|
38
|
+
const halfSize = this.m_size / 2;
|
|
38
39
|
return [
|
|
39
40
|
this.m_center.x,
|
|
40
|
-
this.m_center.y -
|
|
41
|
-
this.m_center.z -
|
|
41
|
+
this.m_center.y - halfSize,
|
|
42
|
+
this.m_center.z - halfSize,
|
|
42
43
|
this.m_center.x,
|
|
43
|
-
this.m_center.y +
|
|
44
|
-
this.m_center.z -
|
|
44
|
+
this.m_center.y + halfSize,
|
|
45
|
+
this.m_center.z - halfSize,
|
|
45
46
|
this.m_center.x,
|
|
46
|
-
this.m_center.y +
|
|
47
|
-
this.m_center.z +
|
|
47
|
+
this.m_center.y + halfSize,
|
|
48
|
+
this.m_center.z + halfSize,
|
|
48
49
|
this.m_center.x,
|
|
49
|
-
this.m_center.y -
|
|
50
|
-
this.m_center.z +
|
|
50
|
+
this.m_center.y - halfSize,
|
|
51
|
+
this.m_center.z + halfSize,
|
|
51
52
|
];
|
|
52
53
|
}
|
|
53
54
|
}
|
|
@@ -35,19 +35,20 @@ export class OdCuttingPlaneYAxisDragger extends OdBaseCuttingPlaneDragger {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
override getPlanePreviewCoordinate(): number[] {
|
|
38
|
+
const halfSize = this.m_size / 2;
|
|
38
39
|
return [
|
|
39
|
-
this.m_center.x -
|
|
40
|
+
this.m_center.x - halfSize,
|
|
40
41
|
this.m_center.y,
|
|
41
|
-
this.m_center.z -
|
|
42
|
-
this.m_center.x +
|
|
42
|
+
this.m_center.z - halfSize,
|
|
43
|
+
this.m_center.x + halfSize,
|
|
43
44
|
this.m_center.y,
|
|
44
|
-
this.m_center.z -
|
|
45
|
-
this.m_center.x +
|
|
45
|
+
this.m_center.z - halfSize,
|
|
46
|
+
this.m_center.x + halfSize,
|
|
46
47
|
this.m_center.y,
|
|
47
|
-
this.m_center.z +
|
|
48
|
-
this.m_center.x -
|
|
48
|
+
this.m_center.z + halfSize,
|
|
49
|
+
this.m_center.x - halfSize,
|
|
49
50
|
this.m_center.y,
|
|
50
|
-
this.m_center.z +
|
|
51
|
+
this.m_center.z + halfSize,
|
|
51
52
|
];
|
|
52
53
|
}
|
|
53
54
|
}
|
|
@@ -35,18 +35,19 @@ export class OdCuttingPlaneZAxisDragger extends OdBaseCuttingPlaneDragger {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
override getPlanePreviewCoordinate(): number[] {
|
|
38
|
+
const halfSize = this.m_size / 2;
|
|
38
39
|
return [
|
|
39
|
-
this.m_center.x -
|
|
40
|
-
this.m_center.y -
|
|
40
|
+
this.m_center.x - halfSize,
|
|
41
|
+
this.m_center.y - halfSize,
|
|
41
42
|
this.m_center.z,
|
|
42
|
-
this.m_center.x +
|
|
43
|
-
this.m_center.y -
|
|
43
|
+
this.m_center.x + halfSize,
|
|
44
|
+
this.m_center.y - halfSize,
|
|
44
45
|
this.m_center.z,
|
|
45
|
-
this.m_center.x +
|
|
46
|
-
this.m_center.y +
|
|
46
|
+
this.m_center.x + halfSize,
|
|
47
|
+
this.m_center.y + halfSize,
|
|
47
48
|
this.m_center.z,
|
|
48
|
-
this.m_center.x -
|
|
49
|
-
this.m_center.y +
|
|
49
|
+
this.m_center.x - halfSize,
|
|
50
|
+
this.m_center.y + halfSize,
|
|
50
51
|
this.m_center.z,
|
|
51
52
|
];
|
|
52
53
|
}
|