--- a/plugins/cube/cube.cpp +++ b/plugins/cube/cube.cpp @@ -1262,6 +1262,21 @@ glm::vec3(0., 1., 0.)); animation.view = zoom_translate * rotation * view; + if (mouse_overview_active) + { + const float pitch = animation.cube_animation.offset_y; + const float zoom = animation.cube_animation.zoom; + const float rows = output->wset()->get_workspace_grid_size().height; + const float center = ((rows - 1) / 2 - float(overview_row)) / zoom; + auto pivot = glm::translate(glm::mat4(1.0), glm::vec3(0, center, 0)); + auto unpivot = glm::translate(glm::mat4(1.0), glm::vec3(0, -center, 0)); + // Orbit the complete stack about its middle. Move the camera back + // as its height turns into depth, keeping the near faces visible. + const float distance = float(animation.cube_animation.offset_z) + + std::abs(std::sin(pitch)) * rows / (2 * zoom); + zoom_translate = glm::translate(glm::mat4(1.0), glm::vec3(0, 0, -distance)); + animation.view = zoom_translate * pivot * rotation * unpivot * view; + } } glm::mat4 output_transform(const wf::render_target_t& target) @@ -1489,10 +1504,14 @@ double xdiff = ev->delta_x; double ydiff = ev->delta_y * -1.0; - // The overview stays level and on its current workspace row. Pure - // vertical motion must not restart animations or wake a settled cube. - if (mouse_overview_active && (xdiff == 0)) - { + const double current_off_y = animation.cube_animation.offset_y; + const double target_off_y = mouse_overview_active ? + animation.cube_animation.offset_y.end : current_off_y; + const double off_y = wf::clamp(target_off_y + ydiff * YVelocity, -1.5, 1.5); + if (mouse_overview_active && (xdiff == 0) && + (off_y == animation.cube_animation.offset_y.end)) + { + // Motion beyond either tilt limit leaves a settled stack asleep. return; } @@ -1502,13 +1521,8 @@ if (mouse_overview_active) { overview_mix.restart_with_end(1); - animation.cube_animation.offset_y.set(0, 0); - } else - { - double current_off_y = animation.cube_animation.offset_y; - double off_y = wf::clamp(current_off_y + ydiff * YVelocity, -1.5, 1.5); - animation.cube_animation.offset_y.set(current_off_y, off_y); - } + } + animation.cube_animation.offset_y.set(current_off_y, off_y); animation.cube_animation.offset_z.restart_with_end( animation.cube_animation.offset_z.end); --- a/metadata/cube.xml +++ b/metadata/cube.xml @@ -69,7 +69,7 @@ <_short>Mouse overview @@ -131,7 +131,7 @@ <_short>Zoom speed <_long>Sets the speed factor for zooming. 0.07 - 0.01 + 0.001