mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-09-25 01:39:57 +08:00
fix(stage): 修复画布缩放后拖动鼠标漂移
This commit is contained in:
parent
cb4304b6eb
commit
759b26481d
@ -47,6 +47,7 @@ export default class StageCore extends EventEmitter {
|
|||||||
public highlightLayer: StageHighlight;
|
public highlightLayer: StageHighlight;
|
||||||
public config: StageCoreConfig;
|
public config: StageCoreConfig;
|
||||||
public zoom = DEFAULT_ZOOM;
|
public zoom = DEFAULT_ZOOM;
|
||||||
|
public container?: HTMLDivElement;
|
||||||
private canSelect: CanSelect;
|
private canSelect: CanSelect;
|
||||||
|
|
||||||
constructor(config: StageCoreConfig) {
|
constructor(config: StageCoreConfig) {
|
||||||
@ -207,6 +208,7 @@ export default class StageCore extends EventEmitter {
|
|||||||
* @param el 将stage挂载到该Dom节点上
|
* @param el 将stage挂载到该Dom节点上
|
||||||
*/
|
*/
|
||||||
public mount(el: HTMLDivElement): void {
|
public mount(el: HTMLDivElement): void {
|
||||||
|
this.container = el;
|
||||||
const { mask, renderer } = this;
|
const { mask, renderer } = this;
|
||||||
|
|
||||||
renderer.mount(el);
|
renderer.mount(el);
|
||||||
@ -235,6 +237,8 @@ export default class StageCore extends EventEmitter {
|
|||||||
highlightLayer.destroy();
|
highlightLayer.destroy();
|
||||||
|
|
||||||
this.removeAllListeners();
|
this.removeAllListeners();
|
||||||
|
|
||||||
|
this.container = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getTargetElement(idOrEl: Id | HTMLElement): Promise<HTMLElement> {
|
private async getTargetElement(idOrEl: Id | HTMLElement): Promise<HTMLElement> {
|
||||||
|
@ -359,6 +359,7 @@ export default class StageDragResize extends EventEmitter {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
origin: true,
|
origin: true,
|
||||||
|
rootContainer: this.core.container,
|
||||||
zoom: 1,
|
zoom: 1,
|
||||||
dragArea: false,
|
dragArea: false,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user