mirror of
https://github.com/elementary/gala.git
synced 2024-12-18 23:02:14 +03:00
workspaceview: clean up scroll_event
This commit is contained in:
parent
6380b27b7f
commit
c830c38da1
@ -22,6 +22,7 @@ namespace Gala
|
|||||||
public class WorkspaceView : Clutter.Actor
|
public class WorkspaceView : Clutter.Actor
|
||||||
{
|
{
|
||||||
static const float VIEW_HEIGHT = 140.0f;
|
static const float VIEW_HEIGHT = 140.0f;
|
||||||
|
static const float SCROLL_SPEED = 30.0f;
|
||||||
|
|
||||||
Gala.Plugin plugin;
|
Gala.Plugin plugin;
|
||||||
Screen screen;
|
Screen screen;
|
||||||
@ -337,16 +338,23 @@ namespace Gala
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float scroll_speed = 30.0f;
|
|
||||||
public override bool scroll_event (Clutter.ScrollEvent event)
|
public override bool scroll_event (Clutter.ScrollEvent event)
|
||||||
{
|
{
|
||||||
if ((event.direction == Clutter.ScrollDirection.DOWN || event.direction == Clutter.ScrollDirection.RIGHT)
|
switch (event.direction) {
|
||||||
&& thumbnails.width + thumbnails.x > width) { //left
|
case Clutter.ScrollDirection.DOWN:
|
||||||
thumbnails.x -= scroll_speed;
|
case Clutter.ScrollDirection.RIGHT:
|
||||||
} else if ((event.direction == Clutter.ScrollDirection.UP || event.direction == Clutter.ScrollDirection.LEFT)
|
if (thumbnails.width + thumbnails.x > width)
|
||||||
&& thumbnails.x < 0) { //right
|
thumbnails.x -= SCROLL_SPEED;
|
||||||
thumbnails.x += scroll_speed;
|
break;
|
||||||
|
case Clutter.ScrollDirection.UP:
|
||||||
|
case Clutter.ScrollDirection.LEFT:
|
||||||
|
if (thumbnails.x < 0)
|
||||||
|
thumbnails.x += SCROLL_SPEED;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
scroll.x = Math.floorf (width / thumbnails.width * -thumbnails.x);
|
scroll.x = Math.floorf (width / thumbnails.width * -thumbnails.x);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user