!2837 修复: 图层UI的层级结构

pull/2839/MERGE
张子涵 3 months ago committed by 林三
parent b98352c97b
commit e85fcc6590

@ -151,25 +151,28 @@ export class LayerManager extends React.Component<{}, {}>
SelectLayerEntitys(selected);
}}
/>
<MenuItem
icon="inheritance"
text="将选中实体置为该图层"
onClick={() =>
{
this.ClickInnerEvent(e);
const ens = app.Editor.SelectCtrl.SelectSet.SelectEntityList;
if (ens.length > 0)
LayerCMD.PutEntitysInLayer(ens, selected);
else
{
!selected.children &&
<MenuItem
icon="inheritance"
text="将选中实体置为该图层"
onClick={() =>
{
AppToaster.show({
message: "请先选中实体",
timeout: 2000,
intent: Intent.DANGER
}, 'openfile');
}
}}
/>
this.ClickInnerEvent(e);
const ens = app.Editor.SelectCtrl.SelectSet.SelectEntityList;
if (ens.length > 0)
LayerCMD.PutEntitysInLayer(ens, selected);
else
{
AppToaster.show({
message: "请先选中实体",
timeout: 2000,
intent: Intent.DANGER
}, 'openfile');
}
}}
/>
}
</Menu>,
{ left: e.clientX, top: e.clientY },
() => this.setState({ isContextMenuOpen: false }),
@ -219,9 +222,13 @@ export class LayerManager extends React.Component<{}, {}>
const line = dom.children[0] as HTMLDivElement;
const key = dom.getAttribute("data-key");
const node = TreeAction.FindNode(layerStore.data, (node: ILayerNode) => node.name === key);
const isInSelf = data.name === key;
// 拖拽到文件夹里
if (e.clientY > rect.top && e.clientY < rect.bottom && node.children)
{
if (!data.children || !TreeAction.FindNode(data.children, (node: ILayerNode) => node.name === key))
const isInChildren = data.children && TreeAction.FindNode(node.children, (node: ILayerNode) => node.name === key);
// 确保不拖拽到自身及其子文件里
if (!isInSelf && !isInChildren)
{
const div = dom.children[1] as HTMLDivElement;
div.style.background = "rgba(150, 180, 210, 0.5)";
@ -230,11 +237,17 @@ export class LayerManager extends React.Component<{}, {}>
return;
}
}
// 拖拽到文件上方
if (e.clientY < boundary)
{
line.style.height = "5px";
this._ToWhere = key;
return;
const isInChildren = data.children && TreeAction.FindNode(data.children, (node: ILayerNode) => node.name === key);
// 确保不拖拽到自身及其子文件里
if (!isInSelf && !isInChildren)
{
line.style.height = "5px";
this._ToWhere = key;
return;
}
}
}
this._ToWhere = "--LAST";
@ -383,7 +396,7 @@ export class LayerManager extends React.Component<{}, {}>
</div>
</div>
}
{data.expanded && data.children && this.CreateList(data.children)}
{data.expanded && data.children && data.children.length > 0 && this.CreateList(data.children)}
</>);
})
);

Loading…
Cancel
Save