Commit d8e8cedd authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Поправил findCellByXY (добавил параметр canReturnNull, skipCol и skipRow)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57501 954022d7-b5bf-4e40-9824-e11837661b57
parent 1967452c
...@@ -5444,29 +5444,41 @@ ...@@ -5444,29 +5444,41 @@
// ----- Selection ----- // ----- Selection -----
// x,y - абсолютные координаты относительно листа (без учета заголовков) // x,y - абсолютные координаты относительно листа (без учета заголовков)
WorksheetView.prototype.findCellByXY = function (x, y) { WorksheetView.prototype.findCellByXY = function (x, y, canReturnNull, skipCol, skipRow) {
var r = 0, c = 0, tmpRow, tmpCol, result = new CCellObjectInfo(); var r = 0, c = 0, tmpRow, tmpCol, result = new CCellObjectInfo();
if (canReturnNull) {
result.col = result.row = null;
}
x += this.cellsLeft; x += this.cellsLeft;
y += this.cellsTop; y += this.cellsTop;
while (c < this.cols.length) { if (!skipCol) {
tmpCol = this.cols[c]; while (c < this.cols.length) {
if (x <= tmpCol.left + tmpCol.width) { tmpCol = this.cols[c];
result.col = c; if (x <= tmpCol.left + tmpCol.width) {
break; result.col = c;
break;
}
++c;
} }
++c;
if (null !== result.col)
result.colOff = x - this.cols[result.col].left;
} }
while (r < this.rows.length) { if (!skipRow) {
tmpRow = this.rows[r]; while (r < this.rows.length) {
if (y <= tmpRow.top + tmpRow.height) { tmpRow = this.rows[r];
result.row = r; if (y <= tmpRow.top + tmpRow.height) {
break; result.row = r;
break;
}
++r;
} }
++r;
if (null !== result.row)
result.rowOff = y - this.rows[result.row].top;
} }
result.colOff = x - this.cols[result.col].left;
result.rowOff = y - this.rows[result.row].top;
return result; return result;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment