kitgit

tirbofish/dropbear · diff

af45edd · Thribhu K

fix: weird signal bug

Unverified

diff --git a/crates/eucalyptus-editor/src/editor/input.rs b/crates/eucalyptus-editor/src/editor/input.rs
index ec0d30a..d9681b8 100644
--- a/crates/eucalyptus-editor/src/editor/input.rs
+++ b/crates/eucalyptus-editor/src/editor/input.rs
@@ -93,6 +93,7 @@ impl Keyboard for Editor {
             }
             KeyCode::Escape => {
                 if is_playing {
+                    self.signal = Signal::StopPlaying;
                 } else if is_double_press {
                     if self.selected_entity.is_some() {
                         self.selected_entity = None;
diff --git a/crates/eucalyptus-editor/src/editor/scene.rs b/crates/eucalyptus-editor/src/editor/scene.rs
index 6be5423..523f214 100644
--- a/crates/eucalyptus-editor/src/editor/scene.rs
+++ b/crates/eucalyptus-editor/src/editor/scene.rs
@@ -166,7 +166,7 @@ impl Scene for Editor {
                     self.scene_command = SceneCommand::SetAntialiasing(desired);
                     self.pending_aa_reload = Some(desired);
                 }
-            } else if self.pending_aa_reload.is_some() {
+            } else if self.pending_aa_reload.is_some() && matches!(self.signal, Signal::None) {
                 log::debug!("Anti aliasing mode applied, reloading WGPU data");
                 self.signal = Signal::ReloadWGPUData {
                     skybox_texture: None,
@@ -250,12 +250,6 @@ impl Scene for Editor {
             self.is_viewport_focused = false;
         }
 
-        if matches!(self.editor_state, EditorState::Playing) {
-            if self.input_state.pressed_keys.contains(&KeyCode::Escape) {
-                self.signal = Signal::StopPlaying;
-            }
-        }
-
         if self.is_viewport_focused
             && matches!(self.viewport_mode, ViewportMode::CameraMove)
             && !matches!(self.editor_state, EditorState::Playing)
diff --git a/crates/eucalyptus-editor/src/editor/viewport.rs b/crates/eucalyptus-editor/src/editor/viewport.rs
index 6c02e31..9c98624 100644
--- a/crates/eucalyptus-editor/src/editor/viewport.rs
+++ b/crates/eucalyptus-editor/src/editor/viewport.rs
@@ -15,12 +15,13 @@ impl<'a> EditorTabViewer<'a> {
 
         let available_rect = ui.available_rect_before_wrap();
         let available_size = available_rect.size();
+        let pixels_per_point = ui.ctx().pixels_per_point();
 
-        let desired_width = available_size.x.max(1.0).round() as u32;
-        let desired_height = available_size.y.max(1.0).round() as u32;
+        let desired_width = (available_size.x * pixels_per_point).max(1.0).round() as u32;
+        let desired_height = (available_size.y * pixels_per_point).max(1.0).round() as u32;
         if self.tex_size.width != desired_width || self.tex_size.height != desired_height {
             if matches!(*self.signal, Signal::None) {
-                *self.signal = Signal::UpdateViewportSize((available_size.x, available_size.y));
+                *self.signal = Signal::UpdateViewportSize((desired_width as f32, desired_height as f32));
             }
         }
 
diff --git a/crates/eucalyptus-editor/src/signal.rs b/crates/eucalyptus-editor/src/signal.rs
index d4eb8b9..a4b672f 100644
--- a/crates/eucalyptus-editor/src/signal.rs
+++ b/crates/eucalyptus-editor/src/signal.rs
@@ -280,6 +280,7 @@ impl SignalController for Editor {
                         info!("Using cached JAR: {}", jar_path.display());
 
                         self.show_build_window = false;
+                        self.signal = Signal::None;
 
                         self.load_play_mode()?;
                         return Ok(());
@@ -418,6 +419,7 @@ impl SignalController for Editor {
                                 log::debug!("Path is valid, JAR location as {}", path.display());
                                 success!("Build completed successfully!");
                                 self.show_build_window = false;
+                                self.signal = Signal::None;
 
                                 self.load_play_mode()?;
                             }
@@ -427,7 +429,6 @@ impl SignalController for Editor {
                                 self.last_build_error = Some(self.build_logs.join("\n"));
 
                                 fatal!("Failed to ready script manager interface because {}", e);
-                                self.signal = Signal::None;
                                 self.show_build_window = false;
                                 self.show_build_error_window = true;
                                 self.editor_state = EditorState::Editing;
@@ -483,6 +484,10 @@ impl SignalController for Editor {
                         self.show_build_error_window = false;
                     }
                 }
+
+                if matches!(self.editor_state, EditorState::Building) || self.show_build_error_window {
+                    self.signal = Signal::Play;
+                }
                 Ok(())
             }
             Signal::StopPlaying => {