kitgit

tirbofish/dropbear · commit

2f038d7e62aeb33bdc2766943bd0729ba3f0ed39

feature: rows and columns + scripting feature: scripting for rectangles fix: dpi implemented

Unverified

Thribhu K <4tkbytes@pm.me> · 2026-02-11 11:05

view full diff

diff --git a/crates/kino-ui/src/camera.rs b/crates/kino-ui/src/camera.rs
index f1b9753..4b1c675 100644
--- a/crates/kino-ui/src/camera.rs
+++ b/crates/kino-ui/src/camera.rs
@@ -1,5 +1,5 @@
-use bytemuck::{Pod, Zeroable};
-use glam::{Mat4, Vec2};
+    use bytemuck::{Pod, Zeroable};
+use glam::{Mat4, Vec2, Vec3};
 use crate::math::Rect;
 
 pub struct Camera2D {
@@ -19,15 +19,24 @@ impl Default for Camera2D {
 impl Camera2D {
     /// Returns the orthographic view-projection matrix for the current camera state
     pub fn view_proj(&self, screen_size: Vec2) -> Mat4 {
-        let width = screen_size.x / self.zoom;
-        let height = screen_size.y / self.zoom;
+        let (width, height) = (screen_size.x, screen_size.y);
 
-        let left = self.position.x;
-        let right = self.position.x + width;
-        let top = self.position.y;
-        let bottom = self.position.y + height;
+        let view = Mat4::look_at_rh(
+            self.position.extend(1.0),
+            self.position.extend(0.0),
+            Vec3::Y,
+        );
 
-        Mat4::orthographic_lh(left, right, bottom, top, -1.0, 1.0)
+        let proj = Mat4::orthographic_rh(
+            0.0,
+            width,
+            height,
+            0.0,
+            -1.0,
+            1.0,
+        );
+
+        proj * view
     }
 
     /// Set the camera's position (top-left corner of view)
diff --git a/crates/kino-ui/src/widgets/layout.rs b/crates/kino-ui/src/widgets/layout.rs
new file mode 100644
index 0000000..5f17de2
--- /dev/null
+++ b/crates/kino-ui/src/widgets/layout.rs
@@ -0,0 +1,218 @@

Large diffs are not rendered by default. Showing the first 50 of 976 lines. Show full diff