Compare commits

..
4 Commits
Author SHA1 Message Date
meehl 6b6098d331 chore: Release rusty-path-of-building version 0.2.18
Release / create-release (push) Successful in 8s
2026-05-29 15:09:23 +02:00
meehl 69d70e4712 Update CHANGELOG 2026-05-29 15:08:27 +02:00
meehl 32fd954952 Raise max_texture_array_layers requirement to support new gem tooltips 2026-05-29 15:02:35 +02:00
Aleksandr Timofeev 40ea4445cd Fix doubleclick handling (#49) 2026-05-24 21:11:19 +02:00
5 changed files with 47 additions and 17 deletions

No files matched your search

+12 -1
View File
@@ -2,6 +2,16 @@
## [Unreleased] - ReleaseDate
## [0.2.18] - 2026-05-29
### Changed
- Raise `max_texture_array_layers` GPU requirement to support new gem tooltips
### Fixed
- Fix doubleclick handling
## [0.2.17] - 2026-05-24
### Changed
@@ -199,8 +209,9 @@
- First release
<!-- next-url -->
[Unreleased]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.17...HEAD
[Unreleased]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.18...HEAD
[0.2.18]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.17...v0.2.18
[0.2.17]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.16...v0.2.17
[0.2.16]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.15...v0.2.16
[0.2.15]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.14...v0.2.15
Generated
+1 -1
View File
@@ -3149,7 +3149,7 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
[[package]]
name = "rusty-path-of-building"
version = "0.2.17"
version = "0.2.18"
dependencies = [
"ahash",
"anyhow",
+1 -1
View File
@@ -4,7 +4,7 @@ authors = ["meehl"]
description = "Cross-platform runtime for Path of Building"
repository = "https://github.com/meehl/rusty-path-of-building"
license = "MIT"
version = "0.2.17"
version = "0.2.18"
edition = "2024"
publish = false
+1 -1
View File
@@ -48,7 +48,7 @@ impl GraphicsContext {
let required_features = wgpu::Features::TEXTURE_COMPRESSION_BC;
let required_limits = wgpu::Limits {
max_texture_array_layers: 512,
max_texture_array_layers: 1024,
..Default::default()
};
+32 -13
View File
@@ -8,6 +8,15 @@ use winit::{
keyboard::{Key, ModifiersState, NamedKey, SmolStr},
};
const DOUBLE_CLICK_DURATION: Duration = Duration::from_millis(500);
const DOUBLE_CLICK_MOVE_THRESHOLD: f32 = 5.0;
#[derive(Debug, Clone)]
struct MousePressState {
time: Instant,
pos: LogicalPoint<f32>,
}
/// Current state of various keyboard and mouse inputs for the application.
#[derive(Default)]
pub struct InputState {
@@ -18,7 +27,7 @@ pub struct InputState {
/// HashSet of currently pressed mouse buttons.
mouse_pressed: HashSet<MouseButton>,
/// HashMap of mouse buttons (keys) with the last time they were pressed.
mouse_last_pressed: HashMap<MouseButton, Instant>,
mouse_last_pressed: HashMap<MouseButton, MousePressState>,
/// Current cursor position relative to the top-left corner of the window.
cursor_pos: LogicalPoint<f32>,
}
@@ -41,22 +50,31 @@ impl InputState {
/// Updates [`Self::mouse_pressed`](field@Self::mouse_pressed) based on provided
/// `button` and `is_pressed`.
pub fn set_mouse_pressed(&mut self, button: MouseButton, is_pressed: bool) -> bool {
if is_pressed {
self.mouse_pressed.insert(button);
} else {
if !is_pressed {
self.mouse_pressed.remove(&button);
return false;
}
self.mouse_pressed.insert(button);
let now = Instant::now();
let last = self.mouse_last_pressed.entry(button);
match last {
std::collections::hash_map::Entry::Occupied(mut occupied_entry) => {
let last = occupied_entry.insert(now);
now.duration_since(last) < Duration::from_millis(400)
let pos = self.cursor_pos;
match self.mouse_last_pressed.entry(button) {
std::collections::hash_map::Entry::Occupied(mut entry) => {
let last = entry.get();
let delta = (last.pos - pos).abs();
let is_double = now.duration_since(last.time) < DOUBLE_CLICK_DURATION
&& delta.x <= DOUBLE_CLICK_MOVE_THRESHOLD
&& delta.y <= DOUBLE_CLICK_MOVE_THRESHOLD;
if is_double {
// Reset so that a triple-click is not treated as two consecutive
// double-clicks; the next click starts a fresh timing window.
entry.remove();
} else {
entry.insert(MousePressState { time: now, pos });
}
is_double
}
std::collections::hash_map::Entry::Vacant(vacant_entry) => {
vacant_entry.insert(now);
std::collections::hash_map::Entry::Vacant(entry) => {
entry.insert(MousePressState { time: now, pos });
false
}
}
@@ -82,6 +100,7 @@ impl InputState {
pub fn clear_pressed(&mut self) {
self.keys_pressed.clear();
self.mouse_pressed.clear();
self.mouse_last_pressed.clear();
self.key_modifiers = ModifiersState::empty();
}
}