diff --git a/Cargo.lock b/Cargo.lock index f4f3efe..0666152 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -548,7 +548,7 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "svc16" -version = "1.0.0" +version = "1.0.1" dependencies = [ "anyhow", "clap", diff --git a/Cargo.toml b/Cargo.toml index 178782c..4aad814 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "svc16" -version = "1.0.0" +version = "1.0.1" edition = "2021" authors = ["Jan Neuendorf"] description = "An emulator for a simple virtual computer" diff --git a/src/ui.rs b/src/ui.rs index f87208c..3afe40b 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -35,7 +35,11 @@ impl Layout { let (raw_x, raw_y) = mouse_position(); let clamped_x = (raw_x.clamp(self.x, self.x + self.size) - self.x) / self.size * 255.; let clamped_y = (raw_y.clamp(self.y, self.y + self.size) - self.y) / self.size * 255.; - (clamped_x, clamped_y) + // The mouse position is slightly modified so that the maximal position can be reached when the image takes up the entire window. + ( + (clamped_x * 255. / 254.).min(255.), + (clamped_y * 255. / 254.).min(255.), + ) } pub fn cursor_in_window(&self) -> bool { let mp = mouse_position();