Skip to content

Commit

Permalink
chore(seach-pad): reduce padding
Browse files Browse the repository at this point in the history
  • Loading branch information
philippfromme authored and nikku committed Sep 25, 2024
1 parent 1f93932 commit 2612d06
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/features/search-pad/SearchPad.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import { isKey } from '../keyboard/KeyboardUtil';
* @typedef {import('./SearchPadProvider').Token} Token
*/

var SCROLL_TO_ELEMENT_PADDING = 300;

/**
* Provides searching infrastructure.
*
Expand Down Expand Up @@ -446,7 +448,7 @@ SearchPad.prototype._preselect = function(node) {
domClasses(node).add(SearchPad.RESULT_SELECTED_CLASS);

this._canvas.scrollToElement(element, {
top: 300
top: SCROLL_TO_ELEMENT_PADDING
});

this._selection.select(element);
Expand All @@ -471,7 +473,9 @@ SearchPad.prototype._select = function(node) {

this.close(false);

this._canvas.scrollToElement(element, { top: 400 });
this._canvas.scrollToElement(element, {
top: SCROLL_TO_ELEMENT_PADDING
});

this._selection.select(element);

Expand Down
2 changes: 1 addition & 1 deletion test/spec/features/search-pad/SearchPadSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ describe('features/searchPad', function() {
// then
var newViewbox = canvas.viewbox();
expect(newViewbox).to.have.property('x', -100);
expect(newViewbox).to.have.property('y', -400);
expect(newViewbox).to.have.property('y', -300);
}));


Expand Down

0 comments on commit 2612d06

Please sign in to comment.