@inweb/client 25.3.9 → 25.3.10

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/client.js CHANGED
@@ -1555,342 +1555,183 @@
1555
1555
  }
1556
1556
 
1557
1557
  ///////////////////////////////////////////////////////////////////////////////
1558
- // Copyright (C) 2002-2021, Open Design Alliance (the "Alliance").
1559
- // All rights reserved.
1560
- //
1561
- // This software and its documentation and related materials are owned by
1562
- // the Alliance. The software may only be incorporated into application
1563
- // programs owned by members of the Alliance, subject to a signed
1564
- // Membership Agreement and Supplemental Software License Agreement with the
1565
- // Alliance. The structure and organization of this software are the valuable
1566
- // trade secrets of the Alliance and its suppliers. The software is also
1567
- // protected by copyright law and international treaty provisions. Application
1568
- // programs incorporating this software must include the following statement
1569
- // with their copyright notices:
1570
- //
1571
- // This application incorporates Open Design Alliance software pursuant to a
1572
- // license agreement with Open Design Alliance.
1573
- // Open Design Alliance Copyright (C) 2002-2021 by Open Design Alliance.
1574
- // All rights reserved.
1575
- //
1576
- // By use of this software, its documentation or related materials, you
1577
- // acknowledge and accept the above terms.
1578
- ///////////////////////////////////////////////////////////////////////////////
1579
- class Options {
1580
- constructor(emitter) {
1581
- this._emitter = emitter;
1582
- this._data = Options.defaults();
1583
- this.loadFromStorage();
1584
- }
1585
- static defaults() {
1586
- return {
1587
- showWCS: true,
1588
- cameraAnimation: true,
1589
- antialiasing: true,
1590
- groundShadow: false,
1591
- shadows: false,
1592
- cameraAxisXSpeed: 4,
1593
- cameraAxisYSpeed: 1,
1594
- ambientOcclusion: false,
1595
- enableStreamingMode: true,
1596
- enablePartialMode: false,
1597
- memoryLimit: 3294967296,
1598
- cuttingPlaneFillColor: { red: 0xff, green: 0x98, blue: 0x00 },
1599
- edgesColor: { r: 0xff, g: 0x98, b: 0x00 },
1600
- facesColor: { r: 0xff, g: 0x98, b: 0x00 },
1601
- edgesVisibility: true,
1602
- edgesOverlap: true,
1603
- facesOverlap: false,
1604
- facesTransparancy: 200,
1605
- enableCustomHighlight: true,
1606
- sceneGraph: false,
1607
- edgeModel: true,
1608
- reverseZoomWheel: false,
1609
- enableZoomWheel: true,
1610
- enableGestures: true,
1611
- geometryType: "vsfx",
1612
- };
1558
+ /**
1559
+ * A permission provides information about {@link File | file} sharing granted to a specific
1560
+ * {@link User | users}, group, or project {@link Member | member}.
1561
+ */
1562
+ class Permission {
1563
+ /**
1564
+ * @param data - An object that implements permission data storage.
1565
+ * @param fileId - Owner file ID.
1566
+ * @param httpClient - Http client.
1567
+ */
1568
+ constructor(data, fileId, httpClient) {
1569
+ this.httpClient = httpClient;
1570
+ this.fileId = fileId;
1571
+ this.data = data;
1613
1572
  }
1614
- notifierChangeEvent() {
1615
- if (this._emitter !== undefined) {
1616
- this.saveToStorage();
1617
- this._emitter.emit({ type: "optionschange", data: this });
1618
- }
1573
+ internalGet() {
1574
+ return this.httpClient.get(`/files/${this.fileId}/permissions/${this.id}`);
1619
1575
  }
1620
- saveToStorage() {
1621
- if (typeof window !== "undefined")
1622
- try {
1623
- localStorage.setItem("od-client-settings", JSON.stringify(this.data));
1624
- }
1625
- catch (error) {
1626
- console.error("Cannot save client settings.", error);
1627
- }
1576
+ internalPut(body) {
1577
+ return this.httpClient.put(`/files/${this.fileId}/permissions/${this.id}`, body);
1628
1578
  }
1629
- loadFromStorage() {
1630
- if (typeof window !== "undefined")
1631
- try {
1632
- const item = localStorage.getItem("od-client-settings");
1633
- if (item) {
1634
- const data = JSON.parse(item);
1635
- this.data = { ...data };
1636
- }
1637
- }
1638
- catch (error) {
1639
- console.error("Cannot load client settings.", error);
1640
- }
1579
+ internalDelete() {
1580
+ return this.httpClient.delete(`/files/${this.fileId}/permissions/${this.id}`);
1641
1581
  }
1642
1582
  /**
1643
- * Reset options to default
1583
+ * Defines what actions are allowed to be performed on a file with this permission:
1644
1584
  *
1645
- * @param fields - Name of fields to be reset
1585
+ * - `read` - The ability to read file description, geometry data and properties
1586
+ * - `readSourceFile` - The ability to read source file
1587
+ * - `write` - The ability to modify file name, description and references
1588
+ * - `readViewpoint` - The ability to read file viewpoints
1589
+ * - `createViewpoint` - The ability to create file viewpoints
1646
1590
  */
1647
- resetToDefaults(fields) {
1648
- if (fields !== undefined) {
1649
- const defaults = Options.defaults();
1650
- const resetData = fields.reduce((acc, field) => {
1651
- acc[field] = defaults[field];
1652
- return acc;
1653
- }, {});
1654
- this.data = { ...this.data, ...resetData };
1655
- }
1656
- else {
1657
- this.data = { ...this.data, ...Options.defaults() };
1658
- }
1591
+ get actions() {
1592
+ return this.data.actions;
1593
+ }
1594
+ set actions(value) {
1595
+ this._data.actions = value;
1659
1596
  }
1597
+ /**
1598
+ * Raw permission data received from the server.
1599
+ *
1600
+ * @readonly
1601
+ */
1660
1602
  get data() {
1661
1603
  return this._data;
1662
1604
  }
1663
1605
  set data(value) {
1664
- const sceneGraph = value.enablePartialMode ? false : value.sceneGraph;
1665
- this._data = { ...Options.defaults(), ...this._data, ...value, sceneGraph };
1666
- this.notifierChangeEvent();
1606
+ this._data = value;
1667
1607
  }
1668
- get showWCS() {
1669
- return this._data.showWCS;
1608
+ /**
1609
+ * Unique permission ID.
1610
+ *
1611
+ * @readonly
1612
+ */
1613
+ get id() {
1614
+ return this.data.id;
1670
1615
  }
1671
- set showWCS(value) {
1672
- this._data.showWCS = value;
1673
- this.notifierChangeEvent();
1616
+ /**
1617
+ * Principials are any entity that can be authenticated by the server, such as a any user or
1618
+ * project that will get access to the file.
1619
+ *
1620
+ * @typedef {any} Principial
1621
+ * @property {any} user - The user entry that get access to the file.
1622
+ * @property {string} user.id - User ID.
1623
+ * @property {string} user.name - User name.
1624
+ * @property {any} project - The project entry that get access to the file.
1625
+ * @property {string} project.id - Project ID.
1626
+ * @property {string} project.name - Project name.
1627
+ */
1628
+ /**
1629
+ * A collection of principials that will get access to the file.
1630
+ */
1631
+ get grantedTo() {
1632
+ return this.data.grantedTo;
1674
1633
  }
1675
- get cameraAnimation() {
1676
- return this._data.cameraAnimation;
1634
+ set grantedTo(value) {
1635
+ this.data.grantedTo = value;
1677
1636
  }
1678
- set cameraAnimation(value) {
1679
- this._data.cameraAnimation = value;
1680
- this.notifierChangeEvent();
1637
+ /**
1638
+ * Specifies whether all users have access to the file or not.
1639
+ */
1640
+ get public() {
1641
+ return this.data.public;
1681
1642
  }
1682
- get antialiasing() {
1683
- return this._data.antialiasing;
1643
+ set public(value) {
1644
+ this.data.public = value;
1684
1645
  }
1685
- set antialiasing(value) {
1686
- this._data.antialiasing = value;
1687
- this.notifierChangeEvent();
1646
+ /**
1647
+ * Refresh permission data.
1648
+ *
1649
+ * @async
1650
+ */
1651
+ async checkout() {
1652
+ this.data = await json(this.internalGet());
1653
+ return this;
1688
1654
  }
1689
- get groundShadow() {
1690
- return this._data.groundShadow;
1655
+ /**
1656
+ * Update permission data on the server.
1657
+ *
1658
+ * @async
1659
+ * @param data - Raw permission data.
1660
+ */
1661
+ async update(data) {
1662
+ this.data = await json(this.internalPut(data));
1663
+ return this;
1691
1664
  }
1692
- set groundShadow(value) {
1693
- this._data.groundShadow = value;
1694
- this.notifierChangeEvent();
1665
+ /**
1666
+ * Remove a permission from a file.
1667
+ *
1668
+ * @async
1669
+ * @returns Returns the raw data of a deleted permission.
1670
+ */
1671
+ delete() {
1672
+ return json(this.internalDelete());
1695
1673
  }
1696
- get shadows() {
1697
- return this._data.shadows;
1674
+ /**
1675
+ * Save permission data changes to the server. Call this method to update permission data on
1676
+ * the server after any changes.
1677
+ *
1678
+ * @async
1679
+ */
1680
+ save() {
1681
+ return this.update(this.data);
1698
1682
  }
1699
- set shadows(value) {
1700
- this._data.shadows = value;
1701
- this.notifierChangeEvent();
1683
+ }
1684
+
1685
+ ///////////////////////////////////////////////////////////////////////////////
1686
+ /**
1687
+ * The class representing a `job` entity describes the process of converting a file from one
1688
+ * format to another, to obtain geometric data, validate the file, or run a clash test.
1689
+ */
1690
+ class Job {
1691
+ /**
1692
+ * @param data - An object that implements job data storage.
1693
+ * @param httpClient - Http client.
1694
+ */
1695
+ constructor(data, httpClient) {
1696
+ this.httpClient = httpClient;
1697
+ this.data = data;
1702
1698
  }
1703
- get cameraAxisXSpeed() {
1704
- return this._data.cameraAxisXSpeed;
1699
+ internalGet() {
1700
+ return this.httpClient.get(`/jobs/${this.data.id}`);
1705
1701
  }
1706
- set cameraAxisXSpeed(value) {
1707
- this._data.cameraAxisXSpeed = value;
1708
- this.notifierChangeEvent();
1702
+ internalPut(body) {
1703
+ return this.httpClient.put(`/jobs/${this.data.id}`, body);
1709
1704
  }
1710
- get cameraAxisYSpeed() {
1711
- return this._data.cameraAxisYSpeed;
1705
+ internalDelete() {
1706
+ return this.httpClient.delete(`/jobs/${this.data.id}`);
1712
1707
  }
1713
- set cameraAxisYSpeed(value) {
1714
- this.cameraAxisYSpeed = value;
1715
- this.notifierChangeEvent();
1716
- }
1717
- get ambientOcclusion() {
1718
- return this._data.ambientOcclusion;
1719
- }
1720
- set ambientOcclusion(value) {
1721
- this._data.ambientOcclusion = value;
1722
- this.notifierChangeEvent();
1723
- }
1724
- get enableStreamingMode() {
1725
- return this._data.enableStreamingMode;
1726
- }
1727
- set enableStreamingMode(value) {
1728
- this._data.enableStreamingMode = value;
1729
- if (this._data.enableStreamingMode) {
1730
- this._data.enablePartialMode = false;
1731
- }
1732
- this.notifierChangeEvent();
1733
- }
1734
- get enablePartialMode() {
1735
- return this._data.enablePartialMode;
1736
- }
1737
- set enablePartialMode(value) {
1738
- this._data.enablePartialMode = value;
1739
- if (value)
1740
- this._data.sceneGraph = false;
1741
- this.notifierChangeEvent();
1742
- }
1743
- get memoryLimit() {
1744
- return this._data.memoryLimit;
1745
- }
1746
- set memoryLimit(value) {
1747
- this._data.memoryLimit = value;
1748
- this.notifierChangeEvent();
1749
- }
1750
- get cuttingPlaneFillColor() {
1751
- return this._data.cuttingPlaneFillColor;
1752
- }
1753
- set cuttingPlaneFillColor(value) {
1754
- this._data.cuttingPlaneFillColor = value;
1755
- this.notifierChangeEvent();
1756
- }
1757
- get edgesColor() {
1758
- return this._data.edgesColor;
1759
- }
1760
- set edgesColor(value) {
1761
- this._data.edgesColor = value;
1762
- this.notifierChangeEvent();
1763
- }
1764
- get facesColor() {
1765
- return this._data.facesColor;
1766
- }
1767
- set facesColor(value) {
1768
- this._data.facesColor = value;
1769
- this.notifierChangeEvent();
1770
- }
1771
- get edgesVisibility() {
1772
- return this._data.edgesVisibility;
1773
- }
1774
- set edgesVisibility(value) {
1775
- this._data.edgesVisibility = value;
1776
- this.notifierChangeEvent();
1777
- }
1778
- get edgesOverlap() {
1779
- return this._data.edgesOverlap;
1780
- }
1781
- set edgesOverlap(value) {
1782
- this._data.edgesOverlap = value;
1783
- this.notifierChangeEvent();
1784
- }
1785
- get facesOverlap() {
1786
- return this._data.facesOverlap;
1787
- }
1788
- set facesOverlap(value) {
1789
- this._data.facesOverlap = value;
1790
- this.notifierChangeEvent();
1791
- }
1792
- get facesTransparancy() {
1793
- return this._data.facesTransparancy;
1794
- }
1795
- set facesTransparancy(value) {
1796
- this._data.facesTransparancy = value;
1797
- this.notifierChangeEvent();
1798
- }
1799
- get enableCustomHighlight() {
1800
- return this._data.enableCustomHighlight;
1801
- }
1802
- set enableCustomHighlight(value) {
1803
- this._data.enableCustomHighlight = value;
1804
- this.notifierChangeEvent();
1805
- }
1806
- get sceneGraph() {
1807
- return this._data.sceneGraph;
1808
- }
1809
- set sceneGraph(value) {
1810
- this._data.sceneGraph = value;
1811
- if (value)
1812
- this._data.enablePartialMode = false;
1813
- this.notifierChangeEvent();
1814
- }
1815
- get edgeModel() {
1816
- return Boolean(this._data.edgeModel);
1817
- }
1818
- set edgeModel(value) {
1819
- this._data.edgeModel = Boolean(value);
1820
- this.notifierChangeEvent();
1821
- }
1822
- get reverseZoomWheel() {
1823
- return this._data.reverseZoomWheel;
1824
- }
1825
- set reverseZoomWheel(value) {
1826
- this._data.reverseZoomWheel = !!value;
1827
- this.notifierChangeEvent();
1828
- }
1829
- get enableZoomWheel() {
1830
- return this._data.enableZoomWheel;
1831
- }
1832
- set enableZoomWheel(value) {
1833
- this._data.enableZoomWheel = !!value;
1834
- this.notifierChangeEvent();
1835
- }
1836
- get enableGestures() {
1837
- return this._data.enableGestures;
1838
- }
1839
- set enableGestures(value) {
1840
- this._data.enableGestures = !!value;
1841
- this.notifierChangeEvent();
1842
- }
1843
- get geometryType() {
1844
- return this._data.geometryType;
1845
- }
1846
- set geometryType(value) {
1847
- this._data.geometryType = value;
1848
- this.notifierChangeEvent();
1849
- }
1850
- }
1851
-
1852
- ///////////////////////////////////////////////////////////////////////////////
1853
- /**
1854
- * A permission provides information about {@link File | file} sharing granted to a specific
1855
- * {@link User | users}, group, or project {@link Member | member}.
1856
- */
1857
- class Permission {
1858
1708
  /**
1859
- * @param data - An object that implements permission data storage.
1860
- * @param fileId - Owner file ID.
1861
- * @param httpClient - Http client.
1709
+ * The ID of the assembly the job is working on (internal).
1710
+ *
1711
+ * @readonly
1862
1712
  */
1863
- constructor(data, fileId, httpClient) {
1864
- this.httpClient = httpClient;
1865
- this.fileId = fileId;
1866
- this.data = data;
1867
- }
1868
- internalGet() {
1869
- return this.httpClient.get(`/files/${this.fileId}/permissions/${this.id}`);
1870
- }
1871
- internalPut(body) {
1872
- return this.httpClient.put(`/files/${this.fileId}/permissions/${this.id}`, body);
1873
- }
1874
- internalDelete() {
1875
- return this.httpClient.delete(`/files/${this.fileId}/permissions/${this.id}`);
1713
+ get assemblyId() {
1714
+ return this.data.assemblyId;
1876
1715
  }
1877
1716
  /**
1878
- * Defines what actions are allowed to be performed on a file with this permission:
1717
+ * Job creator ID. Use {@link Client#getUser | Client.getUser()} to obtain detailed creator information.
1879
1718
  *
1880
- * - `read` - The ability to read file description, geometry data and properties
1881
- * - `readSourceFile` - The ability to read source file
1882
- * - `write` - The ability to modify file name, description and references
1883
- * - `readViewpoint` - The ability to read file viewpoints
1884
- * - `createViewpoint` - The ability to create file viewpoints
1719
+ * @readonly
1885
1720
  */
1886
- get actions() {
1887
- return this.data.actions;
1721
+ get authorId() {
1722
+ return this.data.authorId;
1888
1723
  }
1889
- set actions(value) {
1890
- this._data.actions = value;
1724
+ /**
1725
+ * Job creation time (UTC) in the format specified in <a
1726
+ * href="https://www.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601</a>.
1727
+ *
1728
+ * @readonly
1729
+ */
1730
+ get createdAt() {
1731
+ return this.data.createdAt;
1891
1732
  }
1892
1733
  /**
1893
- * Raw permission data received from the server.
1734
+ * Raw job data received from the server.
1894
1735
  *
1895
1736
  * @readonly
1896
1737
  */
@@ -1901,190 +1742,54 @@
1901
1742
  this._data = value;
1902
1743
  }
1903
1744
  /**
1904
- * Unique permission ID.
1745
+ * `true` if job is `done` or `failed`. See {@link Job#status | status} for more details.
1905
1746
  *
1906
1747
  * @readonly
1907
1748
  */
1908
- get id() {
1909
- return this.data.id;
1749
+ get done() {
1750
+ return this.data.status === "done" || this.data.status === "failed";
1910
1751
  }
1911
1752
  /**
1912
- * Principials are any entity that can be authenticated by the server, such as a any user or
1913
- * project that will get access to the file.
1753
+ * The ID of the file the job is working on.
1914
1754
  *
1915
- * @typedef {any} Principial
1916
- * @property {any} user - The user entry that get access to the file.
1917
- * @property {string} user.id - User ID.
1918
- * @property {string} user.name - User name.
1919
- * @property {any} project - The project entry that get access to the file.
1920
- * @property {string} project.id - Project ID.
1921
- * @property {string} project.name - Project name.
1922
- */
1923
- /**
1924
- * A collection of principials that will get access to the file.
1755
+ * @readonly
1925
1756
  */
1926
- get grantedTo() {
1927
- return this.data.grantedTo;
1928
- }
1929
- set grantedTo(value) {
1930
- this.data.grantedTo = value;
1757
+ get fileId() {
1758
+ return this.data.fileId;
1931
1759
  }
1932
1760
  /**
1933
- * Specifies whether all users have access to the file or not.
1761
+ * Unique job ID.
1762
+ *
1763
+ * @readonly
1934
1764
  */
1935
- get public() {
1936
- return this.data.public;
1937
- }
1938
- set public(value) {
1939
- this.data.public = value;
1765
+ get id() {
1766
+ return this.data.id;
1940
1767
  }
1941
1768
  /**
1942
- * Refresh permission data.
1769
+ * Job last update (UTC) time in the format specified in <a
1770
+ * href="https://www.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601</a>.
1943
1771
  *
1944
- * @async
1772
+ * @readonly
1945
1773
  */
1946
- async checkout() {
1947
- this.data = await json(this.internalGet());
1948
- return this;
1774
+ get lastUpdate() {
1775
+ return this.data.lastUpdate;
1949
1776
  }
1950
1777
  /**
1951
- * Update permission data on the server.
1778
+ * Job type. Can be `properties`, `geomerty`, `geomertyGltf`, `validation`, `clash`, `dwg`,
1779
+ * `obj`, `gltf`, `glb`, `vsf`, `pdf` or `3dpdf`.
1952
1780
  *
1953
- * @async
1954
- * @param data - Raw permission data.
1781
+ * @readonly
1955
1782
  */
1956
- async update(data) {
1957
- this.data = await json(this.internalPut(data));
1958
- return this;
1783
+ get outputFormat() {
1784
+ return this.data.outputFormat;
1959
1785
  }
1960
1786
  /**
1961
- * Remove a permission from a file.
1787
+ * Parameters for the job runner.
1962
1788
  *
1963
- * @async
1964
- * @returns Returns the raw data of a deleted permission.
1789
+ * @readonly
1965
1790
  */
1966
- delete() {
1967
- return json(this.internalDelete());
1968
- }
1969
- /**
1970
- * Save permission data changes to the server. Call this method to update permission data on
1971
- * the server after any changes.
1972
- *
1973
- * @async
1974
- */
1975
- save() {
1976
- return this.update(this.data);
1977
- }
1978
- }
1979
-
1980
- ///////////////////////////////////////////////////////////////////////////////
1981
- /**
1982
- * The class representing a `job` entity describes the process of converting a file from one
1983
- * format to another, to obtain geometric data, validate the file, or run a clash test.
1984
- */
1985
- class Job {
1986
- /**
1987
- * @param data - An object that implements job data storage.
1988
- * @param httpClient - Http client.
1989
- */
1990
- constructor(data, httpClient) {
1991
- this.httpClient = httpClient;
1992
- this.data = data;
1993
- }
1994
- internalGet() {
1995
- return this.httpClient.get(`/jobs/${this.data.id}`);
1996
- }
1997
- internalPut(body) {
1998
- return this.httpClient.put(`/jobs/${this.data.id}`, body);
1999
- }
2000
- internalDelete() {
2001
- return this.httpClient.delete(`/jobs/${this.data.id}`);
2002
- }
2003
- /**
2004
- * The ID of the assembly the job is working on (internal).
2005
- *
2006
- * @readonly
2007
- */
2008
- get assemblyId() {
2009
- return this.data.assemblyId;
2010
- }
2011
- /**
2012
- * Job creator ID. Use {@link Client#getUser | Client.getUser()} to obtain detailed creator information.
2013
- *
2014
- * @readonly
2015
- */
2016
- get authorId() {
2017
- return this.data.authorId;
2018
- }
2019
- /**
2020
- * Job creation time (UTC) in the format specified in <a
2021
- * href="https://www.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601</a>.
2022
- *
2023
- * @readonly
2024
- */
2025
- get createdAt() {
2026
- return this.data.createdAt;
2027
- }
2028
- /**
2029
- * Raw job data received from the server.
2030
- *
2031
- * @readonly
2032
- */
2033
- get data() {
2034
- return this._data;
2035
- }
2036
- set data(value) {
2037
- this._data = value;
2038
- }
2039
- /**
2040
- * `true` if job is `done` or `failed`. See {@link Job#status | status} for more details.
2041
- *
2042
- * @readonly
2043
- */
2044
- get done() {
2045
- return this.data.status === "done" || this.data.status === "failed";
2046
- }
2047
- /**
2048
- * The ID of the file the job is working on.
2049
- *
2050
- * @readonly
2051
- */
2052
- get fileId() {
2053
- return this.data.fileId;
2054
- }
2055
- /**
2056
- * Unique job ID.
2057
- *
2058
- * @readonly
2059
- */
2060
- get id() {
2061
- return this.data.id;
2062
- }
2063
- /**
2064
- * Job last update (UTC) time in the format specified in <a
2065
- * href="https://www.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601</a>.
2066
- *
2067
- * @readonly
2068
- */
2069
- get lastUpdate() {
2070
- return this.data.lastUpdate;
2071
- }
2072
- /**
2073
- * Job type. Can be `properties`, `geomerty`, `geomertyGltf`, `validation`, `clash`, `dwg`,
2074
- * `obj`, `gltf`, `glb`, `vsf`, `pdf` or `3dpdf`.
2075
- *
2076
- * @readonly
2077
- */
2078
- get outputFormat() {
2079
- return this.data.outputFormat;
2080
- }
2081
- /**
2082
- * Parameters for the job runner.
2083
- *
2084
- * @readonly
2085
- */
2086
- get parameters() {
2087
- return this.data.parameters;
1791
+ get parameters() {
1792
+ return this.data.parameters;
2088
1793
  }
2089
1794
  /**
2090
1795
  * Job status. Can be `waiting`, `inprogress`, `done` or `failed`.
@@ -3875,7 +3580,6 @@
3875
3580
  super();
3876
3581
  this.configure(params);
3877
3582
  this.eventEmitter = this;
3878
- this._options = new Options(this);
3879
3583
  this._user = null;
3880
3584
  }
3881
3585
  /**
@@ -3887,11 +3591,45 @@
3887
3591
  return this._serverUrl;
3888
3592
  }
3889
3593
  /**
3890
- * `VisualizeJS` parameters. Changes to these parameters are automatically applied to
3891
- * `Viewer` instances associated with that client.
3594
+ * Deprecated since `25.3`. Use [Viewer.options]{@link Viewer#options} instead to change
3595
+ * Viewer parameters.
3892
3596
  */
3893
3597
  get options() {
3894
- return this._options;
3598
+ console.warn("Client.options has been deprecated since 25.3 and will be removed in a future release, use Viewer.options instead.");
3599
+ const data = {
3600
+ showWCS: true,
3601
+ cameraAnimation: true,
3602
+ antialiasing: true,
3603
+ groundShadow: false,
3604
+ shadows: false,
3605
+ cameraAxisXSpeed: 4,
3606
+ cameraAxisYSpeed: 1,
3607
+ ambientOcclusion: false,
3608
+ enableStreamingMode: true,
3609
+ enablePartialMode: false,
3610
+ memoryLimit: 3294967296,
3611
+ cuttingPlaneFillColor: { red: 0xff, green: 0x98, blue: 0x00 },
3612
+ edgesColor: { r: 0xff, g: 0x98, b: 0x00 },
3613
+ facesColor: { r: 0xff, g: 0x98, b: 0x00 },
3614
+ edgesVisibility: true,
3615
+ edgesOverlap: true,
3616
+ facesOverlap: false,
3617
+ facesTransparancy: 200,
3618
+ enableCustomHighlight: true,
3619
+ sceneGraph: false,
3620
+ edgeModel: true,
3621
+ reverseZoomWheel: false,
3622
+ enableZoomWheel: true,
3623
+ enableGestures: true,
3624
+ };
3625
+ return {
3626
+ ...data,
3627
+ data,
3628
+ defaults: () => data,
3629
+ resetToDefaults: () => { },
3630
+ saveToStorage: () => { },
3631
+ loadFromStorage: () => { },
3632
+ };
3895
3633
  }
3896
3634
  /**
3897
3635
  * Change the client configuration parameters.
@@ -3925,7 +3663,7 @@
3925
3663
  .then((data) => ({
3926
3664
  ...data,
3927
3665
  server: data.version,
3928
- client: "25.3.9",
3666
+ client: "25.3.10",
3929
3667
  }));
3930
3668
  }
3931
3669
  /**
@@ -4187,7 +3925,7 @@
4187
3925
  * @param params - An object containing upload parameters.
4188
3926
  * @param params.geometry=true - Create job to extract file geometry data. Can be:
4189
3927
  *
4190
- * - `true` - Extract file geometry data into type, defined by [options]{@link Client#options}.
3928
+ * - `true` - Extract file geometry data into `VSFX` to open the file in `VisualizeJS` viewer.
4191
3929
  * - `vsfx` - Extract file geometry data into `VSFX` to open the file in `VisualizeJS` viewer.
4192
3930
  * - `gltf` - Extract file geometry data into `glTF` to open the file in `Three.js` viewer.
4193
3931
  *
@@ -4215,7 +3953,7 @@
4215
3953
  })
4216
3954
  .then((xhr) => JSON.parse(xhr.responseText))
4217
3955
  .then((data) => new File$1(data, this._httpClient));
4218
- const geometryType = typeof params.geometry === "string" ? params.geometry : this.options.geometryType;
3956
+ const geometryType = typeof params.geometry === "string" ? params.geometry : "vsfx";
4219
3957
  const jobs = [];
4220
3958
  if (params.geometry)
4221
3959
  jobs.push((await result.extractGeometry(geometryType)).outputFormat);
@@ -4685,223 +4423,518 @@
4685
4423
  toGePoint(point) {
4686
4424
  return [point.x, point.y, point.z];
4687
4425
  }
4688
- toPoint(gePoint) {
4689
- return this.m_module.Point3d.createFromArray(gePoint);
4426
+ toPoint(gePoint) {
4427
+ return this.m_module.Point3d.createFromArray(gePoint);
4428
+ }
4429
+ screenToWorld(x, y) {
4430
+ return this.toPoint(this.m_module.getViewer().screenToWorld(x, y));
4431
+ }
4432
+ toDoubleArray(points) {
4433
+ const p = [];
4434
+ for (let i = 0; i < points.length; i++) {
4435
+ p.push(points[i].x);
4436
+ p.push(points[i].y);
4437
+ p.push(points[i].z);
4438
+ }
4439
+ return p;
4440
+ }
4441
+ correctCameraTarget() {
4442
+ const params = this.getViewParams();
4443
+ const ext = this.m_module.getViewer().getActiveExtents();
4444
+ const { min, max } = ext;
4445
+ const target = this.toPoint(params.target);
4446
+ const contains = target.x >= min.x &&
4447
+ target.y >= min.y &&
4448
+ target.z >= min.z &&
4449
+ target.x <= max.x &&
4450
+ target.y <= max.y &&
4451
+ target.z <= max.z;
4452
+ if (!contains) {
4453
+ params.target = ext.center();
4454
+ this.setViewParams(params);
4455
+ }
4456
+ }
4457
+ }
4458
+
4459
+ ///////////////////////////////////////////////////////////////////////////////
4460
+ const CLICK_DELTA = 5;
4461
+ const INTERACTIVITY_FPS = 24;
4462
+ /**
4463
+ * A [Viewer]{@link Viewer} event that fires when the viewer needs to be updated.
4464
+ *
4465
+ * @property {string} type - `update`
4466
+ * @event update
4467
+ */
4468
+ /**
4469
+ * A [Viewer]{@link Viewer} event that fires when the user selects an entity with the mouse.
4470
+ *
4471
+ * @property {string} type - `select`
4472
+ * @property {OdTvSelectionSet} data - The set of selected entities. For more information, see
4473
+ * [OdTvSelectionSet](https://cloud.opendesign.com/docs/index.html#/vis/OdTvSelectionSet?id=odtvselectionset).
4474
+ * @event select
4475
+ */
4476
+ class OdBaseDragger extends OdaGeAction {
4477
+ constructor(subject) {
4478
+ super(subject.visualizeJs);
4479
+ this.beginInteractivity = () => {
4480
+ const viewer = this.getViewer();
4481
+ const view = viewer.activeView;
4482
+ if (view["beginInteractivity"]) {
4483
+ view.beginInteractivity(INTERACTIVITY_FPS);
4484
+ this.subject.update();
4485
+ }
4486
+ view.delete();
4487
+ };
4488
+ this.endInteractivity = () => {
4489
+ const viewer = this.getViewer();
4490
+ const view = viewer.activeView;
4491
+ if (view["endInteractivity"]) {
4492
+ view.endInteractivity();
4493
+ const device = this.getViewer().getActiveDevice();
4494
+ const canvas = this.m_module.canvas;
4495
+ device.invalidate([0, 0, canvas.width, canvas.height]);
4496
+ device.delete();
4497
+ this.subject.update();
4498
+ }
4499
+ view.delete();
4500
+ };
4501
+ this.subject = subject;
4502
+ this.needInputText = false;
4503
+ this.mouseDownPosition = { x: 0, y: 0 };
4504
+ this.autoSelect = false;
4505
+ this.onmessage = (event) => this.subject.emitEvent(event);
4506
+ this.canvasEvents = CANVAS_EVENTS;
4507
+ }
4508
+ initialize() {
4509
+ this.canvasEvents = this.canvasEvents.filter((x) => typeof this[x] === "function");
4510
+ this.canvasEvents.forEach((x) => (this[x] = this[x].bind(this)));
4511
+ this.canvasEvents.forEach((x) => this.subject.on(x, this[x]));
4512
+ this.getViewer().setEnableAutoSelect(!!this.autoSelect);
4513
+ }
4514
+ dispose() {
4515
+ this.canvasEvents.forEach((x) => this.subject.off(x, this[x]));
4516
+ }
4517
+ relativeCoords(event) {
4518
+ return { x: event.offsetX * window.devicePixelRatio, y: event.offsetY * window.devicePixelRatio };
4519
+ }
4520
+ pointerdown(ev) {
4521
+ if (!ev.isPrimary || OdBaseDragger.isGestureActive) {
4522
+ return;
4523
+ }
4524
+ ev.target.setPointerCapture(ev.pointerId);
4525
+ const relCoord = this.relativeCoords(ev);
4526
+ this.isDragging = true;
4527
+ this.mouseDownPosition = { x: relCoord.x, y: relCoord.y };
4528
+ this.start(relCoord.x, relCoord.y, ev.clientX, ev.clientY);
4529
+ this.subject.update();
4530
+ }
4531
+ pointerup(ev) {
4532
+ if (OdBaseDragger.needSkipPointerUp) {
4533
+ return;
4534
+ }
4535
+ if (!ev.isPrimary) {
4536
+ return;
4537
+ }
4538
+ ev.target.releasePointerCapture(ev.pointerId);
4539
+ const relCoord = this.relativeCoords(ev);
4540
+ this.end(relCoord.x, relCoord.y);
4541
+ this.isDragging = false;
4542
+ this.subject.update();
4543
+ }
4544
+ pointercancel(ev) {
4545
+ if (!ev.isPrimary) {
4546
+ return;
4547
+ }
4548
+ this.m_module.canvas.dispatchEvent(new PointerEvent("pointerup", ev));
4549
+ }
4550
+ pointermove(ev) {
4551
+ if (!ev.isPrimary || OdBaseDragger.isGestureActive) {
4552
+ return;
4553
+ }
4554
+ const relCoord = this.relativeCoords(ev);
4555
+ this.drag(relCoord.x, relCoord.y, ev.movementX, ev.movementY);
4556
+ if (this.isDragging) {
4557
+ this.subject.update();
4558
+ }
4559
+ }
4560
+ click(ev) {
4561
+ const viewer = this.getViewer();
4562
+ const relCoord = this.relativeCoords(ev);
4563
+ const x = relCoord.x;
4564
+ const y = relCoord.y;
4565
+ const isNotDragging = Math.abs(x - this.mouseDownPosition.x) < CLICK_DELTA && Math.abs(y - this.mouseDownPosition.y) < CLICK_DELTA;
4566
+ if (viewer && viewer.getEnableAutoSelect() && isNotDragging) {
4567
+ viewer.unselect();
4568
+ viewer.select(x, y, x, y);
4569
+ this.subject.update();
4570
+ const selectionSet = viewer.getSelected();
4571
+ const handles = this.subject.getSelected();
4572
+ this.onmessage({ type: "select", data: selectionSet, handles });
4573
+ }
4574
+ }
4575
+ dblclick(ev) {
4576
+ const viewer = this.getViewer();
4577
+ const relCoord = this.relativeCoords(ev);
4578
+ const x = relCoord.x;
4579
+ const y = relCoord.y;
4580
+ const device = viewer.getActiveDevice();
4581
+ const clickView = device.viewAt([x, y]);
4582
+ if (clickView && !clickView.active) {
4583
+ viewer.activeView = clickView;
4584
+ clickView.delete();
4585
+ this.subject.update();
4586
+ }
4587
+ else {
4588
+ if (viewer && viewer.getEnableAutoSelect()) {
4589
+ const pSelected = viewer.getSelected();
4590
+ if (!pSelected.isNull() && pSelected.numItems() !== 0) {
4591
+ const itr = pSelected.getIterator();
4592
+ const entity = itr.getEntity();
4593
+ viewer.zoomToEntity(entity);
4594
+ this.onmessage({ type: "zoomtoentity", data: entity });
4595
+ this.subject.update();
4596
+ this.deleteAll([itr, entity]);
4597
+ }
4598
+ }
4599
+ }
4600
+ device.delete();
4601
+ }
4602
+ start(x, y, absoluteX = 0, absoluteY = 0) { }
4603
+ drag(x, y, absoluteX = 0, absoluteY = 0) { }
4604
+ end(x, y) { }
4605
+ getActiveMarkupEntity(entityName) {
4606
+ return this.subject.addMarkupEntity(entityName);
4607
+ }
4608
+ syncOverlayView() {
4609
+ return this.subject.syncOverlay();
4610
+ }
4611
+ deleteAll(objects) {
4612
+ var _a;
4613
+ for (const obj of objects) {
4614
+ (_a = obj === null || obj === void 0 ? void 0 : obj.delete) === null || _a === void 0 ? void 0 : _a.call(obj);
4615
+ }
4616
+ }
4617
+ updatePreview() { }
4618
+ static set isGestureActive(value) {
4619
+ if (OdBaseDragger._isGestureActive === value) {
4620
+ return;
4621
+ }
4622
+ OdBaseDragger._isGestureActive = value;
4623
+ if (OdBaseDragger._isGestureActive) {
4624
+ OdBaseDragger.needSkipPointerUp = true;
4625
+ }
4626
+ }
4627
+ static get isGestureActive() {
4628
+ return OdBaseDragger._isGestureActive;
4629
+ }
4630
+ static get needSkipPointerUp() {
4631
+ if (OdBaseDragger._needSkipPointerUp) {
4632
+ OdBaseDragger.needSkipPointerUp = false;
4633
+ return true;
4634
+ }
4635
+ return false;
4636
+ }
4637
+ static set needSkipPointerUp(value) {
4638
+ OdBaseDragger._needSkipPointerUp = value;
4639
+ }
4640
+ }
4641
+ OdBaseDragger._isGestureActive = false;
4642
+ OdBaseDragger._needSkipPointerUp = false;
4643
+
4644
+ ///////////////////////////////////////////////////////////////////////////////
4645
+ // Copyright (C) 2002-2021, Open Design Alliance (the "Alliance").
4646
+ // All rights reserved.
4647
+ //
4648
+ // This software and its documentation and related materials are owned by
4649
+ // the Alliance. The software may only be incorporated into application
4650
+ // programs owned by members of the Alliance, subject to a signed
4651
+ // Membership Agreement and Supplemental Software License Agreement with the
4652
+ // Alliance. The structure and organization of this software are the valuable
4653
+ // trade secrets of the Alliance and its suppliers. The software is also
4654
+ // protected by copyright law and international treaty provisions. Application
4655
+ // programs incorporating this software must include the following statement
4656
+ // with their copyright notices:
4657
+ //
4658
+ // This application incorporates Open Design Alliance software pursuant to a
4659
+ // license agreement with Open Design Alliance.
4660
+ // Open Design Alliance Copyright (C) 2002-2021 by Open Design Alliance.
4661
+ // All rights reserved.
4662
+ //
4663
+ // By use of this software, its documentation or related materials, you
4664
+ // acknowledge and accept the above terms.
4665
+ ///////////////////////////////////////////////////////////////////////////////
4666
+ class Options {
4667
+ constructor(emitter) {
4668
+ this._emitter = emitter;
4669
+ this._data = Options.defaults();
4670
+ this.loadFromStorage();
4671
+ }
4672
+ static defaults() {
4673
+ return {
4674
+ showWCS: true,
4675
+ cameraAnimation: true,
4676
+ antialiasing: true,
4677
+ groundShadow: false,
4678
+ shadows: false,
4679
+ cameraAxisXSpeed: 4,
4680
+ cameraAxisYSpeed: 1,
4681
+ ambientOcclusion: false,
4682
+ enableStreamingMode: true,
4683
+ enablePartialMode: false,
4684
+ memoryLimit: 3294967296,
4685
+ cuttingPlaneFillColor: { red: 0xff, green: 0x98, blue: 0x00 },
4686
+ edgesColor: { r: 0xff, g: 0x98, b: 0x00 },
4687
+ facesColor: { r: 0xff, g: 0x98, b: 0x00 },
4688
+ edgesVisibility: true,
4689
+ edgesOverlap: true,
4690
+ facesOverlap: false,
4691
+ facesTransparancy: 200,
4692
+ enableCustomHighlight: true,
4693
+ sceneGraph: false,
4694
+ edgeModel: true,
4695
+ reverseZoomWheel: false,
4696
+ enableZoomWheel: true,
4697
+ enableGestures: true,
4698
+ geometryType: "vsfx",
4699
+ };
4700
+ }
4701
+ notifierChangeEvent() {
4702
+ if (this._emitter !== undefined) {
4703
+ this.saveToStorage();
4704
+ this._emitter.emit({ type: "optionschange", data: this });
4705
+ }
4706
+ }
4707
+ saveToStorage() {
4708
+ if (typeof window !== "undefined")
4709
+ try {
4710
+ localStorage.setItem("od-client-settings", JSON.stringify(this.data));
4711
+ }
4712
+ catch (error) {
4713
+ console.error("Cannot save client settings.", error);
4714
+ }
4715
+ }
4716
+ loadFromStorage() {
4717
+ if (typeof window !== "undefined")
4718
+ try {
4719
+ const item = localStorage.getItem("od-client-settings");
4720
+ if (item) {
4721
+ const data = JSON.parse(item);
4722
+ this.data = { ...data };
4723
+ }
4724
+ }
4725
+ catch (error) {
4726
+ console.error("Cannot load client settings.", error);
4727
+ }
4728
+ }
4729
+ /**
4730
+ * Reset options to default
4731
+ *
4732
+ * @param fields - Name of fields to be reset
4733
+ */
4734
+ resetToDefaults(fields) {
4735
+ if (fields !== undefined) {
4736
+ const defaults = Options.defaults();
4737
+ const resetData = fields.reduce((acc, field) => {
4738
+ acc[field] = defaults[field];
4739
+ return acc;
4740
+ }, {});
4741
+ this.data = { ...this.data, ...resetData };
4742
+ }
4743
+ else {
4744
+ this.data = { ...this.data, ...Options.defaults() };
4745
+ }
4746
+ }
4747
+ get data() {
4748
+ return this._data;
4749
+ }
4750
+ set data(value) {
4751
+ const sceneGraph = value.enablePartialMode ? false : value.sceneGraph;
4752
+ this._data = { ...Options.defaults(), ...this._data, ...value, sceneGraph };
4753
+ this.notifierChangeEvent();
4754
+ }
4755
+ get showWCS() {
4756
+ return this._data.showWCS;
4757
+ }
4758
+ set showWCS(value) {
4759
+ this._data.showWCS = value;
4760
+ this.notifierChangeEvent();
4761
+ }
4762
+ get cameraAnimation() {
4763
+ return this._data.cameraAnimation;
4764
+ }
4765
+ set cameraAnimation(value) {
4766
+ this._data.cameraAnimation = value;
4767
+ this.notifierChangeEvent();
4768
+ }
4769
+ get antialiasing() {
4770
+ return this._data.antialiasing;
4771
+ }
4772
+ set antialiasing(value) {
4773
+ this._data.antialiasing = value;
4774
+ this.notifierChangeEvent();
4775
+ }
4776
+ get groundShadow() {
4777
+ return this._data.groundShadow;
4778
+ }
4779
+ set groundShadow(value) {
4780
+ this._data.groundShadow = value;
4781
+ this.notifierChangeEvent();
4782
+ }
4783
+ get shadows() {
4784
+ return this._data.shadows;
4785
+ }
4786
+ set shadows(value) {
4787
+ this._data.shadows = value;
4788
+ this.notifierChangeEvent();
4789
+ }
4790
+ get cameraAxisXSpeed() {
4791
+ return this._data.cameraAxisXSpeed;
4792
+ }
4793
+ set cameraAxisXSpeed(value) {
4794
+ this._data.cameraAxisXSpeed = value;
4795
+ this.notifierChangeEvent();
4796
+ }
4797
+ get cameraAxisYSpeed() {
4798
+ return this._data.cameraAxisYSpeed;
4799
+ }
4800
+ set cameraAxisYSpeed(value) {
4801
+ this.cameraAxisYSpeed = value;
4802
+ this.notifierChangeEvent();
4803
+ }
4804
+ get ambientOcclusion() {
4805
+ return this._data.ambientOcclusion;
4806
+ }
4807
+ set ambientOcclusion(value) {
4808
+ this._data.ambientOcclusion = value;
4809
+ this.notifierChangeEvent();
4810
+ }
4811
+ get enableStreamingMode() {
4812
+ return this._data.enableStreamingMode;
4813
+ }
4814
+ set enableStreamingMode(value) {
4815
+ this._data.enableStreamingMode = value;
4816
+ if (this._data.enableStreamingMode) {
4817
+ this._data.enablePartialMode = false;
4818
+ }
4819
+ this.notifierChangeEvent();
4820
+ }
4821
+ get enablePartialMode() {
4822
+ return this._data.enablePartialMode;
4823
+ }
4824
+ set enablePartialMode(value) {
4825
+ this._data.enablePartialMode = value;
4826
+ if (value)
4827
+ this._data.sceneGraph = false;
4828
+ this.notifierChangeEvent();
4829
+ }
4830
+ get memoryLimit() {
4831
+ return this._data.memoryLimit;
4832
+ }
4833
+ set memoryLimit(value) {
4834
+ this._data.memoryLimit = value;
4835
+ this.notifierChangeEvent();
4836
+ }
4837
+ get cuttingPlaneFillColor() {
4838
+ return this._data.cuttingPlaneFillColor;
4839
+ }
4840
+ set cuttingPlaneFillColor(value) {
4841
+ this._data.cuttingPlaneFillColor = value;
4842
+ this.notifierChangeEvent();
4843
+ }
4844
+ get edgesColor() {
4845
+ return this._data.edgesColor;
4846
+ }
4847
+ set edgesColor(value) {
4848
+ this._data.edgesColor = value;
4849
+ this.notifierChangeEvent();
4850
+ }
4851
+ get facesColor() {
4852
+ return this._data.facesColor;
4853
+ }
4854
+ set facesColor(value) {
4855
+ this._data.facesColor = value;
4856
+ this.notifierChangeEvent();
4857
+ }
4858
+ get edgesVisibility() {
4859
+ return this._data.edgesVisibility;
4690
4860
  }
4691
- screenToWorld(x, y) {
4692
- return this.toPoint(this.m_module.getViewer().screenToWorld(x, y));
4861
+ set edgesVisibility(value) {
4862
+ this._data.edgesVisibility = value;
4863
+ this.notifierChangeEvent();
4693
4864
  }
4694
- toDoubleArray(points) {
4695
- const p = [];
4696
- for (let i = 0; i < points.length; i++) {
4697
- p.push(points[i].x);
4698
- p.push(points[i].y);
4699
- p.push(points[i].z);
4700
- }
4701
- return p;
4865
+ get edgesOverlap() {
4866
+ return this._data.edgesOverlap;
4702
4867
  }
4703
- correctCameraTarget() {
4704
- const params = this.getViewParams();
4705
- const ext = this.m_module.getViewer().getActiveExtents();
4706
- const { min, max } = ext;
4707
- const target = this.toPoint(params.target);
4708
- const contains = target.x >= min.x &&
4709
- target.y >= min.y &&
4710
- target.z >= min.z &&
4711
- target.x <= max.x &&
4712
- target.y <= max.y &&
4713
- target.z <= max.z;
4714
- if (!contains) {
4715
- params.target = ext.center();
4716
- this.setViewParams(params);
4717
- }
4868
+ set edgesOverlap(value) {
4869
+ this._data.edgesOverlap = value;
4870
+ this.notifierChangeEvent();
4718
4871
  }
4719
- }
4720
-
4721
- ///////////////////////////////////////////////////////////////////////////////
4722
- const CLICK_DELTA = 5;
4723
- const INTERACTIVITY_FPS = 24;
4724
- /**
4725
- * A [Viewer]{@link Viewer} event that fires when the viewer needs to be updated.
4726
- *
4727
- * @property {string} type - `update`
4728
- * @event update
4729
- */
4730
- /**
4731
- * A [Viewer]{@link Viewer} event that fires when the user selects an entity with the mouse.
4732
- *
4733
- * @property {string} type - `select`
4734
- * @property {OdTvSelectionSet} data - The set of selected entities. For more information, see
4735
- * [OdTvSelectionSet](https://cloud.opendesign.com/docs/index.html#/vis/OdTvSelectionSet?id=odtvselectionset).
4736
- * @event select
4737
- */
4738
- class OdBaseDragger extends OdaGeAction {
4739
- constructor(subject) {
4740
- super(subject.visualizeJs);
4741
- this.beginInteractivity = () => {
4742
- const viewer = this.getViewer();
4743
- const view = viewer.activeView;
4744
- if (view["beginInteractivity"]) {
4745
- view.beginInteractivity(INTERACTIVITY_FPS);
4746
- this.subject.update();
4747
- }
4748
- view.delete();
4749
- };
4750
- this.endInteractivity = () => {
4751
- const viewer = this.getViewer();
4752
- const view = viewer.activeView;
4753
- if (view["endInteractivity"]) {
4754
- view.endInteractivity();
4755
- const device = this.getViewer().getActiveDevice();
4756
- const canvas = this.m_module.canvas;
4757
- device.invalidate([0, 0, canvas.width, canvas.height]);
4758
- device.delete();
4759
- this.subject.update();
4760
- }
4761
- view.delete();
4762
- };
4763
- this.subject = subject;
4764
- this.needInputText = false;
4765
- this.mouseDownPosition = { x: 0, y: 0 };
4766
- this.autoSelect = false;
4767
- this.onmessage = (event) => this.subject.emitEvent(event);
4768
- this.canvasEvents = CANVAS_EVENTS;
4872
+ get facesOverlap() {
4873
+ return this._data.facesOverlap;
4769
4874
  }
4770
- initialize() {
4771
- this.canvasEvents = this.canvasEvents.filter((x) => typeof this[x] === "function");
4772
- this.canvasEvents.forEach((x) => (this[x] = this[x].bind(this)));
4773
- this.canvasEvents.forEach((x) => this.subject.on(x, this[x]));
4774
- this.getViewer().setEnableAutoSelect(!!this.autoSelect);
4875
+ set facesOverlap(value) {
4876
+ this._data.facesOverlap = value;
4877
+ this.notifierChangeEvent();
4775
4878
  }
4776
- dispose() {
4777
- this.canvasEvents.forEach((x) => this.subject.off(x, this[x]));
4879
+ get facesTransparancy() {
4880
+ return this._data.facesTransparancy;
4778
4881
  }
4779
- relativeCoords(event) {
4780
- return { x: event.offsetX * window.devicePixelRatio, y: event.offsetY * window.devicePixelRatio };
4882
+ set facesTransparancy(value) {
4883
+ this._data.facesTransparancy = value;
4884
+ this.notifierChangeEvent();
4781
4885
  }
4782
- pointerdown(ev) {
4783
- if (!ev.isPrimary || OdBaseDragger.isGestureActive) {
4784
- return;
4785
- }
4786
- ev.target.setPointerCapture(ev.pointerId);
4787
- const relCoord = this.relativeCoords(ev);
4788
- this.isDragging = true;
4789
- this.mouseDownPosition = { x: relCoord.x, y: relCoord.y };
4790
- this.start(relCoord.x, relCoord.y, ev.clientX, ev.clientY);
4791
- this.subject.update();
4886
+ get enableCustomHighlight() {
4887
+ return this._data.enableCustomHighlight;
4792
4888
  }
4793
- pointerup(ev) {
4794
- if (OdBaseDragger.needSkipPointerUp) {
4795
- return;
4796
- }
4797
- if (!ev.isPrimary) {
4798
- return;
4799
- }
4800
- ev.target.releasePointerCapture(ev.pointerId);
4801
- const relCoord = this.relativeCoords(ev);
4802
- this.end(relCoord.x, relCoord.y);
4803
- this.isDragging = false;
4804
- this.subject.update();
4889
+ set enableCustomHighlight(value) {
4890
+ this._data.enableCustomHighlight = value;
4891
+ this.notifierChangeEvent();
4805
4892
  }
4806
- pointercancel(ev) {
4807
- if (!ev.isPrimary) {
4808
- return;
4809
- }
4810
- this.m_module.canvas.dispatchEvent(new PointerEvent("pointerup", ev));
4893
+ get sceneGraph() {
4894
+ return this._data.sceneGraph;
4811
4895
  }
4812
- pointermove(ev) {
4813
- if (!ev.isPrimary || OdBaseDragger.isGestureActive) {
4814
- return;
4815
- }
4816
- const relCoord = this.relativeCoords(ev);
4817
- this.drag(relCoord.x, relCoord.y, ev.movementX, ev.movementY);
4818
- if (this.isDragging) {
4819
- this.subject.update();
4820
- }
4896
+ set sceneGraph(value) {
4897
+ this._data.sceneGraph = value;
4898
+ if (value)
4899
+ this._data.enablePartialMode = false;
4900
+ this.notifierChangeEvent();
4821
4901
  }
4822
- click(ev) {
4823
- const viewer = this.getViewer();
4824
- const relCoord = this.relativeCoords(ev);
4825
- const x = relCoord.x;
4826
- const y = relCoord.y;
4827
- const isNotDragging = Math.abs(x - this.mouseDownPosition.x) < CLICK_DELTA && Math.abs(y - this.mouseDownPosition.y) < CLICK_DELTA;
4828
- if (viewer && viewer.getEnableAutoSelect() && isNotDragging) {
4829
- viewer.unselect();
4830
- viewer.select(x, y, x, y);
4831
- this.subject.update();
4832
- const selectionSet = viewer.getSelected();
4833
- const handles = this.subject.getSelected();
4834
- this.onmessage({ type: "select", data: selectionSet, handles });
4835
- }
4902
+ get edgeModel() {
4903
+ return Boolean(this._data.edgeModel);
4836
4904
  }
4837
- dblclick(ev) {
4838
- const viewer = this.getViewer();
4839
- const relCoord = this.relativeCoords(ev);
4840
- const x = relCoord.x;
4841
- const y = relCoord.y;
4842
- const device = viewer.getActiveDevice();
4843
- const clickView = device.viewAt([x, y]);
4844
- if (clickView && !clickView.active) {
4845
- viewer.activeView = clickView;
4846
- clickView.delete();
4847
- this.subject.update();
4848
- }
4849
- else {
4850
- if (viewer && viewer.getEnableAutoSelect()) {
4851
- const pSelected = viewer.getSelected();
4852
- if (!pSelected.isNull() && pSelected.numItems() !== 0) {
4853
- const itr = pSelected.getIterator();
4854
- const entity = itr.getEntity();
4855
- viewer.zoomToEntity(entity);
4856
- this.onmessage({ type: "zoomtoentity", data: entity });
4857
- this.subject.update();
4858
- this.deleteAll([itr, entity]);
4859
- }
4860
- }
4861
- }
4862
- device.delete();
4905
+ set edgeModel(value) {
4906
+ this._data.edgeModel = Boolean(value);
4907
+ this.notifierChangeEvent();
4863
4908
  }
4864
- start(x, y, absoluteX = 0, absoluteY = 0) { }
4865
- drag(x, y, absoluteX = 0, absoluteY = 0) { }
4866
- end(x, y) { }
4867
- getActiveMarkupEntity(entityName) {
4868
- return this.subject.addMarkupEntity(entityName);
4909
+ get reverseZoomWheel() {
4910
+ return this._data.reverseZoomWheel;
4869
4911
  }
4870
- syncOverlayView() {
4871
- return this.subject.syncOverlay();
4912
+ set reverseZoomWheel(value) {
4913
+ this._data.reverseZoomWheel = !!value;
4914
+ this.notifierChangeEvent();
4872
4915
  }
4873
- deleteAll(objects) {
4874
- var _a;
4875
- for (const obj of objects) {
4876
- (_a = obj === null || obj === void 0 ? void 0 : obj.delete) === null || _a === void 0 ? void 0 : _a.call(obj);
4877
- }
4916
+ get enableZoomWheel() {
4917
+ return this._data.enableZoomWheel;
4878
4918
  }
4879
- updatePreview() { }
4880
- static set isGestureActive(value) {
4881
- if (OdBaseDragger._isGestureActive === value) {
4882
- return;
4883
- }
4884
- OdBaseDragger._isGestureActive = value;
4885
- if (OdBaseDragger._isGestureActive) {
4886
- OdBaseDragger.needSkipPointerUp = true;
4887
- }
4919
+ set enableZoomWheel(value) {
4920
+ this._data.enableZoomWheel = !!value;
4921
+ this.notifierChangeEvent();
4888
4922
  }
4889
- static get isGestureActive() {
4890
- return OdBaseDragger._isGestureActive;
4923
+ get enableGestures() {
4924
+ return this._data.enableGestures;
4891
4925
  }
4892
- static get needSkipPointerUp() {
4893
- if (OdBaseDragger._needSkipPointerUp) {
4894
- OdBaseDragger.needSkipPointerUp = false;
4895
- return true;
4896
- }
4897
- return false;
4926
+ set enableGestures(value) {
4927
+ this._data.enableGestures = !!value;
4928
+ this.notifierChangeEvent();
4898
4929
  }
4899
- static set needSkipPointerUp(value) {
4900
- OdBaseDragger._needSkipPointerUp = value;
4930
+ get geometryType() {
4931
+ return this._data.geometryType;
4932
+ }
4933
+ set geometryType(value) {
4934
+ this._data.geometryType = value;
4935
+ this.notifierChangeEvent();
4901
4936
  }
4902
4937
  }
4903
- OdBaseDragger._isGestureActive = false;
4904
- OdBaseDragger._needSkipPointerUp = false;
4905
4938
 
4906
4939
  function createHtmlElementIfNeed(element, targetElement, dataTestId) {
4907
4940
  if (!element) {
@@ -6997,7 +7030,7 @@
6997
7030
  : {};
6998
7031
  exports.Konva = {
6999
7032
  _global: exports.glob,
7000
- version: '9.3.1',
7033
+ version: '9.3.3',
7001
7034
  isBrowser: detectBrowser(),
7002
7035
  isUnminified: /param/.test(function (param) { }.toString()),
7003
7036
  dblClickWindow: 400,
@@ -9906,8 +9939,8 @@
9906
9939
  pixelRatio: pixelRatio,
9907
9940
  }), context = canvas.getContext();
9908
9941
  const bufferCanvas = new Canvas_1$1.SceneCanvas({
9909
- width: canvas.width,
9910
- height: canvas.height,
9942
+ width: canvas.width / canvas.pixelRatio + Math.abs(x),
9943
+ height: canvas.height / canvas.pixelRatio + Math.abs(y),
9911
9944
  pixelRatio: canvas.pixelRatio,
9912
9945
  });
9913
9946
  if (config.imageSmoothingEnabled === false) {
@@ -20300,7 +20333,6 @@
20300
20333
  this.configure(params);
20301
20334
  this._options = new Options(this);
20302
20335
  this.client = client;
20303
- this.clientoptionschange = (event) => (this._options.data = event.data.data);
20304
20336
  this._activeDragger = null;
20305
20337
  this._renderTime = 0;
20306
20338
  this.markup = MarkupFactory.createMarkup((_a = params.markupType) !== null && _a !== void 0 ? _a : MarkupType.Konva);
@@ -20329,11 +20361,6 @@
20329
20361
  }
20330
20362
  /**
20331
20363
  * `VisualizeJS` parameters.
20332
- *
20333
- * Use this only for standalone viewer instances. Use {@link Client#options | Client.options}
20334
- * instead if the viewer was created with a `Client` reference using
20335
- * {@link Viewer | Viewer.create(client)}. Changes in client options will be automatically
20336
- * applied to the viewer options.
20337
20364
  */
20338
20365
  get options() {
20339
20366
  return this._options;
@@ -20378,10 +20405,6 @@
20378
20405
  * of the `VisualizeJS` library. Retrieves {@link event:visualizeprogress | visualizeprogress} event.
20379
20406
  */
20380
20407
  async initialize(canvas, onProgress) {
20381
- if (this.client) {
20382
- this.client.addEventListener("optionschange", this.clientoptionschange);
20383
- this.options.data = this.client.options.data;
20384
- }
20385
20408
  this.addEventListener("optionschange", (event) => this.syncOptions(event.data));
20386
20409
  if (canvas.style.width === "" && canvas.style.height === "") {
20387
20410
  canvas.style.width = "100%";
@@ -20421,7 +20444,7 @@
20421
20444
  * release the `Viewer` instance.
20422
20445
  */
20423
20446
  dispose() {
20424
- var _a, _b, _c, _d, _e;
20447
+ var _a, _b, _c, _d;
20425
20448
  this.cancel();
20426
20449
  this.emitEvent({ type: "dispose" });
20427
20450
  if (this.frameId)
@@ -20438,7 +20461,6 @@
20438
20461
  this.canvas = undefined;
20439
20462
  (_d = this.visualizeJs) === null || _d === void 0 ? void 0 : _d.getViewer().clear();
20440
20463
  this.visualizeJs = undefined;
20441
- (_e = this.client) === null || _e === void 0 ? void 0 : _e.removeEventListener("optionschange", this.clientoptionschange);
20442
20464
  return this;
20443
20465
  }
20444
20466
  /**
@@ -21508,7 +21530,7 @@
21508
21530
  commands("VisualizeJS").registerCommand("zoomToSelected", zoomToSelected);
21509
21531
 
21510
21532
  ///////////////////////////////////////////////////////////////////////////////
21511
- const version = "25.3.9";
21533
+ const version = "25.3.10";
21512
21534
 
21513
21535
  exports.Assembly = Assembly;
21514
21536
  exports.CANVAS_EVENTS = CANVAS_EVENTS;