fix(stage): 修复画布缩放后拖动鼠标漂移

This commit is contained in:
roymondchen 2022-03-31 15:12:19 +08:00 committed by khuntoriia
parent cb4304b6eb
commit 759b26481d
2 changed files with 5 additions and 0 deletions

View File

@ -47,6 +47,7 @@ export default class StageCore extends EventEmitter {
public highlightLayer: StageHighlight;
public config: StageCoreConfig;
public zoom = DEFAULT_ZOOM;
public container?: HTMLDivElement;
private canSelect: CanSelect;
constructor(config: StageCoreConfig) {
@ -207,6 +208,7 @@ export default class StageCore extends EventEmitter {
* @param el stage挂载到该Dom节点上
*/
public mount(el: HTMLDivElement): void {
this.container = el;
const { mask, renderer } = this;
renderer.mount(el);
@ -235,6 +237,8 @@ export default class StageCore extends EventEmitter {
highlightLayer.destroy();
this.removeAllListeners();
this.container = undefined;
}
private async getTargetElement(idOrEl: Id | HTMLElement): Promise<HTMLElement> {

View File

@ -359,6 +359,7 @@ export default class StageDragResize extends EventEmitter {
return {
origin: true,
rootContainer: this.core.container,
zoom: 1,
dragArea: false,
draggable: true,