@inweb/viewer-visualize 27.2.3 → 27.2.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.
@@ -2092,10 +2092,9 @@
2092
2092
  const ext = this.getViewer().getActiveExtents();
2093
2093
  const min = ext.min();
2094
2094
  const max = ext.max();
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;
2095
+ this.m_size_x = Math.abs(max[0] - min[0]) / 2;
2096
+ this.m_size_y = Math.abs(max[1] - min[1]) / 2;
2097
+ this.m_size_z = Math.abs(max[2] - min[2]) / 2;
2099
2098
  this.m_center = this.toPoint(ext.center());
2100
2099
  this.m_normal = this.createNormal();
2101
2100
  const avp = this.getViewer().activeView;
@@ -2105,7 +2104,7 @@
2105
2104
  this.index = avp.numCuttingPlanes() - 1;
2106
2105
  const { red, green, blue } = this.subject.options.cuttingPlaneFillColor;
2107
2106
  avp.setEnableCuttingPlaneFill(true, red, green, blue);
2108
- avp.setCuttingPlaneFillPatternEnabled(true, this.m_module.CuttingPlaneFillStyle.kSlantRight, 0x0, 0x0, 0x0);
2107
+ avp.setCuttingPlaneFillPatternEnabled(true, this.m_module.CuttingPlaneFillStyle.kHorizontalBars, 0x0, 0x0, 0x0);
2109
2108
  this.m_model = this.getModel();
2110
2109
  this.createPreview();
2111
2110
  this.deleteAll([ext, avp, plane]);
@@ -2114,9 +2113,9 @@
2114
2113
  super.dispose();
2115
2114
  if (this.m_entity) {
2116
2115
  this.m_model.removeEntity(this.m_entity);
2117
- this.deleteAll([this.m_model, this.m_entity, this.m_planePreview, this.m_center]);
2116
+ this.deleteAll([this.m_model, this.m_entity, this.planePreview, this.m_center]);
2118
2117
  this.m_entity = null;
2119
- this.m_planePreview = null;
2118
+ this.planePreview = null;
2120
2119
  this.subject.update();
2121
2120
  }
2122
2121
  }
@@ -2132,6 +2131,7 @@
2132
2131
  start(x, y) {
2133
2132
  this.press = true;
2134
2133
  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,47 +2143,52 @@
2143
2143
  this.m_last = point;
2144
2144
  const avp = this.getViewer().activeView;
2145
2145
  const plane = this.createPlane();
2146
- plane.set(this.toGePoint(this.m_center), this.m_normal);
2147
- avp.updateCuttingPlane(this.index, plane);
2146
+ const newPlane = plane.set(this.toGePoint(this.m_center), this.m_normal);
2147
+ const newCutting = 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, newPlane, newCutting]);
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
- 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());
2156
+ if (x === this.m_click.x && y === this.m_click.y) {
2157
+ this.m_normal = [this.m_normal[0] * -1, this.m_normal[1] * -1, this.m_normal[2] * -1];
2158
+ const avp = this.getViewer().activeView;
2159
+ const plane = this.createPlane();
2160
+ plane.set(this.toGePoint(this.m_center), this.m_normal);
2161
+ avp.updateCuttingPlane(this.index, plane);
2162
+ this.deleteAll([avp, plane, this.m_last]);
2163
+ const device = this.getViewer().getActiveDevice();
2164
+ device.invalidate(device.getSize());
2165
+ }
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 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);
2170
+ const transparencyDef = new this.m_module.OdTvTransparencyDef();
2171
+ const colorDef = new this.m_module.OdTvColorDef(112, 112, 112);
2172
+ transparencyDef.setValue(0.9);
2173
2173
  const entityPtr = this.m_entity.openObject();
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();
2174
+ entityPtr.setColor(colorDef, GeometryTypes.kFaces.value);
2175
+ colorDef.setColor(112, 112, 112);
2176
+ entityPtr.setColor(colorDef, GeometryTypes.kEdges.value);
2177
+ entityPtr.setLineWeight(5);
2178
+ entityPtr.setTransparency(transparencyDef, GeometryTypes.kFaces);
2179
+ transparencyDef.setValue(1.0);
2180
+ entityPtr.setTransparency(transparencyDef, GeometryTypes.kEdges);
2181
+ this.planePreview = entityPtr.appendPolygon(this.getPlanePreviewCoordinate());
2182
+ const polygonPtr = this.planePreview.openAsPolygon();
2180
2183
  polygonPtr.setFilled(true);
2181
- this.deleteAll([facesColorDef, facesTransparencyDef, edgesColorDef, entityPtr, polygonPtr, GeometryTypes]);
2184
+ this.deleteAll([transparencyDef, colorDef, entityPtr, polygonPtr, GeometryTypes]);
2185
+ this.subject.syncOverlay();
2182
2186
  }
