overviewControls: Add an accessor for the visible-width property

To add a geometry that's independent of the slide factor of the workspace,
we need to get this from outside the sliding control.

https://bugzilla.gnome.org/show_bug.cgi?id=694469
This commit is contained in:
Jasper St. Pierre 2013-04-20 12:29:58 -04:00
parent 58872d162b
commit fc53a25a4c

View File

@ -271,6 +271,11 @@ const ThumbnailsSlider = new Lang.Class({
return alwaysZoomOut; return alwaysZoomOut;
}, },
getNonExpandedWidth: function() {
let child = this.actor.get_first_child();
return child.get_theme_node().get_length('visible-width');
},
getSlide: function() { getSlide: function() {
if (!this.visible) if (!this.visible)
return 0; return 0;
@ -282,18 +287,16 @@ const ThumbnailsSlider = new Lang.Class({
let child = this.actor.get_first_child(); let child = this.actor.get_first_child();
let preferredHeight = child.get_preferred_height(-1)[1]; let preferredHeight = child.get_preferred_height(-1)[1];
let expandedWidth = child.get_preferred_width(preferredHeight)[1]; let expandedWidth = child.get_preferred_width(preferredHeight)[1];
let visibleWidth = child.get_theme_node().get_length('visible-width');
return visibleWidth / expandedWidth; return this.getNonExpandedWidth() / expandedWidth;
}, },
getVisibleWidth: function() { getVisibleWidth: function() {
let alwaysZoomOut = this._getAlwaysZoomOut(); let alwaysZoomOut = this._getAlwaysZoomOut();
if (alwaysZoomOut) if (alwaysZoomOut)
return this.parent(); return this.parent();
else
let child = this.actor.get_first_child(); return this.getNonExpandedWidth();
return child.get_theme_node().get_length('visible-width');
} }
}); });