Some checks failed
CI / build (push) Failing after 36s
WASM reactive UI framework for Go: - reactive/ - Signal[T], Effect, Runtime - ui/ - Button, Text, Input, View, Canvas, SVG components - navigation/ - Router, guards, history management - auth/ - OIDC client for WASM applications - host/ - Static file server Extracted from arcadia as open-source component. Co-Authored-By: Claude <noreply@anthropic.com>
52 lines
1.6 KiB
Go
52 lines
1.6 KiB
Go
//go:build js && wasm
|
|
|
|
package ui
|
|
|
|
// CanvasDefaults contains default values for canvas rendering and interaction
|
|
type CanvasDefaults struct {
|
|
// Interaction thresholds
|
|
EdgeThreshold float64 // Distance from edge to trigger connection drawing (default: 15)
|
|
DragThreshold float64 // Minimum movement to count as drag vs click (default: 2)
|
|
|
|
// Resize constraints
|
|
MinResizeWidth float64 // Minimum width when resizing (default: 100)
|
|
MinResizeHeight float64 // Minimum height when resizing (default: 100)
|
|
|
|
// Resize handle sizes
|
|
CornerHandleSize float64 // Size of corner resize handles (default: 12)
|
|
EdgeHandleWidth float64 // Width of edge resize handles (default: 8)
|
|
EdgeHandleLength float64 // Length of edge resize handles (default: 24)
|
|
|
|
// Connection rendering
|
|
ConnectionHitWidth float64 // Width of invisible hit area for connections (default: 12)
|
|
LabelBackgroundWidth float64 // Width of label background rect (default: 60)
|
|
LabelBackgroundHeight float64 // Height of label background rect (default: 20)
|
|
|
|
// Container layout
|
|
ContainerHeaderHeight float64 // Height of container header bar for click detection (default: 32)
|
|
}
|
|
|
|
// DefaultCanvasDefaults returns the default configuration values
|
|
var DefaultCanvasDefaults = CanvasDefaults{
|
|
// Interaction thresholds
|
|
EdgeThreshold: 15.0,
|
|
DragThreshold: 2.0,
|
|
|
|
// Resize constraints
|
|
MinResizeWidth: 100.0,
|
|
MinResizeHeight: 100.0,
|
|
|
|
// Resize handle sizes
|
|
CornerHandleSize: 12.0,
|
|
EdgeHandleWidth: 8.0,
|
|
EdgeHandleLength: 24.0,
|
|
|
|
// Connection rendering
|
|
ConnectionHitWidth: 12.0,
|
|
LabelBackgroundWidth: 60.0,
|
|
LabelBackgroundHeight: 20.0,
|
|
|
|
// Container layout
|
|
ContainerHeaderHeight: 32.0,
|
|
}
|