@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
package/dist/viewer-visualize.js
CHANGED
|
@@ -2092,9 +2092,10 @@
|
|
|
2092
2092
|
const ext = this.getViewer().getActiveExtents();
|
|
2093
2093
|
const min = ext.min();
|
|
2094
2094
|
const max = ext.max();
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2095
|
+
const sizeX = Math.abs(max[0] - min[0]);
|
|
2096
|
+
const sizeY = Math.abs(max[1] - min[1]);
|
|
2097
|
+
const sizeZ = Math.abs(max[2] - min[2]);
|
|
2098
|
+
this.m_size = Math.sqrt(sizeX * sizeX + sizeY * sizeY + sizeZ * sizeZ) || 1;
|
|
2098
2099
|
this.m_center = this.toPoint(ext.center());
|
|
2099
2100
|
this.m_normal = this.createNormal();
|
|
2100
2101
|
const avp = this.getViewer().activeView;
|
|
@@ -2104,7 +2105,7 @@
|
|
|
2104
2105
|
this.index = avp.numCuttingPlanes() - 1;
|
|
2105
2106
|
const { red, green, blue } = this.subject.options.cuttingPlaneFillColor;
|
|
2106
2107
|
avp.setEnableCuttingPlaneFill(true, red, green, blue);
|
|
2107
|
-
avp.setCuttingPlaneFillPatternEnabled(true, this.m_module.CuttingPlaneFillStyle.
|
|
2108
|
+
avp.setCuttingPlaneFillPatternEnabled(true, this.m_module.CuttingPlaneFillStyle.kSlantRight, 0x0, 0x0, 0x0);
|
|
2108
2109
|
this.m_model = this.getModel();
|
|
2109
2110
|
this.createPreview();
|
|
2110
2111
|
this.deleteAll([ext, avp, plane]);
|
|
@@ -2113,9 +2114,9 @@
|
|
|
2113
2114
|
super.dispose();
|
|
2114
2115
|
if (this.m_entity) {
|
|
2115
2116
|
this.m_model.removeEntity(this.m_entity);
|
|
2116
|
-
this.deleteAll([this.m_model, this.m_entity, this.
|
|
2117
|
+
this.deleteAll([this.m_model, this.m_entity, this.m_planePreview, this.m_center]);
|
|
2117
2118
|
this.m_entity = null;
|
|
2118
|
-
this.
|
|
2119
|
+
this.m_planePreview = null;
|
|
2119
2120
|
this.subject.update();
|
|
2120
2121
|
}
|
|
2121
2122
|
}
|
|
@@ -2131,7 +2132,6 @@
|
|
|
2131
2132
|
start(x, y) {
|
|
2132
2133
|
this.press = true;
|
|
2133
2134
|
this.m_last = this.screenToWorld(x, y);
|
|
2134
|
-
this.m_click = { x, y };
|
|
2135
2135
|
}
|
|
2136
2136
|
drag(x, y) {
|
|
2137
2137
|
if (this.press) {
|
|
@@ -2143,52 +2143,47 @@
|
|
|
2143
2143
|
this.m_last = point;
|
|
2144
2144
|
const avp = this.getViewer().activeView;
|
|
2145
2145
|
const plane = this.createPlane();
|
|
2146
|
-
|
|
2147
|
-
|
|
2146
|
+
plane.set(this.toGePoint(this.m_center), this.m_normal);
|
|
2147
|
+
avp.updateCuttingPlane(this.index, plane);
|
|
2148
2148
|
this.drawPreview();
|
|
2149
|
-
this.deleteAll([avp, plane, oldCenter, delta, oldLast
|
|
2149
|
+
this.deleteAll([avp, plane, oldCenter, delta, oldLast]);
|
|
2150
2150
|
const device = this.getViewer().getActiveDevice();
|
|
2151
2151
|
device.invalidate(device.getSize());
|
|
2152
2152
|
}
|
|
2153
2153
|
}
|
|
2154
2154
|
end(x, y) {
|
|
2155
2155
|
this.press = false;
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2156
|
+
}
|
|
2157
|
+
dblclick(ev) {
|
|
2158
|
+
this.m_normal = [this.m_normal[0] * -1, this.m_normal[1] * -1, this.m_normal[2] * -1];
|
|
2159
|
+
const avp = this.getViewer().activeView;
|
|
2160
|
+
const plane = this.createPlane();
|
|
2161
|
+
plane.set(this.toGePoint(this.m_center), this.m_normal);
|
|
2162
|
+
avp.updateCuttingPlane(this.index, plane);
|
|
2163
|
+
this.deleteAll([avp, plane, this.m_last]);
|
|
2164
|
+
const device = this.getViewer().getActiveDevice();
|
|
2165
|
+
device.invalidate(device.getSize());
|
|
2166
2166
|
}
|
|
2167
2167
|
createPreview() {
|
|
2168
2168
|
this.m_entity = this.m_model.appendEntity("&CuttingPlanePreview");
|
|
2169
2169
|
const GeometryTypes = this.m_module.GeometryTypes;
|
|
2170
|
-
const
|
|
2171
|
-
const
|
|
2172
|
-
|
|
2170
|
+
const facesColorDef = new this.m_module.OdTvColorDef(0xf0, 0xf0, 0xf0);
|
|
2171
|
+
const facesTransparencyDef = new this.m_module.OdTvTransparencyDef(0.7);
|
|
2172
|
+
const edgesColorDef = new this.m_module.OdTvColorDef(0xd0, 0xd0, 0xd0);
|
|
2173
2173
|
const entityPtr = this.m_entity.openObject();
|
|
2174
|
-
entityPtr.setColor(
|
|
2175
|
-
|
|
2176
|
-
entityPtr.setColor(
|
|
2177
|
-
entityPtr.setLineWeight(
|
|
2178
|
-
entityPtr.
|
|
2179
|
-
|
|
2180
|
-
entityPtr.setTransparency(transparencyDef, GeometryTypes.kEdges);
|
|
2181
|
-
this.planePreview = entityPtr.appendPolygon(this.getPlanePreviewCoordinate());
|
|
2182
|
-
const polygonPtr = this.planePreview.openAsPolygon();
|
|
2174
|
+
entityPtr.setColor(facesColorDef, GeometryTypes.kFaces);
|
|
2175
|
+
entityPtr.setTransparency(facesTransparencyDef, GeometryTypes.kFaces);
|
|
2176
|
+
entityPtr.setColor(edgesColorDef, GeometryTypes.kEdges);
|
|
2177
|
+
entityPtr.setLineWeight(2);
|
|
2178
|
+
this.m_planePreview = entityPtr.appendPolygon(this.getPlanePreviewCoordinate());
|
|
2179
|
+
const polygonPtr = this.m_planePreview.openAsPolygon();
|
|
2183
2180
|
polygonPtr.setFilled(true);
|
|
2184
|
-
this.deleteAll([
|
|
2185
|
-
this.subject.syncOverlay();
|
|
2181
|
+
this.deleteAll([facesColorDef, facesTransparencyDef, edgesColorDef, entityPtr, polygonPtr, GeometryTypes]);
|
|
2186
2182
|
}
|
|
2187
2183
|
drawPreview() {
|
|
2188
|
-
const polygonPtr = this.
|
|
2184
|
+
const polygonPtr = this.m_planePreview.openAsPolygon();
|
|
2189
2185
|
polygonPtr.setPoints(this.getPlanePreviewCoordinate());
|
|
2190
2186
|
this.deleteAll([polygonPtr]);
|
|
2191
|
-
this.subject.syncOverlay();
|
|
2192
2187
|
}
|
|
2193
2188
|
}
|
|
2194
2189
|
|
|
@@ -2202,19 +2197,20 @@
|
|
|
2202
2197
|
return delta;
|
|
2203
2198
|
}
|
|
2204
2199
|
getPlanePreviewCoordinate() {
|
|
2200
|
+
const halfSize = this.m_size / 2;
|
|
2205
2201
|
return [
|
|
2206
2202
|
this.m_center.x,
|
|
2207
|
-
this.m_center.y -
|
|
2208
|
-
this.m_center.z -
|
|
2203
|
+
this.m_center.y - halfSize,
|
|
2204
|
+
this.m_center.z - halfSize,
|
|
2209
2205
|
this.m_center.x,
|
|
2210
|
-
this.m_center.y +
|
|
2211
|
-
this.m_center.z -
|
|
2206
|
+
this.m_center.y + halfSize,
|
|
2207
|
+
this.m_center.z - halfSize,
|
|
2212
2208
|
this.m_center.x,
|
|
2213
|
-
this.m_center.y +
|
|
2214
|
-
this.m_center.z +
|
|
2209
|
+
this.m_center.y + halfSize,
|
|
2210
|
+
this.m_center.z + halfSize,
|
|
2215
2211
|
this.m_center.x,
|
|
2216
|
-
this.m_center.y -
|
|
2217
|
-
this.m_center.z +
|
|
2212
|
+
this.m_center.y - halfSize,
|
|
2213
|
+
this.m_center.z + halfSize,
|
|
2218
2214
|
];
|
|
2219
2215
|
}
|
|
2220
2216
|
}
|
|
@@ -2229,19 +2225,20 @@
|
|
|
2229
2225
|
return delta;
|
|
2230
2226
|
}
|
|
2231
2227
|
getPlanePreviewCoordinate() {
|
|
2228
|
+
const halfSize = this.m_size / 2;
|
|
2232
2229
|
return [
|
|
2233
|
-
this.m_center.x -
|
|
2230
|
+
this.m_center.x - halfSize,
|
|
2234
2231
|
this.m_center.y,
|
|
2235
|
-
this.m_center.z -
|
|
2236
|
-
this.m_center.x +
|
|
2232
|
+
this.m_center.z - halfSize,
|
|
2233
|
+
this.m_center.x + halfSize,
|
|
2237
2234
|
this.m_center.y,
|
|
2238
|
-
this.m_center.z -
|
|
2239
|
-
this.m_center.x +
|
|
2235
|
+
this.m_center.z - halfSize,
|
|
2236
|
+
this.m_center.x + halfSize,
|
|
2240
2237
|
this.m_center.y,
|
|
2241
|
-
this.m_center.z +
|
|
2242
|
-
this.m_center.x -
|
|
2238
|
+
this.m_center.z + halfSize,
|
|
2239
|
+
this.m_center.x - halfSize,
|
|
2243
2240
|
this.m_center.y,
|
|
2244
|
-
this.m_center.z +
|
|
2241
|
+
this.m_center.z + halfSize,
|
|
2245
2242
|
];
|
|
2246
2243
|
}
|
|
2247
2244
|
}
|
|
@@ -2256,18 +2253,19 @@
|
|
|
2256
2253
|
return delta;
|
|
2257
2254
|
}
|
|
2258
2255
|
getPlanePreviewCoordinate() {
|
|
2256
|
+
const halfSize = this.m_size / 2;
|
|
2259
2257
|
return [
|
|
2260
|
-
this.m_center.x -
|
|
2261
|
-
this.m_center.y -
|
|
2258
|
+
this.m_center.x - halfSize,
|
|
2259
|
+
this.m_center.y - halfSize,
|
|
2262
2260
|
this.m_center.z,
|
|
2263
|
-
this.m_center.x +
|
|
2264
|
-
this.m_center.y -
|
|
2261
|
+
this.m_center.x + halfSize,
|
|
2262
|
+
this.m_center.y - halfSize,
|
|
2265
2263
|
this.m_center.z,
|
|
2266
|
-
this.m_center.x +
|
|
2267
|
-
this.m_center.y +
|
|
2264
|
+
this.m_center.x + halfSize,
|
|
2265
|
+
this.m_center.y + halfSize,
|
|
2268
2266
|
this.m_center.z,
|
|
2269
|
-
this.m_center.x -
|
|
2270
|
-
this.m_center.y +
|
|
2267
|
+
this.m_center.x - halfSize,
|
|
2268
|
+
this.m_center.y + halfSize,
|
|
2271
2269
|
this.m_center.z,
|
|
2272
2270
|
];
|
|
2273
2271
|
}
|