@tmagic/stage 1.5.17 → 1.5.19

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.
@@ -2148,6 +2148,11 @@ class StageMask extends Rule {
2148
2148
  }
2149
2149
  scrollIntoView(el) {
2150
2150
  if (!this.page || el.getBoundingClientRect().left >= this.page.scrollWidth) return;
2151
+ const scrollParent = getScrollParent(el);
2152
+ if (scrollParent && scrollParent !== this.pageScrollParent) {
2153
+ this.scrollIntoView(scrollParent);
2154
+ return;
2155
+ }
2151
2156
  el.scrollIntoView();
2152
2157
  if (!this.pageScrollParent) return;
2153
2158
  this.scrollLeft = this.pageScrollParent.scrollLeft;
@@ -4621,6 +4621,11 @@
4621
4621
  }
4622
4622
  scrollIntoView(el) {
4623
4623
  if (!this.page || el.getBoundingClientRect().left >= this.page.scrollWidth) return;
4624
+ const scrollParent = getScrollParent(el);
4625
+ if (scrollParent && scrollParent !== this.pageScrollParent) {
4626
+ this.scrollIntoView(scrollParent);
4627
+ return;
4628
+ }
4624
4629
  el.scrollIntoView();
4625
4630
  if (!this.pageScrollParent) return;
4626
4631
  this.scrollLeft = this.pageScrollParent.scrollLeft;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.5.17",
2
+ "version": "1.5.19",
3
3
  "name": "@tmagic/stage",
4
4
  "type": "module",
5
5
  "main": "dist/tmagic-stage.umd.cjs",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "peerDependencies": {
44
44
  "typescript": "*",
45
- "@tmagic/core": "1.5.17"
45
+ "@tmagic/core": "1.5.19"
46
46
  },
47
47
  "peerDependenciesMeta": {
48
48
  "typescript": {
package/src/StageMask.ts CHANGED
@@ -158,8 +158,17 @@ export default class StageMask extends Rule {
158
158
  // 不可以有横向滚动
159
159
  if (!this.page || el.getBoundingClientRect().left >= this.page.scrollWidth) return;
160
160
 
161
+ const scrollParent = getScrollParent(el as HTMLElement);
162
+
163
+ if (scrollParent && scrollParent !== this.pageScrollParent) {
164
+ this.scrollIntoView(scrollParent);
165
+ return;
166
+ }
167
+
161
168
  el.scrollIntoView();
169
+
162
170
  if (!this.pageScrollParent) return;
171
+
163
172
  this.scrollLeft = this.pageScrollParent.scrollLeft;
164
173
  this.scrollTop = this.pageScrollParent.scrollTop;
165
174