mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-09-23 07:59:59 +08:00
fix: 修复页面滚动高亮偏移的问题
This commit is contained in:
parent
f500e51933
commit
6a46f98766
@ -61,7 +61,7 @@ export default class StageCore extends EventEmitter {
|
|||||||
this.renderer = new StageRender({ core: this });
|
this.renderer = new StageRender({ core: this });
|
||||||
this.mask = new StageMask({ core: this });
|
this.mask = new StageMask({ core: this });
|
||||||
this.dr = new StageDragResize({ core: this, container: this.mask.content });
|
this.dr = new StageDragResize({ core: this, container: this.mask.content });
|
||||||
this.highlightLayer = new StageHighlight({ core: this, container: this.mask.content });
|
this.highlightLayer = new StageHighlight({ core: this, container: this.mask.wrapper });
|
||||||
|
|
||||||
this.renderer.on('runtime-ready', (runtime: Runtime) => this.emit('runtime-ready', runtime));
|
this.renderer.on('runtime-ready', (runtime: Runtime) => this.emit('runtime-ready', runtime));
|
||||||
this.renderer.on('page-el-update', (el: HTMLElement) => this.mask?.observe(el));
|
this.renderer.on('page-el-update', (el: HTMLElement) => this.mask?.observe(el));
|
||||||
|
@ -46,6 +46,15 @@ export default class StageHighlight extends EventEmitter {
|
|||||||
this.moveable?.destroy();
|
this.moveable?.destroy();
|
||||||
this.moveable = new Moveable(this.container, {
|
this.moveable = new Moveable(this.container, {
|
||||||
target: this.target,
|
target: this.target,
|
||||||
|
scrollable: true,
|
||||||
|
origin: true,
|
||||||
|
zoom: 1,
|
||||||
|
bounds: {
|
||||||
|
top: 0,
|
||||||
|
left: 0,
|
||||||
|
right: this.container.clientWidth,
|
||||||
|
bottom: this.container.clientHeight,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,6 +240,7 @@ export default class StageMask extends Rule {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private mouseWheelHandler = (event: WheelEvent) => {
|
private mouseWheelHandler = (event: WheelEvent) => {
|
||||||
|
this.emit('clearHighlight');
|
||||||
if (!this.page) throw new Error('page 未初始化');
|
if (!this.page) throw new Error('page 未初始化');
|
||||||
|
|
||||||
const { deltaY, deltaX } = event;
|
const { deltaY, deltaX } = event;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user