Revert "appDisplay: Bring back drag overshoot region"
With MR https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335, the page navigation in the app grid was redone and prominent, always visible navigation arrows were added. This larger change in the navigation of the app grid also involved changes to the drag and drop behavior. Before those changes (in GNOME 42), switching pages during DND in the app grid worked like this: By "bumping" the cursor against the monitor/appGrid edge, an immediate page switch would be triggered. Leaving the cursor in that edge area would then trigger repeated page switches every second. By repeating the "bump" gesture (moving cursor back into the grid, then "bumping" against the edge again), it was possible to switch pages even faster than every second. When adding the always visible navigation arrows, we briefly tried out a different way of page-switching during DND with commit09b975fa
: The "bump against monitor edge" gesture (or "overshoot" behavior as it's called in the code) was replaced with a hover timeout on the navigation arrows. The idea behind that was to allow hovering the navigation arrow during DND to eventually trigger a page switch, which also makes sense. The replacement of the "overshoot" behavior made some people unhappy though, so it was decided to bring back the old "overshoot" behavior with commit4dcae8dd
. Due to time pressure before the release that didn't go very well and we ended up with a mixup of both approaches that doesn't feel too polished. So let's try to fix that by first going back to the working "overshoot" implementation as it was in 42, then slightly refactoring that implementation, to finally incorporate the new "page indicator hover" behavior that https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335 originally intended to use. This reverts commit4dcae8ddd2
. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2581>
This commit is contained in:
parent
dc3ee1a9a2
commit
272c770815
@ -844,23 +844,6 @@ var BaseAppView = GObject.registerClass({
|
|||||||
this._overshootTimeoutId = 0;
|
this._overshootTimeoutId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
_dragWithinOvershootRegion(dragEvent) {
|
|
||||||
const rtl = this.get_text_direction() === Clutter.TextDirection.RTL;
|
|
||||||
const {x, y, targetActor: indicator} = dragEvent;
|
|
||||||
const [indicatorX, indicatorY] = indicator.get_transformed_position();
|
|
||||||
const [indicatorWidth, indicatorHeight] = indicator.get_transformed_size();
|
|
||||||
|
|
||||||
let overshootX = indicatorX;
|
|
||||||
if (indicator === this._nextPageIndicator || rtl)
|
|
||||||
overshootX += indicatorWidth - OVERSHOOT_THRESHOLD;
|
|
||||||
|
|
||||||
const overshootBox = new Clutter.ActorBox();
|
|
||||||
overshootBox.set_origin(overshootX, indicatorY);
|
|
||||||
overshootBox.set_size(OVERSHOOT_THRESHOLD, indicatorHeight);
|
|
||||||
|
|
||||||
return overshootBox.contains(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
_handleDragOvershoot(dragEvent) {
|
_handleDragOvershoot(dragEvent) {
|
||||||
// Already animating
|
// Already animating
|
||||||
if (this._adjustment.get_transition('value') !== null)
|
if (this._adjustment.get_transition('value') !== null)
|
||||||
@ -886,13 +869,6 @@ var BaseAppView = GObject.registerClass({
|
|||||||
if (targetPage < 0 || targetPage >= this._grid.nPages)
|
if (targetPage < 0 || targetPage >= this._grid.nPages)
|
||||||
return; // don't go beyond first/last page
|
return; // don't go beyond first/last page
|
||||||
|
|
||||||
// If dragging over the drag overshoot threshold region, immediately
|
|
||||||
// switch pages
|
|
||||||
if (this._dragWithinOvershootRegion(dragEvent)) {
|
|
||||||
this._resetOvershoot();
|
|
||||||
this.goToPage(targetPage);
|
|
||||||
}
|
|
||||||
|
|
||||||
this._overshootTimeoutId =
|
this._overshootTimeoutId =
|
||||||
GLib.timeout_add(GLib.PRIORITY_DEFAULT, OVERSHOOT_TIMEOUT, () => {
|
GLib.timeout_add(GLib.PRIORITY_DEFAULT, OVERSHOOT_TIMEOUT, () => {
|
||||||
this._resetOvershoot();
|
this._resetOvershoot();
|
||||||
|
Loading…
Reference in New Issue
Block a user