@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.
@@ -1533,10 +1533,9 @@ class OdBaseCuttingPlaneDragger extends OdBaseDragger {
1533
1533
  const ext = this.getViewer().getActiveExtents();
1534
1534
  const min = ext.min();
1535
1535
  const max = ext.max();
1536
- const sizeX = Math.abs(max[0] - min[0]);
1537
- const sizeY = Math.abs(max[1] - min[1]);
1538
- const sizeZ = Math.abs(max[2] - min[2]);
1539
- this.m_size = Math.sqrt(sizeX * sizeX + sizeY * sizeY + sizeZ * sizeZ) || 1;
1536
+ this.m_size_x = Math.abs(max[0] - min[0]) / 2;
1537
+ this.m_size_y = Math.abs(max[1] - min[1]) / 2;
1538
+ this.m_size_z = Math.abs(max[2] - min[2]) / 2;
1540
1539
  this.m_center = this.toPoint(ext.center());
1541
1540
  this.m_normal = this.createNormal();
1542
1541
  const avp = this.getViewer().activeView;
@@ -1546,7 +1545,7 @@ class OdBaseCuttingPlaneDragger extends OdBaseDragger {
1546
1545
  this.index = avp.numCuttingPlanes() - 1;
1547
1546
  const { red, green, blue } = this.subject.options.cuttingPlaneFillColor;
1548
1547
  avp.setEnableCuttingPlaneFill(true, red, green, blue);
1549
- avp.setCuttingPlaneFillPatternEnabled(true, this.m_module.CuttingPlaneFillStyle.kSlantRight, 0x0, 0x0, 0x0);
1548
+ avp.setCuttingPlaneFillPatternEnabled(true, this.m_module.CuttingPlaneFillStyle.kHorizontalBars, 0x0, 0x0, 0x0);
1550
1549
  this.m_model = this.getModel();
1551
1550
  this.createPreview();
1552
1551
  this.deleteAll([ext, avp, plane]);
@@ -1555,9 +1554,9 @@ class OdBaseCuttingPlaneDragger extends OdBaseDragger {
1555
1554
  super.dispose();
1556
1555
  if (this.m_entity) {
1557
1556
  this.m_model.removeEntity(this.m_entity);
1558
- this.deleteAll([this.m_model, this.m_entity, this.m_planePreview, this.m_center]);
1557
+ this.deleteAll([this.m_model, this.m_entity, this.planePreview, this.m_center]);
1559
1558
  this.m_entity = null;
1560
- this.m_planePreview = null;
1559
+ this.planePreview = null;
1561
1560
  this.subject.update();
1562
1561
  }
1563
1562
  }
@@ -1573,6 +1572,7 @@ class OdBaseCuttingPlaneDragger extends OdBaseDragger {
1573
1572
  start(x, y) {
1574
1573
  this.press = true;
1575
1574
  this.m_last = this.screenToWorld(x, y);
1575
+ this.m_click = { x, y };
1576
1576
  }
1577
1577
  drag(x, y) {
1578
1578
  if (this.press) {
@@ -1584,47 +1584,52 @@ class OdBaseCuttingPlaneDragger extends OdBaseDragger {
1584
1584
  this.m_last = point;
1585
1585
  const avp = this.getViewer().activeView;
1586
1586
  const plane = this.createPlane();
1587
- plane.set(this.toGePoint(this.m_center), this.m_normal);
1588
- avp.updateCuttingPlane(this.index, plane);
1587
+ const newPlane = plane.set(this.toGePoint(this.m_center), this.m_normal);
1588
+ const newCutting = avp.updateCuttingPlane(this.index, plane);
1589
1589
  this.drawPreview();
1590
- this.deleteAll([avp, plane, oldCenter, delta, oldLast]);
1590
+ this.deleteAll([avp, plane, oldCenter, delta, oldLast, newPlane, newCutting]);
1591
1591
  const device = this.getViewer().getActiveDevice();
1592
1592
  device.invalidate(device.getSize());
1593
1593
  }
1594
1594
  }
1595
1595
  end(x, y) {
1596
1596
  this.press = false;
1597
- }
1598
- dblclick(ev) {
1599
- this.m_normal = [this.m_normal[0] * -1, this.m_normal[1] * -1, this.m_normal[2] * -1];
1600
- const avp = this.getViewer().activeView;
1601
- const plane = this.createPlane();
1602
- plane.set(this.toGePoint(this.m_center), this.m_normal);
1603
- avp.updateCuttingPlane(this.index, plane);
1604
- this.deleteAll([avp, plane, this.m_last]);
1605
- const device = this.getViewer().getActiveDevice();
1606
- device.invalidate(device.getSize());
1597
+ if (x === this.m_click.x && y === this.m_click.y) {
1598
+ this.m_normal = [this.m_normal[0] * -1, this.m_normal[1] * -1, this.m_normal[2] * -1];
1599
+ const avp = this.getViewer().activeView;
1600
+ const plane = this.createPlane();
1601
+ plane.set(this.toGePoint(this.m_center), this.m_normal);
1602
+ avp.updateCuttingPlane(this.index, plane);
1603
+ this.deleteAll([avp, plane, this.m_last]);
1604
+ const device = this.getViewer().getActiveDevice();
1605
+ device.invalidate(device.getSize());
1606
+ }
1607
1607
  }
1608
1608
  createPreview() {
1609
1609
  this.m_entity = this.m_model.appendEntity("&CuttingPlanePreview");
1610
1610
  const GeometryTypes = this.m_module.GeometryTypes;
1611
- const facesColorDef = new this.m_module.OdTvColorDef(0xf0, 0xf0, 0xf0);
1612
- const facesTransparencyDef = new this.m_module.OdTvTransparencyDef(0.7);
1613
- const edgesColorDef = new this.m_module.OdTvColorDef(0xd0, 0xd0, 0xd0);
1611
+ const transparencyDef = new this.m_module.OdTvTransparencyDef();
1612
+ const colorDef = new this.m_module.OdTvColorDef(112, 112, 112);
1613
+ transparencyDef.setValue(0.9);
1614
1614
  const entityPtr = this.m_entity.openObject();
1615
- entityPtr.setColor(facesColorDef, GeometryTypes.kFaces);
1616
- entityPtr.setTransparency(facesTransparencyDef, GeometryTypes.kFaces);
1617
- entityPtr.setColor(edgesColorDef, GeometryTypes.kEdges);
1618
- entityPtr.setLineWeight(2);
1619
- this.m_planePreview = entityPtr.appendPolygon(this.getPlanePreviewCoordinate());
1620
- const polygonPtr = this.m_planePreview.openAsPolygon();
1615
+ entityPtr.setColor(colorDef, GeometryTypes.kFaces.value);
1616
+ colorDef.setColor(112, 112, 112);
1617
+ entityPtr.setColor(colorDef, GeometryTypes.kEdges.value);
1618
+ entityPtr.setLineWeight(5);
1619
+ entityPtr.setTransparency(transparencyDef, GeometryTypes.kFaces);
1620
+ transparencyDef.setValue(1.0);
1621
+ entityPtr.setTransparency(transparencyDef, GeometryTypes.kEdges);
1622
+ this.planePreview = entityPtr.appendPolygon(this.getPlanePreviewCoordinate());
1623
+ const polygonPtr = this.planePreview.openAsPolygon();
1621
1624
  polygonPtr.setFilled(true);
1622
- this.deleteAll([facesColorDef, facesTransparencyDef, edgesColorDef, entityPtr, polygonPtr, GeometryTypes]);
1625
+ this.deleteAll([transparencyDef, colorDef, entityPtr, polygonPtr, GeometryTypes]);
1626
+ this.subject.syncOverlay();
1623
1627
  }
1624
1628
  drawPreview() {
1625
- const polygonPtr = this.m_planePreview.openAsPolygon();
1629
+ const polygonPtr = this.planePreview.openAsPolygon();
1626
1630
  polygonPtr.setPoints(this.getPlanePreviewCoordinate());
1627
1631
  this.deleteAll([polygonPtr]);
1632
+ this.subject.syncOverlay();
1628
1633
  }
1629
1634
  }
1630
1635
 
@@ -1638,20 +1643,19 @@ class OdCuttingPlaneXAxisDragger extends OdBaseCuttingPlaneDragger {
1638
1643
  return delta;
1639
1644
  }
1640
1645
  getPlanePreviewCoordinate() {
1641
- const halfSize = this.m_size / 2;
1642
1646
  return [
1643
1647
  this.m_center.x,
1644
- this.m_center.y - halfSize,
1645
- this.m_center.z - halfSize,
1648
+ this.m_center.y - this.m_size_y,
1649
+ this.m_center.z - this.m_size_z,
1646
1650
  this.m_center.x,
1647
- this.m_center.y + halfSize,
1648
- this.m_center.z - halfSize,
1651
+ this.m_center.y + this.m_size_y,
1652
+ this.m_center.z - this.m_size_z,
1649
1653
  this.m_center.x,
1650
- this.m_center.y + halfSize,
1651
- this.m_center.z + halfSize,
1654
+ this.m_center.y + this.m_size_y,
1655
+ this.m_center.z + this.m_size_z,
1652
1656
  this.m_center.x,
1653
- this.m_center.y - halfSize,
1654
- this.m_center.z + halfSize,
1657
+ this.m_center.y - this.m_size_y,
1658
+ this.m_center.z + this.m_size_z,
1655
1659
  ];
1656
1660
  }
1657
1661
  }
@@ -1666,20 +1670,19 @@ class OdCuttingPlaneYAxisDragger extends OdBaseCuttingPlaneDragger {
1666
1670
  return delta;
1667
1671
  }
1668
1672
  getPlanePreviewCoordinate() {
1669
- const halfSize = this.m_size / 2;
1670
1673
  return [
1671
- this.m_center.x - halfSize,
1674
+ this.m_center.x - this.m_size_x,
1672
1675
  this.m_center.y,
1673
- this.m_center.z - halfSize,
1674
- this.m_center.x + halfSize,
1676
+ this.m_center.z - this.m_size_z,
1677
+ this.m_center.x + this.m_size_x,
1675
1678
  this.m_center.y,
1676
- this.m_center.z - halfSize,
1677
- this.m_center.x + halfSize,
1679
+ this.m_center.z - this.m_size_z,
1680
+ this.m_center.x + this.m_size_x,
1678
1681
  this.m_center.y,
1679
- this.m_center.z + halfSize,
1680
- this.m_center.x - halfSize,
1682
+ this.m_center.z + this.m_size_z,
1683
+ this.m_center.x - this.m_size_x,
1681
1684
  this.m_center.y,
1682
- this.m_center.z + halfSize,
1685
+ this.m_center.z + this.m_size_z,
1683
1686
  ];
1684
1687
  }
1685
1688
  }
@@ -1694,19 +1697,18 @@ class OdCuttingPlaneZAxisDragger extends OdBaseCuttingPlaneDragger {
1694
1697
  return delta;
1695
1698
  }
1696
1699
  getPlanePreviewCoordinate() {
1697
- const halfSize = this.m_size / 2;
1698
1700
  return [
1699
- this.m_center.x - halfSize,
1700
- this.m_center.y - halfSize,
1701
+ this.m_center.x - this.m_size_x,
1702
+ this.m_center.y - this.m_size_y,
1701
1703
  this.m_center.z,
1702
- this.m_center.x + halfSize,
1703
- this.m_center.y - halfSize,
1704
+ this.m_center.x + this.m_size_x,
1705
+ this.m_center.y - this.m_size_y,
1704
1706
  this.m_center.z,
1705
- this.m_center.x + halfSize,
1706
- this.m_center.y + halfSize,
1707
+ this.m_center.x + this.m_size_x,
1708
+ this.m_center.y + this.m_size_y,
1707
1709
  this.m_center.z,
1708
- this.m_center.x - halfSize,
1709
- this.m_center.y + halfSize,
1710
+ this.m_center.x - this.m_size_x,
1711
+ this.m_center.y + this.m_size_y,
1710
1712
  this.m_center.z,
1711
1713
  ];
1712
1714
  }
@@ -4085,7 +4087,7 @@ class Viewer extends EventEmitter2 {
4085
4087
  return this._markup;
4086
4088
  }
4087
4089
  configure(params) {
4088
- this._visualizeJsUrl = params.visualizeJsUrl || "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/master/Visualize.js";
4090
+ this._visualizeJsUrl = params.visualizeJsUrl || "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/27.2/Visualize.js";
4089
4091
  this._crossOrigin = params.crossOrigin;
4090
4092
  return this;
4091
4093
  }