Server: domain (entities, value objects, ports), protocol (postcard wire types), application (config service, data projection), adapters (config-memory, tcp-server), bootstrap (composition root with fake data). Client: client-domain (layout engine, render tree, HAL ports), client-application (message handling, repaint commands), adapters (tcp-client, display-terminal), client-desktop (end-to-end working). ESP32: client-esp32 firmware with ILI9341 display over SPI, WiFi networking. Display test verified on hardware — landscape orientation, text rendering works. 60 workspace tests, all passing.
30 lines
794 B
Rust
30 lines
794 B
Rust
use std::collections::HashMap;
|
|
use domain::WidgetId;
|
|
use crate::BoundingBox;
|
|
|
|
pub struct RenderTree {
|
|
pub widget_bounds: HashMap<WidgetId, BoundingBox>,
|
|
}
|
|
|
|
impl RenderTree {
|
|
pub fn get_widget_bounds(&self, id: WidgetId) -> Option<&BoundingBox> {
|
|
self.widget_bounds.get(&id)
|
|
}
|
|
|
|
pub fn diff(&self, other: &RenderTree) -> Vec<WidgetId> {
|
|
let mut changed = Vec::new();
|
|
for (id, bounds) in &self.widget_bounds {
|
|
match other.widget_bounds.get(id) {
|
|
Some(prev) if prev == bounds => {}
|
|
_ => changed.push(*id),
|
|
}
|
|
}
|
|
for id in other.widget_bounds.keys() {
|
|
if !self.widget_bounds.contains_key(id) {
|
|
changed.push(*id);
|
|
}
|
|
}
|
|
changed
|
|
}
|
|
}
|