(&mut self, button: MouseButton, is_down: bool)
| 190 | /// Apply a mouse button transition and update one-frame edges. |
| 191 | #[inline] |
| 192 | pub fn set_button_state(&mut self, button: MouseButton, is_down: bool) { |
| 193 | let bit = button.bit(); |
| 194 | let was_down = self.down & bit != 0; |
| 195 | |
| 196 | if is_down { |
| 197 | if !was_down { |
| 198 | self.down |= bit; |
| 199 | self.pressed |= bit; |
| 200 | } |
| 201 | } else if was_down { |
| 202 | self.down &= !bit; |
| 203 | self.released |= bit; |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | /// Add relative mouse movement in pixels. |
| 208 | #[inline] |
no test coverage detected