overviewControls: split out an util function
Will be used later https://bugzilla.gnome.org/show_bug.cgi?id=693924
This commit is contained in:
parent
8ce3531de8
commit
7ed4bd67b8
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user