mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-09-14 23:59:49 +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.setHeight(clientHeight);
|
||||||
this.setWidth(clientWidth);
|
this.setWidth(clientWidth);
|
||||||
|
|
||||||
this.fixScrollValue();
|
|
||||||
this.scroll();
|
this.scroll();
|
||||||
|
if (this.core.dr.moveable) {
|
||||||
this.core.dr.updateMoveable();
|
this.core.dr.updateMoveable();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.pageResizeObserver.observe(page);
|
this.pageResizeObserver.observe(page);
|
||||||
@ -218,6 +219,8 @@ export default class StageMask extends Rule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private scroll() {
|
private scroll() {
|
||||||
|
this.fixScrollValue();
|
||||||
|
|
||||||
let { scrollLeft, scrollTop } = this;
|
let { scrollLeft, scrollTop } = this;
|
||||||
|
|
||||||
if (this.pageScrollParent) {
|
if (this.pageScrollParent) {
|
||||||
@ -264,14 +267,14 @@ export default class StageMask extends Rule {
|
|||||||
* 计算并设置最大滚动宽度
|
* 计算并设置最大滚动宽度
|
||||||
*/
|
*/
|
||||||
private setMaxScrollLeft(): void {
|
private setMaxScrollLeft(): void {
|
||||||
this.maxScrollLeft = this.width - this.wrapperWidth;
|
this.maxScrollLeft = Math.max(this.width - this.wrapperWidth, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算并设置最大滚动高度
|
* 计算并设置最大滚动高度
|
||||||
*/
|
*/
|
||||||
private setMaxScrollTop(): void {
|
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.scrollLeft = this.scrollLeft + deltaX;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.fixScrollValue();
|
|
||||||
|
|
||||||
this.scroll();
|
this.scroll();
|
||||||
|
|
||||||
this.emit('scroll', event);
|
this.emit('scroll', event);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user