diff --git a/src/editor.rs b/src/editor.rs index b87a036..c941a3f 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -1024,8 +1024,7 @@ impl Editor { |(row, col): (i32, i32), texture: &str, tooltip: &'static str, tool_option: Tool| { let border = 4.; let gap = 2.; - let tex_size = 32.; - let button_size = tex_size + border * 2.; + let button_size = 32. + border * 2.; let grid_size = button_size + gap * 2.; let pos = Vector2 { x: 100. + col as f32 * grid_size - if col < 0 { 10. } else { 0. }, @@ -1036,13 +1035,11 @@ impl Editor { tooltip, ); scrollable_texture_option_button( - d, - &self.mouse, + (d, &self.mouse), pos, textures.get(texture), tool_option, &mut self.active_tool, - tex_size, border, ) }; diff --git a/src/ui.rs b/src/ui.rs index cbf4645..1a94a7f 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -299,13 +299,11 @@ pub fn text_input( } pub fn scrollable_texture_option_button( - d: &mut RaylibDrawHandle, - mouse: &MouseInput, + (d, mouse): (&mut RaylibDrawHandle, &MouseInput), pos: Vector2, texture: &Texture2D, option: T, current: &mut T, - tex_size: f32, border: f32, ) -> Option where @@ -314,8 +312,8 @@ where let bounds = Rectangle { x: pos.x, y: pos.y, - width: tex_size + border * 2., - height: tex_size + border * 2., + width: 32. + border * 2., + height: 32. + border * 2., }; d.draw_rectangle_rec( bounds, @@ -329,7 +327,7 @@ where texture, pos + Vector2::new(border, border), 0., - tex_size / texture.width as f32, + 32. / texture.width as f32, Color::WHITE, ); if mouse.is_over(bounds) {