Initiate with an button grab. */
| 474 | |
| 475 | /* Initiate with an button grab. */ |
| 476 | bool input_grabbed() |
| 477 | { |
| 478 | if (!activate()) |
| 479 | { |
| 480 | return false; |
| 481 | } |
| 482 | |
| 483 | /* Rotations, offset_y and zoom stay as they are now, as they have been |
| 484 | * grabbed. |
| 485 | * offset_z changes to the default one. |
| 486 | * |
| 487 | * We also need to make sure the cube gets deformed */ |
| 488 | animation.in_exit = false; |
| 489 | float current_rotation = animation.cube_animation.rotation; |
| 490 | float current_offset_y = animation.cube_animation.offset_y; |
| 491 | float current_zoom = animation.cube_animation.zoom; |
| 492 | |
| 493 | animation.cube_animation.rotation.set(current_rotation, current_rotation); |
| 494 | animation.cube_animation.offset_y.set(current_offset_y, current_offset_y); |
| 495 | animation.cube_animation.offset_z.restart_with_end( |
| 496 | zoom_opt + identity_z_offset + Z_OFFSET_NEAR); |
| 497 | |
| 498 | animation.cube_animation.zoom.set(current_zoom, current_zoom); |
| 499 | animation.cube_animation.ease_deformation.restart_with_end(1); |
| 500 | |
| 501 | animation.cube_animation.start(); |
| 502 | |
| 503 | update_view_matrix(); |
| 504 | output->render->schedule_redraw(); |
| 505 | |
| 506 | // Let the button go to the input grab |
| 507 | return false; |
| 508 | } |
| 509 | |
| 510 | /* Mouse grab was released */ |
| 511 | void input_ungrabbed() |
no test coverage detected