fix(stage): 页面小于画布时,滚动位置修复

This commit is contained in:
roymondchen 2022-05-26 20:56:49 +08:00 committed by jia000
parent 019cfc7e93
commit 8452daf0e0

View File

@ -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);