mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) Fix drag selection bug in add row
Summary: Relaxes selection restrictions on the add row, which was causing a bug where the row above the add row was also being selected whenever drag selection was started from the add row. Test Plan: Browser test. Reviewers: jarek Reviewed By: jarek Differential Revision: https://phab.getgrist.com/D4253
This commit is contained in:
parent
a6ffa6096a
commit
31722de2eb
@ -1058,11 +1058,14 @@ GridView.prototype.getMousePosRow = function (yCoord) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the row index of the row whose top offset is closest to and
|
* Returns the row index of the row whose top offset is closest to and
|
||||||
* no greater than given y-position excluding addRows.
|
* no greater than given y-position.
|
||||||
* param{yCoord}: The mouse y-position on the screen.
|
* param{yCoord}: The mouse y-position on the screen.
|
||||||
**/
|
**/
|
||||||
GridView.prototype.currentMouseRow = function(yCoord) {
|
GridView.prototype.currentMouseRow = function(yCoord) {
|
||||||
return Math.min(this.getMousePosRow(this.scrollTop() + yCoord), Math.max(0, this.getLastDataRowIndex()));
|
return Math.min(
|
||||||
|
this.getMousePosRow(this.scrollTop() + yCoord),
|
||||||
|
Math.max(0, this.getLastDataRowIndex() + 1)
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1501,8 +1504,7 @@ GridView.prototype.buildDom = function() {
|
|||||||
dom.on('mousedown', () => false),
|
dom.on('mousedown', () => false),
|
||||||
testId('row-menu-trigger'),
|
testId('row-menu-trigger'),
|
||||||
),
|
),
|
||||||
kd.toggleClass('selected', () =>
|
kd.toggleClass('selected', () => self.cellSelector.isRowSelected(row._index())),
|
||||||
!row._isAddRow() && self.cellSelector.isRowSelected(row._index())),
|
|
||||||
),
|
),
|
||||||
dom('div.record',
|
dom('div.record',
|
||||||
kd.toggleClass('record-add', row._isAddRow),
|
kd.toggleClass('record-add', row._isAddRow),
|
||||||
@ -1557,8 +1559,7 @@ GridView.prototype.buildDom = function() {
|
|||||||
});
|
});
|
||||||
var fieldBuilder = self.fieldBuilders.at(field._index());
|
var fieldBuilder = self.fieldBuilders.at(field._index());
|
||||||
var isSelected = ko.computed(() => {
|
var isSelected = ko.computed(() => {
|
||||||
return !row._isAddRow() &&
|
return !self.cellSelector.isCurrentSelectType(selector.NONE) &&
|
||||||
!self.cellSelector.isCurrentSelectType(selector.NONE) &&
|
|
||||||
ko.unwrap(self.isColSelected.at(field._index())) &&
|
ko.unwrap(self.isColSelected.at(field._index())) &&
|
||||||
self.cellSelector.isRowSelected(row._index());
|
self.cellSelector.isRowSelected(row._index());
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user