From 2656762cbc8a6ad210145c623b825a1121f3503e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Mon, 23 Aug 2021 15:57:11 +0200 Subject: [PATCH] Fix chapter popover coordinates --- src/controls.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/controls.js b/src/controls.js index 5eea6ff0..356ac9d3 100644 --- a/src/controls.js +++ b/src/controls.js @@ -435,12 +435,19 @@ class ClapperControls extends Gtk.Box if(isVisible) { const [start, end] = this.positionScale.get_slider_range(); const controlsHeight = this.parent.get_height(); - const scaleHeight = this.positionScale.parent.get_height(); + const scaleBoxHeight = this.positionScale.parent.get_height(); + const [isShared, destX, destY] = this.positionScale.translate_coordinates( + this.positionScale.parent, 0, 0 + ); + + /* Half of slider width, values are defined in CSS */ + const sliderOffset = (this.isFullscreen && !this.isMobile) + ? 10 : 9; this.chapterPopover.set_pointing_to(new Gdk.Rectangle({ - x: -2, - y: -(controlsHeight - scaleHeight) / 2, - width: 2 * end, + x: destX + end - sliderOffset, + y: -(controlsHeight - scaleBoxHeight) / 2, + width: 0, height: 0, })); }