mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-06-26 04:09:21 +08:00
fix(editor): 修复流式布局下移动图层操作相反问题
This commit is contained in:
parent
e8550728d1
commit
e0a16bcf0a
@ -629,12 +629,18 @@ class Editor extends BaseService {
|
||||
const brothers: MNode[] = parent?.items || [];
|
||||
const index = brothers.findIndex((item) => `${item.id}` === `${node?.id}`);
|
||||
|
||||
// 流式布局与绝对定位布局操作的相反的
|
||||
const layout = await this.getLayout(parent, node);
|
||||
const isRelative = layout === Layout.RELATIVE;
|
||||
|
||||
brothers.splice(index, 1);
|
||||
|
||||
if (offset === LayerOffset.TOP) {
|
||||
brothers.splice(brothers.length - 1, 0, brothers.splice(index, 1)[0]);
|
||||
brothers.splice(isRelative ? 0 : brothers.length - 1, 0, node);
|
||||
} else if (offset === LayerOffset.BOTTOM) {
|
||||
brothers.splice(0, 0, brothers.splice(index, 1)[0]);
|
||||
brothers.splice(isRelative ? brothers.length - 1 : 0, 0, node);
|
||||
} else {
|
||||
brothers.splice(index + parseInt(`${offset}`, 10), 0, brothers.splice(index, 1)[0]);
|
||||
brothers.splice(index + (isRelative ? -offset : offset), 0, node);
|
||||
}
|
||||
|
||||
const grandparent = this.getParentById(parent.id);
|
||||
|
Loading…
x
Reference in New Issue
Block a user