mirror of
				https://github.com/Rafostar/clapper.git
				synced 2025-10-31 18:35:38 +01:00 
			
		
		
		
	Add slide animation for fullscreen controls
This commit is contained in:
		| @@ -69,7 +69,7 @@ var App = GObject.registerClass({ | |||||||
|             this.hideControlsTimeout = null; |             this.hideControlsTimeout = null; | ||||||
|  |  | ||||||
|             if(this.window.isFullscreen) |             if(this.window.isFullscreen) | ||||||
|                 this.interface.controls.hide(); |                 this.interface.revealControls(false); | ||||||
|  |  | ||||||
|             return GLib.SOURCE_REMOVE; |             return GLib.SOURCE_REMOVE; | ||||||
|         }); |         }); | ||||||
| @@ -152,9 +152,10 @@ var App = GObject.registerClass({ | |||||||
|             ? this.interface.controls.unfullscreenImage |             ? this.interface.controls.unfullscreenImage | ||||||
|             : this.interface.controls.fullscreenImage; |             : this.interface.controls.fullscreenImage; | ||||||
|  |  | ||||||
|         if(isFullscreen) |         if(isFullscreen) { | ||||||
|  |             this.interface.showControls(true); | ||||||
|             this.setHideControlsTimeout(); |             this.setHideControlsTimeout(); | ||||||
|  |         } | ||||||
|         this.interface.setControlsOnVideo(isFullscreen); |         this.interface.setControlsOnVideo(isFullscreen); | ||||||
|         this.interface.controls.setVolumeMarks(true); |         this.interface.controls.setVolumeMarks(true); | ||||||
|     } |     } | ||||||
| @@ -343,7 +344,7 @@ var App = GObject.registerClass({ | |||||||
|  |  | ||||||
|         if(this.window.isFullscreen) { |         if(this.window.isFullscreen) { | ||||||
|             this.setHideControlsTimeout(); |             this.setHideControlsTimeout(); | ||||||
|             this.interface.controls.show(); |             this.interface.revealControls(true); | ||||||
|         } |         } | ||||||
|         else if(this.hideControlsTimeout) { |         else if(this.hideControlsTimeout) { | ||||||
|             GLib.source_remove(this.hideControlsTimeout); |             GLib.source_remove(this.hideControlsTimeout); | ||||||
|   | |||||||
| @@ -21,9 +21,15 @@ class ClapperInterface extends Gtk.Grid | |||||||
|         this.controlsInVideo = false; |         this.controlsInVideo = false; | ||||||
|         this.lastVolumeValue = null; |         this.lastVolumeValue = null; | ||||||
|         this.lastPositionValue = 0; |         this.lastPositionValue = 0; | ||||||
|  |         this.revealTime = 800; | ||||||
|  |  | ||||||
|         this.overlay = new Gtk.Overlay(); |         this.overlay = new Gtk.Overlay(); | ||||||
|         this.controls = new Controls(); |         this.controls = new Controls(); | ||||||
|  |         this.revealer= new Gtk.Revealer({ | ||||||
|  |             transition_duration: this.revealTime, | ||||||
|  |             transition_type: Gtk.RevealerTransitionType.SLIDE_UP, | ||||||
|  |             valign: Gtk.Align.END, | ||||||
|  |         }); | ||||||
|  |  | ||||||
|         this.attach(this.overlay, 0, 0, 1, 1); |         this.attach(this.overlay, 0, 0, 1, 1); | ||||||
|         this.attach(this.controls, 0, 1, 1, 1); |         this.attach(this.controls, 0, 1, 1, 1); | ||||||
| @@ -55,6 +61,20 @@ class ClapperInterface extends Gtk.Grid | |||||||
|         this.overlay.add(this._player.widget); |         this.overlay.add(this._player.widget); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     revealControls(isReveal) | ||||||
|  |     { | ||||||
|  |         this.revealer.set_transition_duration(this.revealTime); | ||||||
|  |         this.revealer.set_transition_type(Gtk.RevealerTransitionType.SLIDE_UP); | ||||||
|  |         this.revealer.set_reveal_child(isReveal); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     showControls(isShow) | ||||||
|  |     { | ||||||
|  |         this.revealer.set_transition_duration(0); | ||||||
|  |         this.revealer.set_transition_type(Gtk.RevealerTransitionType.NONE); | ||||||
|  |         this.revealer.set_reveal_child(isShow); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     setControlsOnVideo(isOnVideo) |     setControlsOnVideo(isOnVideo) | ||||||
|     { |     { | ||||||
|         if(isOnVideo && !this.controlsInVideo) { |         if(isOnVideo && !this.controlsInVideo) { | ||||||
| @@ -62,10 +82,13 @@ class ClapperInterface extends Gtk.Grid | |||||||
|             this.controls.margin = 8; |             this.controls.margin = 8; | ||||||
|             this.controls.margin_start = 10; |             this.controls.margin_start = 10; | ||||||
|             this.controls.margin_end = 10; |             this.controls.margin_end = 10; | ||||||
|             this.overlay.add_overlay(this.controls); |             this.overlay.add_overlay(this.revealer); | ||||||
|  |             this.revealer.add(this.controls); | ||||||
|  |             this.revealer.show(); | ||||||
|         } |         } | ||||||
|         else if(!isOnVideo && this.controlsInVideo) { |         else if(!isOnVideo && this.controlsInVideo) { | ||||||
|             this.overlay.remove(this.controls); |             this.revealer.remove(this.controls); | ||||||
|  |             this.overlay.remove(this.revealer); | ||||||
|             this.controls.margin = 4; |             this.controls.margin = 4; | ||||||
|             this.attach(this.controls, 0, 1, 1, 1); |             this.attach(this.controls, 0, 1, 1, 1); | ||||||
|             this.controls.show(); |             this.controls.show(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user