mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-29 23:32:04 +02:00
controls: Use isFullscreen and isMobile from main widget
The "controls.isMobile" was used incorrectly here as it holds value if controls are in mobile mode, not if running on mobile screen. Use those values from clapper main widget instead. This fixes incorrect chapter popover placement on mobile screens. Also handle fine-tune in CSS as this code path is hit multiple times when starting/stopping slider drag.
This commit is contained in:
@@ -187,6 +187,14 @@ scale trough slider {
|
||||
.positionscale trough highlight {
|
||||
min-height: 6px;
|
||||
}
|
||||
.fullscreen.tvmode .positionscale {
|
||||
padding-left: 12px;
|
||||
padding-right: 12px;
|
||||
}
|
||||
.fullscreen.tvmode .positionscale.fine-tune {
|
||||
padding-left: 12px;
|
||||
padding-right: 12px;
|
||||
}
|
||||
.fullscreen.tvmode .positionscale trough slider {
|
||||
color: transparent;
|
||||
background: transparent;
|
||||
|
19
src/controls.js
vendored
19
src/controls.js
vendored
@@ -27,7 +27,6 @@ class ClapperControls extends Gtk.Box
|
||||
this.currentPosition = 0;
|
||||
this.isPositionDragging = false;
|
||||
this.isMobile = false;
|
||||
this.isFullscreen = false;
|
||||
|
||||
this.showHours = false;
|
||||
this.durationFormatted = '00:00';
|
||||
@@ -120,7 +119,6 @@ class ClapperControls extends Gtk.Box
|
||||
this.subtitleTracksButton.setFullscreenMode(isFullscreen, isMobileMonitor);
|
||||
|
||||
this.unfullscreenButton.visible = isFullscreen;
|
||||
this.isFullscreen = isFullscreen;
|
||||
}
|
||||
|
||||
setLiveMode(isLive, isSeekable)
|
||||
@@ -348,10 +346,12 @@ class ClapperControls extends Gtk.Box
|
||||
const [isShared, destX, destY] = this.positionScale.translate_coordinates(
|
||||
this.positionScale.parent, 0, 0
|
||||
);
|
||||
const clapperWidget = this.get_ancestor(Gtk.Grid);
|
||||
|
||||
/* Half of slider width, values are defined in CSS */
|
||||
const sliderOffset = (this.isFullscreen && !this.isMobile)
|
||||
? 10 : 9;
|
||||
const sliderOffset = (
|
||||
clapperWidget.isFullscreenMode && !clapperWidget.isMobileMonitor
|
||||
) ? 10 : 9;
|
||||
|
||||
this.chapterPopover.set_pointing_to(new Gdk.Rectangle({
|
||||
x: destX + end - sliderOffset,
|
||||
@@ -466,22 +466,13 @@ class ClapperControls extends Gtk.Box
|
||||
{
|
||||
const isPositionDragging = scale.has_css_class('dragging');
|
||||
|
||||
/* When scale enters "fine-tune", slider changes position a little.
|
||||
* We do not want that to cause seek time change on TV mode */
|
||||
if(
|
||||
this.isFullscreen
|
||||
&& !this.isMobile
|
||||
&& scale.has_css_class('fine-tune')
|
||||
)
|
||||
scale.remove_css_class('fine-tune');
|
||||
|
||||
if(this.isPositionDragging === isPositionDragging)
|
||||
return;
|
||||
|
||||
const clapperWidget = this.get_ancestor(Gtk.Grid);
|
||||
if(!clapperWidget) return;
|
||||
|
||||
if(this.isFullscreen) {
|
||||
if(clapperWidget.isFullscreenMode) {
|
||||
clapperWidget.revealControls();
|
||||
|
||||
if(isPositionDragging)
|
||||
|
Reference in New Issue
Block a user