We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e952a82 commit 84ea500Copy full SHA for 84ea500
1 file changed
rust_core/src/main.rs
@@ -113,10 +113,21 @@ fn get_interaction(camera: &Camera2D) -> Interaction {
113
}
114
115
fn get_camera() -> Camera2D {
116
- let aspect = screen_width() / screen_height();
+ let width = screen_width();
117
+ let height = screen_height();
118
+ let aspect = width / height;
119
+
120
+ let target_radius = 200.0;
121
122
+ let (zoom_x, zoom_y) = if width < height {
123
+ (1.0 / target_radius, aspect / target_radius)
124
+ } else {
125
+ (1.0 / (target_radius * aspect), 1.0 / target_radius)
126
+ };
127
128
Camera2D {
129
target: vec2(0.0, 0.0),
- zoom: vec2(1.0 / 300.0, aspect / 300.0),
130
+ zoom: vec2(zoom_x, zoom_y),
131
..Default::default()
132
133
0 commit comments