Skip to content

Commit

Permalink
squeezimize: Update animation geometry each frame
Browse files Browse the repository at this point in the history
This makes it so it doesn't get the wrong clipping area when other
transformations are applied.
  • Loading branch information
soreau committed Jul 28, 2024
1 parent 4120b04 commit caab7e2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions plugins/animate/squeezimize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,19 @@ class squeezimize_transformer : public wf::scene::view_2d_transformer_t
0.0f, 1.0f,
};

self->animation_geometry.x = std::min(src_box.x, self->minimize_target.x);
self->animation_geometry.y = std::min(src_box.y, self->minimize_target.y);
self->animation_geometry.width =
std::max(std::max(std::max(src_box.width,
self->minimize_target.width),
(self->minimize_target.x + self->minimize_target.width) - src_box.x),
(src_box.x + src_box.width) - self->minimize_target.x);
self->animation_geometry.height =
std::max(std::max(std::max(src_box.height,
self->minimize_target.height),
(self->minimize_target.y + self->minimize_target.height) - src_box.y),
(src_box.y + src_box.height) - self->minimize_target.y);

const float vertex_data_pos[] = {
1.0f * self->animation_geometry.x,
1.0f * self->animation_geometry.y + self->animation_geometry.height,
Expand Down

0 comments on commit caab7e2

Please sign in to comment.