mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 07:42:23 +02:00
Fix volume button scroll
This commit is contained in:
37
clapper_src/controls.js
vendored
37
clapper_src/controls.js
vendored
@@ -220,10 +220,14 @@ var Controls = GObject.registerClass({
|
|||||||
this.volumeButton = this.addPopoverButton(
|
this.volumeButton = this.addPopoverButton(
|
||||||
'audio-volume-muted-symbolic'
|
'audio-volume-muted-symbolic'
|
||||||
);
|
);
|
||||||
//this.volumeButton.add_events(Gdk.EventMask.SCROLL_MASK);
|
let scrollController = new Gtk.EventControllerScroll();
|
||||||
//this.volumeButton.connect(
|
scrollController.set_flags(
|
||||||
// 'scroll-event', (self, event) => this._onScrollEvent(event)
|
Gtk.EventControllerScrollFlags.VERTICAL
|
||||||
//);
|
| Gtk.EventControllerScrollFlags.DISCRETE
|
||||||
|
);
|
||||||
|
scrollController.connect('scroll', this._onScroll.bind(this));
|
||||||
|
this.volumeButton.add_controller(scrollController);
|
||||||
|
|
||||||
this.volumeScale = new Gtk.Scale({
|
this.volumeScale = new Gtk.Scale({
|
||||||
orientation: Gtk.Orientation.VERTICAL,
|
orientation: Gtk.Orientation.VERTICAL,
|
||||||
inverted: true,
|
inverted: true,
|
||||||
@@ -318,28 +322,15 @@ var Controls = GObject.registerClass({
|
|||||||
this[`${name}Button`].hide();
|
this[`${name}Button`].hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
_onScrollEvent(event)
|
_onScroll(controller, dx, dy)
|
||||||
{
|
{
|
||||||
let [res, direction] = event.get_scroll_direction();
|
let isVertical = Math.abs(dy) >= Math.abs(dx);
|
||||||
if(!res) return;
|
let isIncrease = (isVertical) ? dy < 0 : dx < 0;
|
||||||
|
let type = (isVertical) ? 'volume' : 'position';
|
||||||
|
|
||||||
let type = 'volume';
|
this.handleScaleIncrement(type, isIncrease);
|
||||||
|
|
||||||
switch(direction) {
|
return true;
|
||||||
case Gdk.ScrollDirection.RIGHT:
|
|
||||||
case Gdk.ScrollDirection.LEFT:
|
|
||||||
type = 'position';
|
|
||||||
case Gdk.ScrollDirection.UP:
|
|
||||||
case Gdk.ScrollDirection.DOWN:
|
|
||||||
let isUp = (
|
|
||||||
direction === Gdk.ScrollDirection.UP
|
|
||||||
|| direction === Gdk.ScrollDirection.RIGHT
|
|
||||||
);
|
|
||||||
this.handleScaleIncrement(type, isUp);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_onDestroy()
|
_onDestroy()
|
||||||
|
@@ -20,8 +20,9 @@ class ClapperHeaderBar extends Gtk.HeaderBar
|
|||||||
let subtitle = mediaInfo.get_uri() || null;
|
let subtitle = mediaInfo.get_uri() || null;
|
||||||
|
|
||||||
if(subtitle && subtitle.startsWith('file://')) {
|
if(subtitle && subtitle.startsWith('file://')) {
|
||||||
subtitle = GLib.filename_from_uri(subtitle)[0];
|
subtitle = GLib.path_get_basename(
|
||||||
subtitle = GLib.path_get_basename(subtitle);
|
GLib.filename_from_uri(subtitle)[0]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!title) {
|
if(!title) {
|
||||||
|
Reference in New Issue
Block a user