feat: separate 2d scenes viewports and explicit cameras

This commit is contained in:
2026-11-10 22:42:56 +08:00
parent 32d7ada3ab
commit 040b779f5f
29 changed files with 1309 additions and 70 deletions
+20
View File
@@ -59,6 +59,26 @@ pub enum DrawCommand {
},
}
impl DrawCommand {
pub fn translated(mut self, delta: Point) -> Self {
match &mut self {
Self::WrappedText { rect, .. }
| Self::PushClip(rect)
| Self::FillRoundedRect { rect, .. }
| Self::StrokeRoundedRect { rect, .. } => {
rect.x += delta.x;
rect.y += delta.y;
}
Self::Text { origin, .. } => {
origin.x += delta.x;
origin.y += delta.y;
}
_ => {}
}
self
}
}
#[derive(Clone, Debug, Default)]
pub struct DisplayList {
commands: Vec<DrawCommand>,