@tmagic/stage 1.4.8 → 1.4.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.
@@ -1848,6 +1848,7 @@ class ActionManager extends EventEmitter {
1848
1848
  };
1849
1849
  }
1850
1850
 
1851
+ const guidesClass = "tmagic-stage-guides";
1851
1852
  class Rule extends EventEmitter {
1852
1853
  hGuides;
1853
1854
  vGuides;
@@ -1912,9 +1913,8 @@ class Rule extends EventEmitter {
1912
1913
  */
1913
1914
  showRule(show = true) {
1914
1915
  if (show) {
1915
- this.hGuides.destroy();
1916
+ this.destroyGuides();
1916
1917
  this.hGuides = this.createGuides(GuidesType.HORIZONTAL, this.horizontalGuidelines);
1917
- this.vGuides.destroy();
1918
1918
  this.vGuides = this.createGuides(GuidesType.VERTICAL, this.verticalGuidelines);
1919
1919
  } else {
1920
1920
  this.hGuides.setState({
@@ -1936,11 +1936,19 @@ class Rule extends EventEmitter {
1936
1936
  this.vGuides.scroll(scrollTop);
1937
1937
  }
1938
1938
  destroy() {
1939
+ this.destroyGuides();
1939
1940
  this.hGuides.off("changeGuides", this.hGuidesChangeGuidesHandler);
1940
1941
  this.vGuides.off("changeGuides", this.vGuidesChangeGuidesHandler);
1941
1942
  this.containerResizeObserver.disconnect();
1942
1943
  this.removeAllListeners();
1943
1944
  }
1945
+ destroyGuides() {
1946
+ this.hGuides.destroy();
1947
+ this.vGuides.destroy();
1948
+ this.container.querySelectorAll(`.${guidesClass}`).forEach((el) => {
1949
+ el.remove();
1950
+ });
1951
+ }
1944
1952
  getGuidesStyle = (type) => ({
1945
1953
  position: "fixed",
1946
1954
  zIndex: 1,
@@ -1954,6 +1962,7 @@ class Rule extends EventEmitter {
1954
1962
  type,
1955
1963
  defaultGuides,
1956
1964
  displayDragPos: true,
1965
+ className: guidesClass,
1957
1966
  backgroundColor: "#fff",
1958
1967
  lineColor: "#000",
1959
1968
  textColor: "#000",
@@ -2102,11 +2111,11 @@ class StageMask extends Rule {
2102
2111
  * 销毁实例
2103
2112
  */
2104
2113
  destroy() {
2114
+ super.destroy();
2105
2115
  this.content?.remove();
2106
2116
  this.page = null;
2107
2117
  this.pageScrollParent = null;
2108
2118
  this.wrapperResizeObserver?.disconnect();
2109
- super.destroy();
2110
2119
  }
2111
2120
  on(eventName, listener) {
2112
2121
  return super.on(eventName, listener);
@@ -1845,6 +1845,7 @@
1845
1845
  };
1846
1846
  }
1847
1847
 
1848
+ const guidesClass = "tmagic-stage-guides";
1848
1849
  class Rule extends EventEmitter {
1849
1850
  hGuides;
1850
1851
  vGuides;
@@ -1909,9 +1910,8 @@
1909
1910
  */
1910
1911
  showRule(show = true) {
1911
1912
  if (show) {
1912
- this.hGuides.destroy();
1913
+ this.destroyGuides();
1913
1914
  this.hGuides = this.createGuides(GuidesType.HORIZONTAL, this.horizontalGuidelines);
1914
- this.vGuides.destroy();
1915
1915
  this.vGuides = this.createGuides(GuidesType.VERTICAL, this.verticalGuidelines);
1916
1916
  } else {
1917
1917
  this.hGuides.setState({
@@ -1933,11 +1933,19 @@
1933
1933
  this.vGuides.scroll(scrollTop);
1934
1934
  }
1935
1935
  destroy() {
1936
+ this.destroyGuides();
1936
1937
  this.hGuides.off("changeGuides", this.hGuidesChangeGuidesHandler);
1937
1938
  this.vGuides.off("changeGuides", this.vGuidesChangeGuidesHandler);
1938
1939
  this.containerResizeObserver.disconnect();
1939
1940
  this.removeAllListeners();
1940
1941
  }
1942
+ destroyGuides() {
1943
+ this.hGuides.destroy();
1944
+ this.vGuides.destroy();
1945
+ this.container.querySelectorAll(`.${guidesClass}`).forEach((el) => {
1946
+ el.remove();
1947
+ });
1948
+ }
1941
1949
  getGuidesStyle = (type) => ({
1942
1950
  position: "fixed",
1943
1951
  zIndex: 1,
@@ -1951,6 +1959,7 @@
1951
1959
  type,
1952
1960
  defaultGuides,
1953
1961
  displayDragPos: true,
1962
+ className: guidesClass,
1954
1963
  backgroundColor: "#fff",
1955
1964
  lineColor: "#000",
1956
1965
  textColor: "#000",
@@ -2099,11 +2108,11 @@
2099
2108
  * 销毁实例
2100
2109
  */
2101
2110
  destroy() {
2111
+ super.destroy();
2102
2112
  this.content?.remove();
2103
2113
  this.page = null;
2104
2114
  this.pageScrollParent = null;
2105
2115
  this.wrapperResizeObserver?.disconnect();
2106
- super.destroy();
2107
2116
  }
2108
2117
  on(eventName, listener) {
2109
2118
  return super.on(eventName, listener);
package/package.json CHANGED
@@ -1,10 +1,7 @@
1
1
  {
2
- "version": "1.4.8",
2
+ "version": "1.4.10",
3
3
  "name": "@tmagic/stage",
4
4
  "type": "module",
5
- "sideEffects": [
6
- "dist/*"
7
- ],
8
5
  "main": "dist/tmagic-stage.umd.cjs",
9
6
  "module": "dist/tmagic-stage.js",
10
7
  "types": "types/index.d.ts",
@@ -18,7 +15,8 @@
18
15
  },
19
16
  "files": [
20
17
  "dist",
21
- "types"
18
+ "types",
19
+ "src"
22
20
  ],
23
21
  "license": "Apache-2.0",
24
22
  "engines": {
@@ -46,9 +44,9 @@
46
44
  },
47
45
  "peerDependencies": {
48
46
  "typescript": "*",
49
- "@tmagic/core": "1.4.8",
50
- "@tmagic/utils": "1.4.8",
51
- "@tmagic/schema": "1.4.8"
47
+ "@tmagic/schema": "1.4.10",
48
+ "@tmagic/core": "1.4.10",
49
+ "@tmagic/utils": "1.4.10"
52
50
  },
53
51
  "peerDependenciesMeta": {
54
52
  "typescript": {