Skip to content

Commit 5988c8e

Browse files
committed
docs: add zoom-stress-test example and LOD documentation
- Add zoom-stress-test to AGENTS.md build commands and key files - Document LOD system and thresholds in AGENTS.md architecture section - Add LOD properties to README.md NodeEditor reference - Add zoom-stress-test to README.md examples list - Document zoom/pan controls (Ctrl+scroll, scroll, middle-click)
1 parent a3955db commit 5988c8e

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ cargo run -p minimal
1818
# Build and run the custom shapes example
1919
cargo run -p custom-shapes
2020

21+
# Build and run the zoom stress test (LOD system demo)
22+
cargo run -p zoom-stress-test
23+
2124
# Check compilation without running
2225
cargo check
2326
```
@@ -32,6 +35,7 @@ cargo check
3235
| `examples/advanced/ui/pin_encoding.slint` | Application-specific pin ID encoding scheme |
3336
| `examples/advanced/ui/ui.slint` | Application-specific UI (Node component, data structs, main window) |
3437
| `examples/advanced/ui/filter_node.slint` | Complex node example with multiple widgets |
38+
| `examples/zoom-stress-test/ui/*.slint` | LOD implementation patterns for zoom scaling |
3539

3640
## Architecture
3741

@@ -51,6 +55,12 @@ cargo check
5155

5256
**Callback-based computation**: The Slint UI delegates expensive operations to Rust via callbacks (e.g., `compute-pin-at`).
5357

58+
**Level of Detail (LOD)**: NodeEditor supports configurable LOD thresholds for zoom-dependent rendering:
59+
- `lod-full-threshold: 0.5` - Zoom above which nodes render full detail
60+
- `lod-simplified-threshold: 0.25` - Zoom above which nodes render simplified detail
61+
- Below simplified threshold: nodes render as minimal colored boxes
62+
- See `examples/zoom-stress-test` for implementation patterns
63+
5464
## Data Models (in examples/advanced/src/main.rs)
5565

5666
The application maintains separate models for different node types but unifies operations via helper functions:

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,15 @@ The editor uses two coordinate systems:
163163

164164
The library handles all transformations transparently.
165165

166+
### Zoom & Pan Controls
167+
168+
Built-in input handling:
169+
- **Ctrl+Scroll**: Zoom in/out centered on mouse position
170+
- **Scroll**: Pan the viewport
171+
- **Middle-click drag**: Pan the viewport
172+
173+
Zoom is automatically clamped to `min-zoom` (default 0.1) and `max-zoom` (default 3.0).
174+
166175
## Component Reference
167176

168177
### NodeEditor (Main Component)
@@ -175,6 +184,12 @@ in-out property <float> zoom; // Zoom factor (1.0 = 100%)
175184
in property <float> min-zoom: 0.1; // Minimum zoom level
176185
in property <float> max-zoom: 3.0; // Maximum zoom level
177186
187+
// LOD (Level of Detail) configuration
188+
in property <float> lod-full-threshold: 0.5; // Zoom above which nodes render full detail
189+
in property <float> lod-simplified-threshold: 0.25; // Zoom above which nodes render simplified
190+
in property <length> min-node-width: 80px; // Minimum node width at any zoom
191+
in property <length> min-node-height: 40px; // Minimum node height at any zoom
192+
178193
in property <length> grid-spacing: 24px; // Grid cell size
179194
in property <bool> grid-snapping: true; // Enable snap-to-grid
180195
in property <color> grid-color: #404040; // Grid line color
@@ -469,6 +484,9 @@ let cache = tracker.cache(); // Use for hit testing
469484
- **pin-compatibility:** Demonstrates type-safe connections with a compatibility matrix, visual validation feedback, and custom pin behaviors.
470485
- Path: `examples/pin-compatibility`
471486
- Run: `cargo run -p pin-compatibility`
487+
- **zoom-stress-test:** Tests widget scaling at various zoom levels with Level of Detail (LOD) rendering. Shows how to implement LOD transitions for complex nodes.
488+
- Path: `examples/zoom-stress-test`
489+
- Run: `cargo run -p zoom-stress-test`
472490

473491
## License
474492

0 commit comments

Comments
 (0)