mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-09-13 23:20:15 +08:00
fix(stage): 页面小于画布时,滚动位置修复
This commit is contained in:
parent
019cfc7e93
commit
8452daf0e0
@ -162,9 +162,10 @@ export default class StageMask extends Rule {
|
||||
this.setHeight(clientHeight);
|
||||
this.setWidth(clientWidth);
|
||||
|
||||
this.fixScrollValue();
|
||||
this.scroll();
|
||||
this.core.dr.updateMoveable();
|
||||
if (this.core.dr.moveable) {
|
||||
this.core.dr.updateMoveable();
|
||||
}
|
||||
});
|
||||
|
||||
this.pageResizeObserver.observe(page);
|
||||
@ -218,6 +219,8 @@ export default class StageMask extends Rule {
|
||||
}
|
||||
|
||||
private scroll() {
|
||||
this.fixScrollValue();
|
||||
|
||||
let { scrollLeft, scrollTop } = this;
|
||||
|
||||
if (this.pageScrollParent) {
|
||||
@ -264,14 +267,14 @@ export default class StageMask extends Rule {
|
||||
* 计算并设置最大滚动宽度
|
||||
*/
|
||||
private setMaxScrollLeft(): void {
|
||||
this.maxScrollLeft = this.width - this.wrapperWidth;
|
||||
this.maxScrollLeft = Math.max(this.width - this.wrapperWidth, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算并设置最大滚动高度
|
||||
*/
|
||||
private setMaxScrollTop(): void {
|
||||
this.maxScrollTop = this.height - this.wrapperHeight;
|
||||
this.maxScrollTop = Math.max(this.height - this.wrapperHeight, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -333,8 +336,6 @@ export default class StageMask extends Rule {
|
||||
this.scrollLeft = this.scrollLeft + deltaX;
|
||||
}
|
||||
|
||||
this.fixScrollValue();
|
||||
|
||||
this.scroll();
|
||||
|
||||
this.emit('scroll', event);
|
||||
|
Loading…
x
Reference in New Issue
Block a user