Improve RBAC edutor UI for small flows

This commit is contained in:
Andrew Kingston 2024-10-07 10:45:36 +01:00
parent f2b4ef2ac8
commit b9a106954f
No known key found for this signature in database
3 changed files with 12 additions and 2 deletions

View File

@ -19,7 +19,7 @@
const getCurlyBracePath = (x1, y1, x2, y2) => { const getCurlyBracePath = (x1, y1, x2, y2) => {
const w = 2 // Thickness const w = 2 // Thickness
const q = 2 // Intensity const q = 1 // Intensity
const i = 28 // Inner radius strenth (lower is stronger) const i = 28 // Inner radius strenth (lower is stronger)
const j = 32 // Outer radius strength (higher is stronger) const j = 32 // Outer radius strength (higher is stronger)

View File

@ -5,3 +5,4 @@ export const NodeHeight = GridResolution * 3
export const NodeWidth = GridResolution * 12 export const NodeWidth = GridResolution * 12
export const NodeHSpacing = GridResolution * 6 export const NodeHSpacing = GridResolution * 6
export const NodeVSpacing = GridResolution * 2 export const NodeVSpacing = GridResolution * 2
export const MinHeight = GridResolution * 10

View File

@ -5,6 +5,7 @@ import {
GridResolution, GridResolution,
NodeHSpacing, NodeHSpacing,
NodeVSpacing, NodeVSpacing,
MinHeight,
} from "./constants" } from "./constants"
import { getNodesBounds, Position } from "@xyflow/svelte" import { getNodesBounds, Position } from "@xyflow/svelte"
import { Roles } from "constants/backend" import { Roles } from "constants/backend"
@ -24,7 +25,15 @@ export const getBounds = nodes => {
height: 10 * GridResolution, height: 10 * GridResolution,
} }
} }
return getNodesBounds(interactiveNodes) let bounds = getNodesBounds(interactiveNodes)
// Enforce a min size
if (bounds.height < MinHeight) {
const diff = MinHeight - bounds.height
bounds.height = MinHeight
bounds.y -= diff / 2
}
return bounds
} }
// Gets the position of the basic role // Gets the position of the basic role