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
+8 -1
View File
@@ -55,6 +55,7 @@ enum Query {
ScrollBy,
ScrollPosition,
ScrollIntoView,
FitView,
Parent,
FirstChild,
NextSibling,
@@ -99,6 +100,7 @@ impl NativeCallable for Method {
| Query::ScrollTo
| Query::ScrollBy
| Query::ScrollIntoView
| Query::FitView
| Query::ScrollPosition
)
{
@@ -133,6 +135,10 @@ impl NativeCallable for Method {
crate::scroll::into_view(cx, self.owner, self.desktop)?;
Value::Nil
}
Query::FitView => {
crate::viewport::fit(cx, &mount)?;
Value::Nil
}
Query::ScrollPosition => {
let p = mount
.geometry
@@ -263,7 +269,7 @@ fn mount_signature(
};
let effect = if matches!(
query,
Query::ScrollTo | Query::ScrollBy | Query::ScrollIntoView | Query::Focus
Query::ScrollTo | Query::ScrollBy | Query::ScrollIntoView | Query::FitView | Query::Focus
) {
CallEffect::Mutating
} else {
@@ -405,6 +411,7 @@ impl NativeCallable for Sync {
("scrollBy", Query::ScrollBy),
("scrollPosition", Query::ScrollPosition),
("scrollIntoView", Query::ScrollIntoView),
("fitView", Query::FitView),
("parent", Query::Parent),
("firstChild", Query::FirstChild),
("nextSibling", Query::NextSibling),