mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-05-29 03:19:24 +08:00
fix(stage): 当选中的组件与上一次选中的组件有重叠时,选中后的下一个click事件丢失
This commit is contained in:
parent
45be838f20
commit
33a09cccc7
@ -96,6 +96,11 @@ export default class StageDragResize extends EventEmitter {
|
|||||||
const oldTarget = this.target;
|
const oldTarget = this.target;
|
||||||
this.target = el;
|
this.target = el;
|
||||||
|
|
||||||
|
if (!this.dragEl) {
|
||||||
|
this.dragEl = globalThis.document.createElement('div');
|
||||||
|
this.container.append(this.dragEl);
|
||||||
|
}
|
||||||
|
|
||||||
// 从不能拖动到能拖动的节点之间切换,要重新创建moveable,不然dragStart不生效
|
// 从不能拖动到能拖动的节点之间切换,要重新创建moveable,不然dragStart不生效
|
||||||
if (!this.moveable || this.target !== oldTarget) {
|
if (!this.moveable || this.target !== oldTarget) {
|
||||||
this.init(el);
|
this.init(el);
|
||||||
@ -157,6 +162,7 @@ export default class StageDragResize extends EventEmitter {
|
|||||||
public clearSelectStatus(): void {
|
public clearSelectStatus(): void {
|
||||||
if (!this.moveable) return;
|
if (!this.moveable) return;
|
||||||
this.destroyDragEl();
|
this.destroyDragEl();
|
||||||
|
this.dragEl = undefined;
|
||||||
this.moveable.target = null;
|
this.moveable.target = null;
|
||||||
this.moveable.updateTarget();
|
this.moveable.updateTarget();
|
||||||
}
|
}
|
||||||
@ -184,9 +190,11 @@ export default class StageDragResize extends EventEmitter {
|
|||||||
this.mode = getMode(el);
|
this.mode = getMode(el);
|
||||||
|
|
||||||
this.destroyGhostEl();
|
this.destroyGhostEl();
|
||||||
this.destroyDragEl();
|
|
||||||
this.dragEl = globalThis.document.createElement('div');
|
if (!this.dragEl) {
|
||||||
this.container.append(this.dragEl);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.dragEl.style.cssText = getTargetElStyle(el);
|
this.dragEl.style.cssText = getTargetElStyle(el);
|
||||||
this.dragEl.id = `${DRAG_EL_ID_PREFIX}${el.id}`;
|
this.dragEl.id = `${DRAG_EL_ID_PREFIX}${el.id}`;
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ export default class TargetCalibrate extends EventEmitter {
|
|||||||
top: ${top}px;
|
top: ${top}px;
|
||||||
width: ${el.clientWidth}px;
|
width: ${el.clientWidth}px;
|
||||||
height: ${el.clientHeight}px;
|
height: ${el.clientHeight}px;
|
||||||
z-index: ${ZIndex.DRAG_EL};
|
z-index: ${ZIndex.HIGHLIGHT_EL};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
this.operationEl.id = `${prefix}${el.id}`;
|
this.operationEl.id = `${prefix}${el.id}`;
|
||||||
|
@ -48,6 +48,7 @@ export enum ZIndex {
|
|||||||
SELECTED_EL = '666',
|
SELECTED_EL = '666',
|
||||||
GHOST_EL = '700',
|
GHOST_EL = '700',
|
||||||
DRAG_EL = '9',
|
DRAG_EL = '9',
|
||||||
|
HIGHLIGHT_EL = '8',
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 鼠标按键 */
|
/** 鼠标按键 */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user