Skip to content

Commit

Permalink
Account for multiple rows when locating clicked thumbnail.
Browse files Browse the repository at this point in the history
  • Loading branch information
mainland committed Sep 25, 2024
1 parent 6ca2b87 commit 5c6027f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions [email protected]/overview/thumbnailsBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,14 @@ const vfunc_allocate = function(box) {
this._indicator.allocate(childBox);
}

const _activateThumbnailAtPoint = function(stageX, stageY, time) {
const [r_, x, y] = this.transform_stage_point(stageX, stageY);

const thumbnail = this._thumbnails.find(t => x >= t.x && x <= t.x + t.width && y >= t.y && y <= t.y + t.height);
if (thumbnail)
thumbnail.activate(time);
}

const _withinWorkspace = function(x, y, index, rtl) {
const length = this._thumbnails.length;
const workspace = this._thumbnails[index];
Expand Down Expand Up @@ -385,6 +393,12 @@ export default class ThumbnailsBox extends Override {
};
});

this._im.overrideMethod(subject, '_activateThumbnailAtPoint', (original) => {
return function () {
return _activateThumbnailAtPoint.call(this, ...arguments);
};
});

this._im.overrideMethod(subject, '_withinWorkspace', (original) => {
return function () {
return _withinWorkspace.call(this, ...arguments);
Expand Down

0 comments on commit 5c6027f

Please sign in to comment.