mirror of
https://github.com/elementary/gala.git
synced 2024-11-28 04:05:22 +03:00
add delay before expading an inserter preview
This commit is contained in:
parent
bf65d00e39
commit
6f03fc536b
@ -22,9 +22,13 @@ namespace Gala
|
|||||||
{
|
{
|
||||||
public class WorkspaceInsertThumb : Actor
|
public class WorkspaceInsertThumb : Actor
|
||||||
{
|
{
|
||||||
|
const int EXPAND_DELAY = 300;
|
||||||
|
|
||||||
public int workspace_index { get; construct set; }
|
public int workspace_index { get; construct set; }
|
||||||
public bool expanded { get; private set; default = false; }
|
public bool expanded { get; private set; default = false; }
|
||||||
|
|
||||||
|
uint expand_timeout = 0;
|
||||||
|
|
||||||
public WorkspaceInsertThumb (int workspace_index)
|
public WorkspaceInsertThumb (int workspace_index)
|
||||||
{
|
{
|
||||||
Object (workspace_index: workspace_index);
|
Object (workspace_index: workspace_index);
|
||||||
@ -43,23 +47,15 @@ namespace Gala
|
|||||||
if (!Prefs.get_dynamic_workspaces ())
|
if (!Prefs.get_dynamic_workspaces ())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
save_easing_state ();
|
|
||||||
set_easing_mode (AnimationMode.EASE_OUT_QUAD);
|
|
||||||
set_easing_duration (200);
|
|
||||||
|
|
||||||
if (!hovered) {
|
if (!hovered) {
|
||||||
remove_transition ("pulse");
|
if (expand_timeout != 0) {
|
||||||
opacity = 0;
|
Source.remove (expand_timeout);
|
||||||
width = IconGroupContainer.SPACING;
|
expand_timeout = 0;
|
||||||
expanded = false;
|
}
|
||||||
} else {
|
|
||||||
add_pulse_animation ();
|
|
||||||
opacity = 200;
|
|
||||||
width = IconGroupContainer.GROUP_WIDTH + IconGroupContainer.SPACING * 2;
|
|
||||||
expanded = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
restore_easing_state ();
|
transform (false);
|
||||||
|
} else
|
||||||
|
expand_timeout = Timeout.add (EXPAND_DELAY, expand);
|
||||||
});
|
});
|
||||||
|
|
||||||
add_action (drop);
|
add_action (drop);
|
||||||
@ -74,6 +70,36 @@ namespace Gala
|
|||||||
add_child (icon);
|
add_child (icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool expand ()
|
||||||
|
{
|
||||||
|
expand_timeout = 0;
|
||||||
|
|
||||||
|
transform (true);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void transform (bool expand)
|
||||||
|
{
|
||||||
|
save_easing_state ();
|
||||||
|
set_easing_mode (AnimationMode.EASE_OUT_QUAD);
|
||||||
|
set_easing_duration (200);
|
||||||
|
|
||||||
|
if (!expand) {
|
||||||
|
remove_transition ("pulse");
|
||||||
|
opacity = 0;
|
||||||
|
width = IconGroupContainer.SPACING;
|
||||||
|
expanded = false;
|
||||||
|
} else {
|
||||||
|
add_pulse_animation ();
|
||||||
|
opacity = 200;
|
||||||
|
width = IconGroupContainer.GROUP_WIDTH + IconGroupContainer.SPACING * 2;
|
||||||
|
expanded = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
restore_easing_state ();
|
||||||
|
}
|
||||||
|
|
||||||
void add_pulse_animation ()
|
void add_pulse_animation ()
|
||||||
{
|
{
|
||||||
var transition = new TransitionGroup ();
|
var transition = new TransitionGroup ();
|
||||||
|
Loading…
Reference in New Issue
Block a user