mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-05-28 19:09:57 +08:00
fix(editor): 移动元素到容器中的时候root没有更新问题 (#569)
* fix(editor/stage): 拖动组件进画布后,父容器位置计算有误 * fix(editorService): 移动元素时候root没有更新问题 --------- Co-authored-by: fanliming <fanlm@novastar.tech>
This commit is contained in:
parent
30929e8bd3
commit
edc7c11929
@ -810,7 +810,7 @@ class Editor extends BaseService {
|
|||||||
* @param targetId 容器ID
|
* @param targetId 容器ID
|
||||||
*/
|
*/
|
||||||
public async moveToContainer(config: MNode, targetId: Id): Promise<MNode | undefined> {
|
public async moveToContainer(config: MNode, targetId: Id): Promise<MNode | undefined> {
|
||||||
const root = cloneDeep(this.get('root'));
|
const root = this.get('root');
|
||||||
const { node, parent } = this.getNodeInfo(config.id, false);
|
const { node, parent } = this.getNodeInfo(config.id, false);
|
||||||
const target = this.getNodeById(targetId, false) as MContainer;
|
const target = this.getNodeById(targetId, false) as MContainer;
|
||||||
|
|
||||||
@ -819,7 +819,7 @@ class Editor extends BaseService {
|
|||||||
const index = getNodeIndex(node.id, parent);
|
const index = getNodeIndex(node.id, parent);
|
||||||
parent.items?.splice(index, 1);
|
parent.items?.splice(index, 1);
|
||||||
|
|
||||||
await stage.remove({ id: node.id, parentId: parent.id, root });
|
await stage.remove({ id: node.id, parentId: parent.id, root: cloneDeep(root) });
|
||||||
|
|
||||||
const layout = await this.getLayout(target);
|
const layout = await this.getLayout(target);
|
||||||
|
|
||||||
@ -835,7 +835,7 @@ class Editor extends BaseService {
|
|||||||
await stage.select(targetId);
|
await stage.select(targetId);
|
||||||
|
|
||||||
const targetParent = this.getParentById(target.id);
|
const targetParent = this.getParentById(target.id);
|
||||||
await stage.update({ config: cloneDeep(target), parentId: targetParent?.id, root });
|
await stage.update({ config: cloneDeep(target), parentId: targetParent?.id, root: cloneDeep(root) });
|
||||||
|
|
||||||
await this.select(newConfig);
|
await this.select(newConfig);
|
||||||
stage.select(newConfig.id);
|
stage.select(newConfig.id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user