Commit a3683457 authored by Alexander.Trofimov's avatar Alexander.Trofimov

Вынес проверку попадания на границу выделения (для перемещения в отдельную функцию)

Переделал проверку при перемещении курсора на выделенный объект (не нужно проверять попадание на границу выделения).

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@55309 954022d7-b5bf-4e40-9824-e11837661b57
parent b80a6be3
...@@ -5474,11 +5474,31 @@ ...@@ -5474,11 +5474,31 @@
} }
return null; return null;
}; };
WorksheetView.prototype._isCursorOnSelectionBorder = function (ar, vr, x, y) {
var arIntersection = ar.intersectionSimple(vr);
var left, top, right, bottom;
if (arIntersection) {
left = ar.c1 === arIntersection.c1 ? this.cols[ar.c1].left : null;
right = ar.c2 === arIntersection.c2 ? this.cols[ar.c2].left + this.cols[ar.c2].width : null;
top = ar.r1 === arIntersection.r1 ? this.rows[ar.r1].top : null;
bottom = ar.r2 === arIntersection.r2 ? this.rows[ar.r2].top + this.rows[ar.r2].height : null;
if ((((null !== left && x >= left - this.width_2px && x <= left + this.width_2px) ||
(null !== right && x >= right - this.width_2px && x <= right + this.width_2px)) &&
null !== top && null !== bottom && y >= top - this.height_2px && y <= bottom + this.height_2px) ||
(((null !== top && y >= top - this.height_2px && y <= top + this.height_2px) ||
(null !== bottom && y >= bottom - this.height_2px && y <= bottom + this.height_2px)) &&
null !== left && null !== right && x >= left - this.width_2px && x <= right + this.width_2px)) {
// Мы навели на границу выделения
return true;
}
}
return false;
};
WorksheetView.prototype.getCursorTypeFromXY = function (x, y, isViewerMode) { WorksheetView.prototype.getCursorTypeFromXY = function (x, y, isViewerMode) {
var c, r, f, i, offsetX, offsetY, arIntersection, left, top, right, bottom, cellCursor, var c, r, f, i, offsetX, offsetY, cellCursor, sheetId = this.model.getId(), userId,
sheetId = this.model.getId(), userId, lockRangePosLeft, lockRangePosTop, lockInfo, oHyperlink, lockRangePosLeft, lockRangePosTop, lockInfo, oHyperlink, widthDiff = 0, heightDiff = 0,
widthDiff = 0, heightDiff = 0, isLocked = false, ar = this.activeRange, target = "cells", row = -1, col = -1; isLocked = false, ar = this.activeRange, target = "cells", row = -1, col = -1, isSelGraphicObject;
var frozenCursor = this._isFrozenAnchor(x, y); var frozenCursor = this._isFrozenAnchor(x, y);
if (frozenCursor.result) { if (frozenCursor.result) {
...@@ -5572,43 +5592,29 @@ ...@@ -5572,43 +5592,29 @@
if (oFormulaOrChartCursor) if (oFormulaOrChartCursor)
return oFormulaOrChartCursor; return oFormulaOrChartCursor;
var oResDefault = {cursor: kCurDefault, target: "none", col: -1, row: -1}; isSelGraphicObject = this.objectRender.selectedGraphicObjectsExists();
if (!isViewerMode && !isSelGraphicObject) {
// Эпсилон для fillHandle // Эпсилон для fillHandle
var fillHandleEpsilon = this.width_1px; var fillHandleEpsilon = this.width_1px;
if (!isViewerMode && !this.isChartAreaEditMode && if (!this.isChartAreaEditMode &&
x >= (this.fillHandleL - fillHandleEpsilon) && x <= (this.fillHandleR + fillHandleEpsilon) && x >= (this.fillHandleL - fillHandleEpsilon) && x <= (this.fillHandleR + fillHandleEpsilon) &&
y >= (this.fillHandleT - fillHandleEpsilon) && y <= (this.fillHandleB + fillHandleEpsilon)) { y >= (this.fillHandleT - fillHandleEpsilon) && y <= (this.fillHandleB + fillHandleEpsilon)) {
// Мы на "квадрате" для автозаполнения // Мы на "квадрате" для автозаполнения
if (!this.objectRender.selectedGraphicObjectsExists())
return {cursor: kCurFillHandle, target: "fillhandle", col: -1, row: -1}; return {cursor: kCurFillHandle, target: "fillhandle", col: -1, row: -1};
} }
// Навели на выделение
var xWithOffset = x + offsetX; var xWithOffset = x + offsetX;
var yWithOffset = y + offsetY; var yWithOffset = y + offsetY;
if (this._isCursorOnSelectionBorder(ar, this.visibleRange, xWithOffset, yWithOffset))
// Навели на выделение
arIntersection = ar.intersectionSimple(this.visibleRange);
if (!isViewerMode && arIntersection) {
left = ar.c1 === arIntersection.c1 ? this.cols[ar.c1].left : null;
right = ar.c2 === arIntersection.c2 ? this.cols[ar.c2].left + this.cols[ar.c2].width : null;
top = ar.r1 === arIntersection.r1 ? this.rows[ar.r1].top : null;
bottom = ar.r2 === arIntersection.r2 ? this.rows[ar.r2].top + this.rows[ar.r2].height : null;
if ((((null !== left && xWithOffset >= left - this.width_2px && xWithOffset <= left + this.width_2px) ||
(null !== right && xWithOffset >= right - this.width_2px && xWithOffset <= right + this.width_2px)) &&
null !== top && null !== bottom && yWithOffset >= top - this.height_2px && yWithOffset <= bottom + this.height_2px) ||
(((null !== top && yWithOffset >= top - this.height_2px && yWithOffset <= top + this.height_2px) ||
(null !== bottom && yWithOffset >= bottom - this.height_2px && yWithOffset <= bottom + this.height_2px)) &&
null !== left && null !== right && xWithOffset >= left - this.width_2px && xWithOffset <= right + this.width_2px)) {
// Мы навели на границу выделения
if ( !this.objectRender.selectedGraphicObjectsExists() )
return {cursor: kCurMove, target: "moveRange", col: -1, row: -1}; return {cursor: kCurMove, target: "moveRange", col: -1, row: -1};
} }
}
if (x < this.cellsLeft && y < this.cellsTop) { if (x < this.cellsLeft && y < this.cellsTop) {
return {cursor: kCurCorner, target: "corner", col: -1, row: -1}; return {cursor: kCurCorner, target: "corner", col: -1, row: -1};
} }
var oResDefault = {cursor: kCurDefault, target: "none", col: -1, row: -1};
if (x > this.cellsLeft && y > this.cellsTop) { if (x > this.cellsLeft && y > this.cellsTop) {
c = this._findColUnderCursor(x, true); c = this._findColUnderCursor(x, true);
r = this._findRowUnderCursor(y, true); r = this._findRowUnderCursor(y, true);
......
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