2183
2187
  drawPreview() {
2184
- const polygonPtr = this.m_planePreview.openAsPolygon();
2188
+ const polygonPtr = this.planePreview.openAsPolygon();
2185
2189
  polygonPtr.setPoints(this.getPlanePreviewCoordinate());
2186
2190
  this.deleteAll([polygonPtr]);
2191
+ this.subject.syncOverlay();
2187
2192
  }
2188
2193
  }
2189
2194
 
@@ -2197,20 +2202,19 @@
2197
2202
  return delta;
2198
2203
  }
2199
2204
  getPlanePreviewCoordinate() {
2200
- const halfSize = this.m_size / 2;
2201
2205
  return [
2202
2206
  this.m_center.x,
2203
- this.m_center.y - halfSize,
2204
- this.m_center.z - halfSize,
2207
+ this.m_center.y - this.m_size_y,
2208
+ this.m_center.z - this.m_size_z,
2205
2209
  this.m_center.x,
2206
- this.m_center.y + halfSize,
2207
- this.m_center.z - halfSize,
2210
+ this.m_center.y + this.m_size_y,
2211
+ this.m_center.z - this.m_size_z,
2208
2212
  this.m_center.x,
2209
- this.m_center.y + halfSize,
2210
- this.m_center.z + halfSize,
2213
+ this.m_center.y + this.m_size_y,
2214
+ this.m_center.z + this.m_size_z,
2211
2215
  this.m_center.x,
2212
- this.m_center.y - halfSize,
2213
- this.m_center.z + halfSize,
2216
+ this.m_center.y - this.m_size_y,
2217
+ this.m_center.z + this.m_size_z,
2214
2218
  ];
2215
2219
  }
2216
2220
  }
@@ -2225,20 +2229,19 @@
2225
2229
  return delta;
2226
2230
  }
2227
2231
  getPlanePreviewCoordinate() {
2228
- const halfSize = this.m_size / 2;
2229
2232
  return [
2230
- this.m_center.x - halfSize,
2233
+ this.m_center.x - this.m_size_x,
2231
2234
  this.m_center.y,
2232
- this.m_center.z - halfSize,
2233
- this.m_center.x + halfSize,
2235
+ this.m_center.z - this.m_size_z,
2236
+ this.m_center.x + this.m_size_x,
2234
2237
  this.m_center.y,
2235
- this.m_center.z - halfSize,
2236
- this.m_center.x + halfSize,
2238
+ this.m_center.z - this.m_size_z,
2239
+ this.m_center.x + this.m_size_x,
2237
2240
  this.m_center.y,
2238
- this.m_center.z + halfSize,
2239
- this.m_center.x - halfSize,
2241
+ this.m_center.z + this.m_size_z,
2242
+ this.m_center.x - this.m_size_x,
2240
2243
  this.m_center.y,
2241
- this.m_center.z + halfSize,
2244
+ this.m_center.z + this.m_size_z,
2242
2245
  ];
2243
2246
  }
2244
2247
  }
@@ -2253,19 +2256,18 @@
2253
2256
  return delta;
2254
2257
  }
2255
2258
  getPlanePreviewCoordinate() {
2256
- const halfSize = this.m_size / 2;
2257
2259
  return [
2258
- this.m_center.x - halfSize,
2259
- this.m_center.y - halfSize,
2260
+ this.m_center.x - this.m_size_x,
2261
+ this.m_center.y - this.m_size_y,
2260
2262
  this.m_center.z,
2261
- this.m_center.x + halfSize,
2262
- this.m_center.y - halfSize,
2263
+ this.m_center.x + this.m_size_x,
2264
+ this.m_center.y - this.m_size_y,
2263
2265
  this.m_center.z,
2264
- this.m_center.x + halfSize,
2265
- this.m_center.y + halfSize,
2266
+ this.m_center.x + this.m_size_x,
2267
+ this.m_center.y + this.m_size_y,
2266
2268
  this.m_center.z,
2267
- this.m_center.x - halfSize,
2268
- this.m_center.y + halfSize,
2269
+ this.m_center.x - this.m_size_x,
2270
+ this.m_center.y + this.m_size_y,
2269
2271
  this.m_center.z,
2270
2272
  ];
2271
2273
  }
@@ -18287,7 +18289,7 @@ js: import "konva/skia-backend";
18287
18289
  return this._markup;
18288
18290
  }
18289
18291
  configure(params) {
18290
- this._visualizeJsUrl = params.visualizeJsUrl || "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/master/Visualize.js";
18292
+ this._visualizeJsUrl = params.visualizeJsUrl || "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/27.2/Visualize.js";
18291
18293
  this._crossOrigin = params.crossOrigin;
18292
18294
  return this;
18293
18295
  }