(&self)
| 235 | //Refresh all relevant values |
| 236 | |
| 237 | fn update_scroll(&self) { |
| 238 | let mut state = self.state.borrow_mut(); |
| 239 | if !state.ready { |
| 240 | return; |
| 241 | } |
| 242 | |
| 243 | let mut dy = self.h() - self.container.h(); |
| 244 | let mut dx = self.w() - self.container.w(); |
| 245 | |
| 246 | state.visible_h = dx < 0.0; |
| 247 | state.visible_v = dy < 0.0; |
| 248 | |
| 249 | if dx >= 0.0 { |
| 250 | dx = 0.0; |
| 251 | } |
| 252 | |
| 253 | if dy >= 0.0 { |
| 254 | dy = 0.0; |
| 255 | } |
| 256 | |
| 257 | self.container.set_x(self.x() + (dx * state.percent_h)); |
| 258 | self.container.set_y(self.y() + (dy * state.percent_v)); |
| 259 | |
| 260 | self.scrollh |
| 261 | .set_x(self.x() + (state.percent_h * (self.w() - self.scrollh.w()))); |
| 262 | self.scrollv |
| 263 | .set_y(self.y() + (state.percent_v * (self.h() - self.scrollv.h()))); |
| 264 | |
| 265 | self.onchange.emit(&()); |
| 266 | self.onhandlevis.emit(&ScrollHandleVisibleEvent { |
| 267 | horizontal: state.visible_h, |
| 268 | vertical: state.visible_v, |
| 269 | }); |
| 270 | } |
| 271 | |
| 272 | #[inline] |
| 273 | pub fn step_h(&self) -> f32 { |
no test coverage detected