mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-08-30 18:59:51 +08:00
fix(stage): 修复非多选状态下,点击选中组件切换为普通选中状态 (#254)
* fix(stage): 修复非多选状态下,点击选中组件切换为普通选中状态 * fix(stage): 修复非多选状态下,点击选中组件切换为普通选中状态 * fix(stage): 修复非多选状态下,点击选中组件切换为普通选中状态
This commit is contained in:
parent
78fe83bddc
commit
cf9768ba96
@ -139,8 +139,14 @@ export default class StageCore extends EventEmitter {
|
||||
setTimeout(() => this.emit('sort', data));
|
||||
});
|
||||
|
||||
this.multiDr.on('update', (data: UpdateEventData) => {
|
||||
this.multiDr
|
||||
.on('update', (data: UpdateEventData) => {
|
||||
setTimeout(() => this.emit('update', data));
|
||||
})
|
||||
.on('select', async (id: Id) => {
|
||||
const el = await this.getTargetElement(id);
|
||||
this.select(el); // 选中
|
||||
setTimeout(() => this.emit('select', el)); // set node
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -124,6 +124,13 @@ export default class StageMultiDragResize extends EventEmitter {
|
||||
})
|
||||
.on('dragGroupEnd', () => {
|
||||
this.update();
|
||||
})
|
||||
.on('clickGroup', (params) => {
|
||||
const { inputTarget, targets } = params;
|
||||
// 如果此时mask不处于多选状态下,且有多个元素被选中,同时点击的元素在选中元素中的其中一项,代表多选态切换为该元素的单选态
|
||||
if (!this.mask.isMultiSelectStatus && targets.length > 1 && targets.includes(inputTarget)) {
|
||||
this.emit('select', inputTarget.id.replace(DRAG_EL_ID_PREFIX, ''));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user