searchDisplay, appDisplay: Use ClutterPanAction for re-swipe scrolling
The sooner we can kill off the custom overview swipe scroll code, the better. https://bugzilla.gnome.org/show_bug.cgi?id=689062
This commit is contained in:
parent
cb08bd2e2e
commit
5fc16bb05b
@ -48,18 +48,16 @@ const AlphabeticalView = new Lang.Class({
|
|||||||
style_class: 'vfade' });
|
style_class: 'vfade' });
|
||||||
this.actor.add_actor(box);
|
this.actor.add_actor(box);
|
||||||
this.actor.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
|
this.actor.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
|
||||||
this.actor.connect('notify::mapped', Lang.bind(this,
|
let action = new Clutter.PanAction({ interpolate: true });
|
||||||
function() {
|
action.connect('pan', Lang.bind(this, this._onPan));
|
||||||
if (!this.actor.mapped)
|
this.actor.add_action(action);
|
||||||
return;
|
},
|
||||||
|
|
||||||
let adjustment = this.actor.vscroll.adjustment;
|
_onPan: function(action) {
|
||||||
let direction = Overview.SwipeScrollDirection.VERTICAL;
|
let [dist, dx, dy] = action.get_motion_delta(0);
|
||||||
Main.overview.setScrollAdjustment(adjustment, direction);
|
let adjustment = this.actor.vscroll.adjustment;
|
||||||
|
adjustment.value -= (dy / this.actor.height) * adjustment.page_size;
|
||||||
// Reset scroll on mapping
|
return false;
|
||||||
adjustment.value = 0;
|
|
||||||
}));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
removeAll: function() {
|
removeAll: function() {
|
||||||
|
@ -183,26 +183,20 @@ const SearchResults = new Lang.Class({
|
|||||||
this._content = new St.BoxLayout({ name: 'searchResultsContent',
|
this._content = new St.BoxLayout({ name: 'searchResultsContent',
|
||||||
vertical: true });
|
vertical: true });
|
||||||
|
|
||||||
let scrollView = new St.ScrollView({ x_fill: true,
|
this._scrollView = new St.ScrollView({ x_fill: true,
|
||||||
y_fill: false,
|
y_fill: false,
|
||||||
style_class: 'vfade' });
|
style_class: 'vfade' });
|
||||||
scrollView.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
|
this._scrollView.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
|
||||||
scrollView.add_actor(this._content);
|
this._scrollView.add_actor(this._content);
|
||||||
|
let action = new Clutter.PanAction({ interpolate: true });
|
||||||
|
action.connect('pan', Lang.bind(this, this._onPan));
|
||||||
|
this._scrollView.add_action(action);
|
||||||
|
|
||||||
this.actor.add(scrollView, { x_fill: true,
|
this.actor.add(this._scrollView, { x_fill: true,
|
||||||
y_fill: true,
|
y_fill: true,
|
||||||
expand: true,
|
expand: true,
|
||||||
x_align: St.Align.START,
|
x_align: St.Align.START,
|
||||||
y_align: St.Align.START });
|
y_align: St.Align.START });
|
||||||
this.actor.connect('notify::mapped', Lang.bind(this,
|
|
||||||
function() {
|
|
||||||
if (!this.actor.mapped)
|
|
||||||
return;
|
|
||||||
|
|
||||||
let adjustment = scrollView.vscroll.adjustment;
|
|
||||||
let direction = Overview.SwipeScrollDirection.VERTICAL;
|
|
||||||
Main.overview.setScrollAdjustment(adjustment, direction);
|
|
||||||
}));
|
|
||||||
|
|
||||||
this._statusText = new St.Label({ style_class: 'search-statustext' });
|
this._statusText = new St.Label({ style_class: 'search-statustext' });
|
||||||
this._statusBin = new St.Bin({ x_align: St.Align.MIDDLE,
|
this._statusBin = new St.Bin({ x_align: St.Align.MIDDLE,
|
||||||
@ -219,6 +213,13 @@ const SearchResults = new Lang.Class({
|
|||||||
this._defaultResult = null;
|
this._defaultResult = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_onPan: function(action) {
|
||||||
|
let [dist, dx, dy] = action.get_motion_delta(0);
|
||||||
|
let adjustment = this._scrollView.vscroll.adjustment;
|
||||||
|
adjustment.value -= (dy / this.actor.height) * adjustment.page_size;
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
createProviderMeta: function(provider) {
|
createProviderMeta: function(provider) {
|
||||||
let providerBox = new St.BoxLayout({ style_class: 'search-section',
|
let providerBox = new St.BoxLayout({ style_class: 'search-section',
|
||||||
vertical: true });
|
vertical: true });
|
||||||
|
Loading…
Reference in New Issue
Block a user