| 426 | } |
| 427 | |
| 428 | fn mousedown(&self, e: &mut MouseEvent) { |
| 429 | // log::info!("{:?}", e); |
| 430 | // self.state.borrow_mut().mouse_down = true; |
| 431 | // let component = self.component.borrow(); |
| 432 | // component.onmousedown.emit(e); |
| 433 | |
| 434 | // TODO: remove this check |
| 435 | let inside = { |
| 436 | let comp = self.component.borrow(); |
| 437 | Helper::in_rect(e.x as f32, e.y as f32, comp.x, comp.y, comp.w, comp.h) |
| 438 | }; |
| 439 | |
| 440 | // Scaffold should used as root widget after MaterialApp |
| 441 | // so all events should be inside |
| 442 | if inside { |
| 443 | let x = e.x as f32; |
| 444 | let y = e.y as f32; |
| 445 | |
| 446 | if self.leading.contains(x, y) { |
| 447 | log::info!("Is an Leading"); |
| 448 | self.leading.mousedown(e); |
| 449 | } |
| 450 | |
| 451 | if self.middle.contains(x, y) { |
| 452 | log::info!("Is an Title"); |
| 453 | self.middle.mousedown(e); |
| 454 | } |
| 455 | |
| 456 | if self.trailing.contains(x, y) { |
| 457 | // log::info!("Is an FAB"); |
| 458 | self.trailing.mousedown(e); |
| 459 | } |
| 460 | |
| 461 | // for action in self.actions.iter() { |
| 462 | // if action.contains(x, y) { |
| 463 | // log::info!("Is an ACTION"); |
| 464 | // action.mousedown(e); |
| 465 | // } |
| 466 | // } |
| 467 | // if self.drawer.contains(x, y) { |
| 468 | // // log::info!("Is an Drawer"); |
| 469 | // self.drawer.mousedown(e); |
| 470 | // } |
| 471 | } |
| 472 | } |
| 473 | |
| 474 | fn mousemove(&self, e: &mut MouseEvent) { |
| 475 | let inside = Helper::in_rect( |