From 6dcb6c9dd7dba1d24a33bb4a7417c94fadce66c9 Mon Sep 17 00:00:00 2001 From: CrispyPin Date: Tue, 10 Dec 2024 23:11:27 +0100 Subject: [PATCH] draw selection bounds independently of zoom --- assets/area_corner.png | Bin 105 -> 0 bytes assets/area_full.png | Bin 122 -> 99 bytes src/editor.rs | 22 ++++++++++------------ 3 files changed, 10 insertions(+), 12 deletions(-) delete mode 100644 assets/area_corner.png diff --git a/assets/area_corner.png b/assets/area_corner.png deleted file mode 100644 index 15150fc010fb4744dd6f547b820ec5ba852acf8b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 105 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`2A(dCAr`&KfBygfU(e>naE2j= z?Qc6%6I;L&F0Z`@TsogQrZA{JblAx4mYf(N!N8zbss7=GLAVT1FN3G6pUXO@geCy8 Cd>}%WV$qxY=l}oz^=w`Ys%#*Zy|C*xV*`U8DTAy7D;Nb1cx0BbF>JLL V;N@7gyO9A1JYD@<);T3K0RX}x8K?jN delta 91 zcmYeUnxGQq=;`7ZV$qxY=l}oz^=w`YXBcwW{>TvAH)Cv diff --git a/src/editor.rs b/src/editor.rs index aa62f90..a483f94 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -1084,18 +1084,16 @@ impl Editor { is_selecting: _, }) = self.active_tool { - let min = start.min(end); - let max = start.max(end); - let p_min = self.pos_to_screen(min.to_vec()); - let p_max = self.pos_to_screen(max.to_vec()); - let tex = textures.get("area_corner"); - d.draw_texture_ex(tex, p_min, 0., self.zoom, Color::WHITE); - let one_xy = Vector2::new(tile_size as f32, tile_size as f32); - d.draw_texture_ex(tex, p_max + one_xy, 180., self.zoom, Color::WHITE); - let top_right = Vector2::new(p_max.x + tile_size as f32, p_min.y); - d.draw_texture_ex(tex, top_right, 90., self.zoom, Color::WHITE); - let bot_left = Vector2::new(p_min.x, p_max.y + tile_size as f32); - d.draw_texture_ex(tex, bot_left, -90., self.zoom, Color::WHITE); + let p_min = self.pos_to_screen(start.min(end).to_vec()); + let p_max = self.pos_to_screen((start.max(end) + (1, 1).into()).to_vec()); + let x = p_min.x as i32; + let y = p_min.y as i32; + let width = p_max.x as i32 - x; + let height = p_max.y as i32 - y; + d.draw_rectangle(x, y, width, 4, Color::WHITE); + d.draw_rectangle(x, y + height - 4, width, 4, Color::WHITE); + d.draw_rectangle(x, y, 4, height, Color::WHITE); + d.draw_rectangle(x + width - 4, y, 4, height, Color::WHITE); } } }