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

update function _drawSelectionElement

parent 3c64f4d2
...@@ -322,11 +322,12 @@ var c_oAscFormulaRangeBorderColor = [ ...@@ -322,11 +322,12 @@ var c_oAscFormulaRangeBorderColor = [
]; ];
var selectionLineType = { var selectionLineType = {
Dash : 1, None : 0,
RangeWithPromote: 2, Selection : 1,
RangeWithResize : 3, ActiveCell : 2,
Range : 4, Resize : 4,
RangeOut : 5 Promote : 8,
Dash : 16
}; };
var c_oAscLockNameFrozenPane = "frozenPane"; var c_oAscLockNameFrozenPane = "frozenPane";
......
...@@ -3571,8 +3571,8 @@ ...@@ -3571,8 +3571,8 @@
var fHorLine, fVerLine; var fHorLine, fVerLine;
var isRangeOut = AscCommonExcel.selectionLineType.RangeOut === selectionLineType; var canFill = AscCommonExcel.selectionLineType.Selection & selectionLineType;
var isDashLine = AscCommonExcel.selectionLineType.Dash === selectionLineType; var isDashLine = AscCommonExcel.selectionLineType.Dash & selectionLineType;
if (isDashLine) { if (isDashLine) {
fHorLine = ctx.dashLineCleverHor; fHorLine = ctx.dashLineCleverHor;
fVerLine = ctx.dashLineCleverVer; fVerLine = ctx.dashLineCleverVer;
...@@ -3594,7 +3594,7 @@ ...@@ -3594,7 +3594,7 @@
var y1 = r[oIntersection.r1].top - offsetY; var y1 = r[oIntersection.r1].top - offsetY;
var y2 = r[oIntersection.r2].top + r[oIntersection.r2].height - offsetY; var y2 = r[oIntersection.r2].top + r[oIntersection.r2].height - offsetY;
if (!isDashLine && !isRangeOut) { if (canFill) {
var fillColor = strokeColor.Copy(); var fillColor = strokeColor.Copy();
fillColor.a = 0.15; fillColor.a = 0.15;
ctx.setFillStyle(fillColor).fillRect(x1, y1, x2 - x1, y2 - y1); ctx.setFillStyle(fillColor).fillRect(x1, y1, x2 - x1, y2 - y1);
...@@ -3617,7 +3617,7 @@ ...@@ -3617,7 +3617,7 @@
} }
ctx.closePath().stroke(); ctx.closePath().stroke();
if (!isDashLine && !isRangeOut) {/*Отрисовка светлой полосы при выборе ячеек для формулы*/ if (canFill) {/*Отрисовка светлой полосы при выборе ячеек для формулы*/
ctx.setLineWidth(1); ctx.setLineWidth(1);
ctx.setStrokeStyle(colorN); ctx.setStrokeStyle(colorN);
ctx.beginPath(); ctx.beginPath();
...@@ -3637,7 +3637,7 @@ ...@@ -3637,7 +3637,7 @@
} }
// draw active cell in selection // draw active cell in selection
var isPromote = AscCommonExcel.selectionLineType.RangeWithPromote === selectionLineType; var isPromote = AscCommonExcel.selectionLineType.Promote & selectionLineType;
if (isPromote) { if (isPromote) {
var fs = this.model.getMergedByCell(range.startRow, range.startCol); var fs = this.model.getMergedByCell(range.startRow, range.startCol);
fs = range.intersectionSimple( fs = range.intersectionSimple(
...@@ -3654,35 +3654,39 @@ ...@@ -3654,35 +3654,39 @@
} }
// Отрисовка квадратов для move/resize // Отрисовка квадратов для move/resize
var isResize = AscCommonExcel.selectionLineType.RangeWithResize === selectionLineType; var isResize = AscCommonExcel.selectionLineType.Resize & selectionLineType;
if (isResize || isPromote) { if (isResize || isPromote) {
ctx.setFillStyle(colorN); ctx.setFillStyle(colorN);
if (isResize && drawLeftSide && drawTopSide) {
ctx.fillRect(x1 - width_4px, y1 - height_4px, width_7px, height_7px);
}
if (isResize && drawRightSide && drawTopSide) {
ctx.fillRect(x2 - width_4px, y1 - height_4px, width_7px, height_7px);
}
if (isResize && drawLeftSide && drawBottomSide) {
ctx.fillRect(x1 - width_4px, y2 - height_4px, width_7px, height_7px);
}
if (drawRightSide && drawBottomSide) { if (drawRightSide && drawBottomSide) {
ctx.fillRect(x2 - width_4px, y2 - height_4px, width_7px, height_7px); ctx.fillRect(x2 - width_4px, y2 - height_4px, width_7px, height_7px);
} }
ctx.setFillStyle(strokeColor); ctx.setFillStyle(strokeColor);
if (isResize && drawLeftSide && drawTopSide) {
ctx.fillRect(x1 - width_3px, y1 - height_3px, width_5px, height_5px);
}
if (isResize && drawRightSide && drawTopSide) {
ctx.fillRect(x2 - width_3px, y1 - height_3px, width_5px, height_5px);
}
if (isResize && drawLeftSide && drawBottomSide) {
ctx.fillRect(x1 - width_3px, y2 - height_3px, width_5px, height_5px);
}
if (drawRightSide && drawBottomSide) { if (drawRightSide && drawBottomSide) {
ctx.fillRect(x2 - width_3px, y2 - height_3px, width_5px, height_5px); ctx.fillRect(x2 - width_3px, y2 - height_3px, width_5px, height_5px);
} }
if (isResize) {
ctx.setFillStyle(colorN);
if (drawLeftSide && drawTopSide) {
ctx.fillRect(x1 - width_4px, y1 - height_4px, width_7px, height_7px);
}
if (drawRightSide && drawTopSide) {
ctx.fillRect(x2 - width_4px, y1 - height_4px, width_7px, height_7px);
}
if (drawLeftSide && drawBottomSide) {
ctx.fillRect(x1 - width_4px, y2 - height_4px, width_7px, height_7px);
}
ctx.setFillStyle(strokeColor);
if (drawLeftSide && drawTopSide) {
ctx.fillRect(x1 - width_3px, y1 - height_3px, width_5px, height_5px);
}
if (drawRightSide && drawTopSide) {
ctx.fillRect(x2 - width_3px, y1 - height_3px, width_5px, height_5px);
}
if (drawLeftSide && drawBottomSide) {
ctx.fillRect(x1 - width_3px, y2 - height_3px, width_5px, height_5px);
}
}
} }
return true; return true;
}; };
...@@ -3761,6 +3765,10 @@ ...@@ -3761,6 +3765,10 @@
} else { } else {
this._drawSelectionRange(); this._drawSelectionRange();
if (this.activeFillHandle) {
this._drawElements(this._drawSelectionElement, this.activeFillHandle.clone(true),
AscCommonExcel.selectionLineType.None, this.settings.activeCellBorderColor);
}
if (this.isFormulaEditMode) { if (this.isFormulaEditMode) {
this._drawFormulaRanges(this.arrActiveFormulaRanges); this._drawFormulaRanges(this.arrActiveFormulaRanges);
} }
...@@ -3775,7 +3783,7 @@ ...@@ -3775,7 +3783,7 @@
} }
if (null !== this.activeMoveRange) { if (null !== this.activeMoveRange) {
this._drawElements(this._drawSelectionElement, this.activeMoveRange, this._drawElements(this._drawSelectionElement, this.activeMoveRange,
AscCommonExcel.selectionLineType.RangeOut, new CColor(0, 0, 0)); AscCommonExcel.selectionLineType.None, new CColor(0, 0, 0));
} }
} }
} }
...@@ -3799,12 +3807,8 @@ ...@@ -3799,12 +3807,8 @@
} }
this._drawElements(this._drawSelectionElement, this.activeRange, this._drawElements(this._drawSelectionElement, this.activeRange,
AscCommonExcel.selectionLineType.RangeWithPromote, this.settings.activeCellBorderColor); AscCommonExcel.selectionLineType.Selection | AscCommonExcel.selectionLineType.ActiveCell |
AscCommonExcel.selectionLineType.Promote, this.settings.activeCellBorderColor);
if (this.activeFillHandle) {
this._drawElements(this._drawSelectionElement, this.activeFillHandle.clone(true),
AscCommonExcel.selectionLineType.RangeOut, this.settings.activeCellBorderColor);
}
}; };
WorksheetView.prototype._drawFormatPainterRange = function () { WorksheetView.prototype._drawFormatPainterRange = function () {
...@@ -3825,8 +3829,8 @@ ...@@ -3825,8 +3829,8 @@
strokeColor = AscCommonExcel.c_oAscFormulaRangeBorderColor[colorIndex % length]; strokeColor = AscCommonExcel.c_oAscFormulaRangeBorderColor[colorIndex % length];
this._drawElements(this._drawSelectionElement, oFormulaRange, this._drawElements(this._drawSelectionElement, oFormulaRange,
arrRanges[i].isName ? AscCommonExcel.selectionLineType.Range : AscCommonExcel.selectionLineType.Selection | (arrRanges[i].isName ? AscCommonExcel.selectionLineType.None :
AscCommonExcel.selectionLineType.RangeWithResize, strokeColor); AscCommonExcel.selectionLineType.Resize), strokeColor);
} }
}; };
...@@ -5947,7 +5951,7 @@ ...@@ -5947,7 +5951,7 @@
y1 = this.rows[oFormulaRangeIn.r1].top - offsetY; y1 = this.rows[oFormulaRangeIn.r1].top - offsetY;
y2 = this.rows[oFormulaRangeIn.r2].top + this.rows[oFormulaRangeIn.r2].height - offsetY; y2 = this.rows[oFormulaRangeIn.r2].top + this.rows[oFormulaRangeIn.r2].height - offsetY;
isResize = AscCommonExcel.selectionLineType.RangeWithResize === rangeType; isResize = AscCommonExcel.selectionLineType.Resize & rangeType;
if (isResize && this._hitResizeCorner(x1 - this.width_1px, y1 - this.height_1px, x, y)) { if (isResize && this._hitResizeCorner(x1 - this.width_1px, y1 - this.height_1px, x, y)) {
/*TOP-LEFT*/ /*TOP-LEFT*/
...@@ -5986,8 +5990,9 @@ ...@@ -5986,8 +5990,9 @@
}; };
WorksheetView.prototype._hitCursorSelectionRange = function (vr, x, y, offsetX, offsetY) { WorksheetView.prototype._hitCursorSelectionRange = function (vr, x, y, offsetX, offsetY) {
var res = this._hitInRange(this.activeRange, AscCommonExcel.selectionLineType.RangeWithPromote, vr, x, y, var res = this._hitInRange(this.activeRange,
offsetX, offsetY); AscCommonExcel.selectionLineType.Selection | AscCommonExcel.selectionLineType.ActiveCell |
AscCommonExcel.selectionLineType.Promote, vr, x, y, offsetX, offsetY);
return res ? { return res ? {
cursor: kCurMove === res.cursor ? kCurMove : kCurFillHandle, cursor: kCurMove === res.cursor ? kCurMove : kCurFillHandle,
target: kCurMove === res.cursor ? c_oTargetType.MoveRange : c_oTargetType.FillHandle, target: kCurMove === res.cursor ? c_oTargetType.MoveRange : c_oTargetType.FillHandle,
...@@ -6006,8 +6011,7 @@ ...@@ -6006,8 +6011,7 @@
oFormulaRange = arrRanges[i].clone(true); oFormulaRange = arrRanges[i].clone(true);
oFormulaRange.isName = arrRanges[i].isName; oFormulaRange.isName = arrRanges[i].isName;
res = !oFormulaRange.isName && res = !oFormulaRange.isName &&
this._hitInRange(oFormulaRange, AscCommonExcel.selectionLineType.RangeWithResize, vr, x, y, offsetX, this._hitInRange(oFormulaRange, AscCommonExcel.selectionLineType.Resize, vr, x, y, offsetX, offsetY);
offsetY);
if (res) { if (res) {
break; break;
} }
......
...@@ -3956,14 +3956,14 @@ function DrawingObjects() { ...@@ -3956,14 +3956,14 @@ function DrawingObjects() {
{ {
worksheet._drawElements(worksheet._drawSelectionElement, worksheet._drawElements(worksheet._drawSelectionElement,
asc.Range(drawing.bbox.serBBox.c1, drawing.bbox.serBBox.r1, drawing.bbox.serBBox.c2, asc.Range(drawing.bbox.serBBox.c1, drawing.bbox.serBBox.r1, drawing.bbox.serBBox.c2,
drawing.bbox.serBBox.r2, true), AscCommonExcel.selectionLineType.RangeWithResize, drawing.bbox.serBBox.r2, true), AscCommonExcel.selectionLineType.Selection | AscCommonExcel.selectionLineType.Resize,
AscCommonExcel.c_oAscFormulaRangeBorderColor[1]); AscCommonExcel.c_oAscFormulaRangeBorderColor[1]);
} }
if(drawing.bbox.catBBox) if(drawing.bbox.catBBox)
{ {
worksheet._drawElements(worksheet._drawSelectionElement, worksheet._drawElements(worksheet._drawSelectionElement,
asc.Range(drawing.bbox.catBBox.c1, drawing.bbox.catBBox.r1, drawing.bbox.catBBox.c2, asc.Range(drawing.bbox.catBBox.c1, drawing.bbox.catBBox.r1, drawing.bbox.catBBox.c2,
drawing.bbox.catBBox.r2, true), AscCommonExcel.selectionLineType.RangeWithResize, drawing.bbox.catBBox.r2, true), AscCommonExcel.selectionLineType.Selection | AscCommonExcel.selectionLineType.Resize,
AscCommonExcel.c_oAscFormulaRangeBorderColor[2]); AscCommonExcel.c_oAscFormulaRangeBorderColor[2]);
} }
var BB = drawing.bbox.seriesBBox; var BB = drawing.bbox.seriesBBox;
......
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