Skip to content

Commit

Permalink
fix(MediaViewer): scale revealer dismiss widget when using the page b…
Browse files Browse the repository at this point in the history
…uttons (#872)
  • Loading branch information
GeopJr committed Mar 24, 2024
1 parent abc5297 commit 8ce515d
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/Views/MediaViewer.vala
Expand Up @@ -476,15 +476,10 @@ public class Tuba.Views.MediaViewer : Gtk.Widget, Gtk.Buildable, Adw.Swipeable {
enabled = true,
allow_mouse_drag = true
};
swipe_tracker.prepare.connect (on_swipe_tracker_prepare);
swipe_tracker.update_swipe.connect (on_update_swipe);
swipe_tracker.end_swipe.connect (on_end_swipe);
}

private void on_swipe_tracker_prepare (Adw.NavigationDirection direction) {
update_revealer_widget ();
}

private void on_update_swipe (double progress) {
this.swipe_children_opacity = 0.0;
this.swipe_progress = progress;
Expand Down Expand Up @@ -791,9 +786,10 @@ public class Tuba.Views.MediaViewer : Gtk.Widget, Gtk.Buildable, Adw.Swipeable {
revealed = false;
}

private void update_revealer_widget () {
if (revealed && revealer_widgets.has_key ((int) carousel.position))
scale_revealer.source_widget = revealer_widgets.get ((int) carousel.position);
private void update_revealer_widget (int pos = -1) {
int new_pos = pos == -1 ? (int) carousel.position : pos;
if (revealed && revealer_widgets.has_key (new_pos))
scale_revealer.source_widget = revealer_widgets.get (new_pos);
}

private async string download_video (string url) throws Error {
Expand Down Expand Up @@ -940,6 +936,8 @@ public class Tuba.Views.MediaViewer : Gtk.Widget, Gtk.Buildable, Adw.Swipeable {
}

private void on_carousel_page_changed (uint pos) {
update_revealer_widget ((int) pos);

prev_btn.sensitive = pos > 0;
next_btn.sensitive = pos < items.size - 1;

Expand Down

0 comments on commit 8ce515d

Please sign in to comment.