[gnome-shell] overviewControls: split out an util function
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] overviewControls: split out an util function
- Date: Sat, 16 Feb 2013 04:47:53 +0000 (UTC)
commit 7ed4bd67b87f0876ab6a16c83f11ef2f41f05ea6
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri Feb 15 20:43:01 2013 -0500
overviewControls: split out an util function
Will be used later
https://bugzilla.gnome.org/show_bug.cgi?id=693924
js/ui/overviewControls.js | 22 ++++++++++------------
1 files changed, 10 insertions(+), 12 deletions(-)
---
diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js
index dce5ca1..cde6bde 100644
--- a/js/ui/overviewControls.js
+++ b/js/ui/overviewControls.js
@@ -10,6 +10,15 @@ const ViewSelector = imports.ui.viewSelector;
const SIDE_CONTROLS_ANIMATION_TIME = 0.2;
+function getRtlSlideDirection(direction, actor) {
+ let rtl = (actor.text_direction == Clutter.TextDirection.RTL);
+ if (rtl)
+ direction = (direction == SlideDirection.LEFT) ?
+ SlideDirection.RIGHT : SlideDirection.LEFT;
+
+ return direction;
+};
+
const SlideDirection = {
LEFT: 0,
RIGHT: 1
@@ -26,17 +35,6 @@ const SlideLayout = new Lang.Class({
this.parent(params);
},
- _getRealSlideDirection: function(child) {
- let direction = this._direction;
-
- let rtl = (child.text_direction == Clutter.TextDirection.RTL);
- if (rtl)
- direction = (direction == SlideDirection.LEFT) ?
- SlideDirection.RIGHT : SlideDirection.LEFT;
-
- return direction;
- },
-
vfunc_get_preferred_width: function(container, forHeight) {
let child = container.get_first_child();
@@ -55,7 +53,7 @@ const SlideLayout = new Lang.Class({
let availWidth = Math.round(box.x2 - box.x1);
let availHeight = Math.round(box.y2 - box.y1);
- let realDirection = this._getRealSlideDirection(child);
+ let realDirection = getRtlSlideDirection(this._direction, child);
let translationX = (realDirection == SlideDirection.LEFT) ?
(availWidth - natWidth) : (natWidth - availWidth);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]