Skip to content

Commit

Permalink
Merge pull request #4950 from systeminit/fix/frames-ordering-and-pare…
Browse files Browse the repository at this point in the history
…ntage

Fix frames ordering and parentage
  • Loading branch information
jobelenus authored Nov 8, 2024
2 parents 9f9df7f + 001c3ff commit 3ce43d5
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/web/src/components/ModelingDiagram/ModelingDiagram.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1438,6 +1438,8 @@ const findChildrenByBoundingBox = (

const components: (DiagramGroupData | DiagramNodeData)[] = [];
const process = ([id, elRect]: [ComponentId, IRect]) => {
// i do not fit inside myself
if (el.def.id === id) return;
const _r = { ...elRect };
_r.x -= _r.width / 2;
if (rectContainsAnother(rect, _r)) {
Expand Down Expand Up @@ -1603,6 +1605,8 @@ function endDragElements() {

const nonChildElements = currentSelectionMovableElements.value.filter(
(component) => {
if (draggedChildren.value.length === 0) return true;

const idx = draggedChildren.value.findIndex(
(child) => child.def.id === component.def.id,
);
Expand All @@ -1627,6 +1631,9 @@ function endDragElements() {

if (!component.def.parentId && newParent?.def.id)
setParents.push(component.def.id);

if (component.def.parentId !== newParent?.def.id)
setParents.push(component.def.id);
});

if (setParents.length > 0) {
Expand Down Expand Up @@ -2614,7 +2621,10 @@ const groups = computed(() => {

// if being dragged (or ancestor being dragged), bump up to front, but maintain order within that frame
// TODO change this to being position comparisons not parentage
if (dragElementsActive.value) {
if (
dragElementsActive.value ||
componentsStore.selectedComponentIds.length > 0
) {
if (
_.intersection(
[g.def.componentId, ...(g.def.ancestorIds || [])],
Expand Down

0 comments on commit 3ce43d5

Please sign in to comment.