SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.
JavaScript a2aagentic-aiai-agentsdevtoolsmcp-clientn8n-alternativeno-codeopen-sourceorchestrationsmythosvisual-builder
Prettifier fix + panzoom tweak
alaa-eddine830723507432
diff --git a/packages/app/src/builder-ui/workspace/ComponentSort.ts b/packages/app/src/builder-ui/workspace/ComponentSort.tsindex 941a1760..5c197406 100644--- a/packages/app/src/builder-ui/workspace/ComponentSort.ts+++ b/packages/app/src/builder-ui/workspace/ComponentSort.ts@@ -168,8 +168,8 @@ async function moveFlow(wf, x, y) {dom.style.transition = '0.2s ease-in-out';const left = parseInt(dom.style.left) + x;const top = parseInt(dom.style.top) + y;- dom.style.left = `${left}px`;- dom.style.top = `${top}px`;+ dom.style.left = `${~~left}px`;+ dom.style.top = `${~~top}px`;}await delay(300);@@ -189,13 +189,24 @@ async function alignBoxes(objects) {return [];}+ //do we have an agent card .+ const agentCard: HTMLElement = document.querySelector('.agent-card');+ const agentBoundingBox = {+ x: parseFloat(agentCard.style.left) || 0,+ y: parseFloat(agentCard.style.top) || 0,+ width: agentCard.clientWidth || 0,+ height: agentCard.clientHeight || 0,+ };+// Find the leftmost x-coordinate- const minX = Math.min(...objects.map((obj) => obj.box.x));+ const minX = agentBoundingBox+ ? agentBoundingBox.x + agentBoundingBox.width + 150+ : Math.min(...objects.map((obj) => obj.box.x));// Sort objects by their original y-coordinatesobjects.sort((a, b) => a.box.y - b.box.y);- let currentY = 0; // Start positioning from 0+ let currentY = agentBoundingBox ? agentBoundingBox.y - objects.length * 20 : 0; // Start positioning from 0for (let obj of objects) {await moveFlow(obj, minX - obj.box.x, currentY - obj.box.y);@@ -205,7 +216,7 @@ async function alignBoxes(objects) {}await delay(200);- workspace.jsPlumbInstance.repaintEverything();+ workspace.jsPlumbInstance.repaint(agentCard);}//align components within workflow@@ -249,8 +260,8 @@ async function organizeComponents(components, initialX, initialY) {if (!dom) continue;dom.style.transition = '0.1s ease-in-out';- dom.style.left = `${xPos}px`;- dom.style.top = `${yPos}px`;+ dom.style.left = `${~~xPos}px`;+ dom.style.top = `${~~yPos}px`;yPos += (dom.offsetHeight || 0) + 100; // Adjust based on height and gapdom.style.transition = '';@@ -268,7 +279,8 @@ async function organizeComponents(components, initialX, initialY) {}export async function sortAgent() {- if (document.querySelector('.component.selected')) {+ const selected = [...document.querySelectorAll('.component.selected')];+ if (selected.length > 1) {await sortSelection();} else {await sortAll();@@ -305,7 +317,7 @@ async function sortAll() {await delay(100);await alignBoxes(workflows);await delay(200); // Increased delay to ensure DOM updates are complete- workspace.jsPlumbInstance.repaintEverything();+ //workspace.jsPlumbInstance.repaintEverything();} catch (error) {console.error('Error during sort:', error);} finally {@@ -376,7 +388,7 @@ async function sortSelection() {await delay(100);alignBoxes(selectedWorkflows);await delay(100);- workspace.jsPlumbInstance.repaintEverything();+ //workspace.jsPlumbInstance.repaintEverything();} catch (error) {console.error('Error during sort:', error);} finally {diff --git a/packages/app/src/builder-ui/workspace/Workspace.class.ts b/packages/app/src/builder-ui/workspace/Workspace.class.tsindex 668e18e9..e4bb0f2a 100644--- a/packages/app/src/builder-ui/workspace/Workspace.class.ts+++ b/packages/app/src/builder-ui/workspace/Workspace.class.ts@@ -1005,7 +1005,6 @@ export class Workspace extends EventEmitter {this.panzoom.handleMove(event);});document.addEventListener('pointerup', (event) => {- if (this.hoveredElement != this.container && this.hoveredElement != this.domElement) return;this.panzoom.handleUp(event);});