Commit 866271a5 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Отрисовка диапазонов формул для pane (+ очистка)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@53124 954022d7-b5bf-4e40-9824-e11837661b57
parent 4b34edff
...@@ -5006,7 +5006,7 @@ function DrawingObjects() { ...@@ -5006,7 +5006,7 @@ function DrawingObjects() {
worksheet.arrActiveChartsRanges.push(range); worksheet.arrActiveChartsRanges.push(range);
worksheet.isChartAreaEditMode = true; worksheet.isChartAreaEditMode = true;
worksheet._drawFormulaRange(worksheet.arrActiveChartsRanges); worksheet._drawFormulaRanges(worksheet.arrActiveChartsRanges);
bRaise = true; bRaise = true;
} }
} }
...@@ -5327,7 +5327,7 @@ function ClickCounter() { ...@@ -5327,7 +5327,7 @@ function ClickCounter() {
console.log("Time: " + (currTime - _this.time)); console.log("Time: " + (currTime - _this.time));
console.log("Count: " + _this.clickCount); console.log("Count: " + _this.clickCount);
console.log(""); console.log("");
} }
_this.time = currTime; _this.time = currTime;
} }
......
...@@ -2888,7 +2888,7 @@ ...@@ -2888,7 +2888,7 @@
isFrozen = !!isFrozen; isFrozen = !!isFrozen;
if (asc["editor"].isStartAddShape || this.objectRender.selectedGraphicObjectsExists()) { if (asc["editor"].isStartAddShape || this.objectRender.selectedGraphicObjectsExists()) {
if (this.isChartAreaEditMode) { if (this.isChartAreaEditMode) {
this._drawFormulaRange(this.arrActiveChartsRanges); this._drawFormulaRanges(this.arrActiveChartsRanges);
} }
return; return;
} }
...@@ -3154,15 +3154,15 @@ ...@@ -3154,15 +3154,15 @@
ctx.stroke(); ctx.stroke();
} }
if (this.isFormulaEditMode) { if (!isFrozen && this.isFormulaEditMode) {
this._drawFormulaRange(this.arrActiveFormulaRanges); this._drawFormulaRanges(this.arrActiveFormulaRanges);
} }
if (this.isChartAreaEditMode) { if (!isFrozen && this.isChartAreaEditMode) {
this._drawFormulaRange(this.arrActiveChartsRanges); this._drawFormulaRanges(this.arrActiveChartsRanges);
} }
if (this.isSelectionDialogMode) { if (!isFrozen && this.isSelectionDialogMode) {
this._drawSelectRange(this.activeRange.clone(true)); this._drawSelectRange(this.activeRange.clone(true));
} }
...@@ -3200,63 +3200,94 @@ ...@@ -3200,63 +3200,94 @@
this._drawActiveHeaders(); this._drawActiveHeaders();
} }
}, },
_drawFormulaRange: function (index, oFormulaRange, oFormulaRangeIntersection, visibleRange, offsetX, offsetY) {
if (!oFormulaRangeIntersection)
return;
var ctx = this.overlayCtx, opt = this.settings;
ctx.beginPath()
.setStrokeStyle(opt.formulaRangeBorderColor[index%opt.formulaRangeBorderColor.length])
.setFillStyle(opt.formulaRangeBorderColor[index%opt.formulaRangeBorderColor.length]);
var drawLeftSideFormula = oFormulaRangeIntersection.c1 === oFormulaRange.c1;
var drawRightSideFormula = oFormulaRangeIntersection.c2 === oFormulaRange.c2;
var drawTopSideFormula = oFormulaRangeIntersection.r1 === oFormulaRange.r1;
var drawBottomSideFormula = oFormulaRangeIntersection.r2 === oFormulaRange.r2;
var xFormula1 = this.cols[oFormulaRangeIntersection.c1].left - offsetX - this.width_1px;
var xFormula2 = this.cols[oFormulaRangeIntersection.c2].left + this.cols[oFormulaRangeIntersection.c2].width - offsetX - this.width_1px;
var yFormula1 = this.rows[oFormulaRangeIntersection.r1].top - offsetY;
var yFormula2 = this.rows[oFormulaRangeIntersection.r2].top + this.rows[oFormulaRangeIntersection.r2].height - offsetY - this.height_1px;
if ( drawTopSideFormula && oFormulaRangeIntersection.r1 != visibleRange.r1 ) {
ctx.lineHor( xFormula1 + this.width_1px, yFormula1 - this.height_1px, xFormula2 + this.width_1px );
}
if ( drawBottomSideFormula ) {
ctx.lineHor( xFormula1 + this.width_1px, yFormula2, xFormula2 + this.width_1px );
}
if ( drawLeftSideFormula && oFormulaRangeIntersection.c1 != visibleRange.c1 ) {
ctx.lineVer( xFormula1, yFormula1 - this.width_1px * (oFormulaRangeIntersection.r1 != visibleRange.r1), yFormula2 + this.width_1px );
}
if (drawRightSideFormula) {ctx.lineVer(xFormula2, yFormula1, yFormula2);}
if (drawLeftSideFormula && drawTopSideFormula)
ctx.fillRect(xFormula1 + this.width_1px, yFormula1, this.width_4px, this.height_4px);
if (drawRightSideFormula && drawTopSideFormula)
ctx.fillRect(xFormula2 - this.width_4px, yFormula1, this.width_4px, this.height_4px);
if (drawRightSideFormula && drawBottomSideFormula)
ctx.fillRect(xFormula2 - this.width_4px, yFormula2 - this.height_4px, this.width_4px, this.height_4px);
if (drawLeftSideFormula && drawBottomSideFormula)
ctx.fillRect(xFormula1 + this.width_1px, yFormula2 - this.height_4px, this.width_4px, this.height_4px);
ctx.closePath().stroke();
},
_drawFormulaRange: function(arr){ _drawFormulaRanges: function(arr){
var ctx = this.overlayCtx, var ctx = this.overlayCtx, cFrozen = 0, rFrozen = 0,
opt = this.settings,
offsetX = this.cols[this.visibleRange.c1].left - this.cellsLeft, offsetX = this.cols[this.visibleRange.c1].left - this.cellsLeft,
offsetY = this.rows[this.visibleRange.r1].top - this.cellsTop; offsetY = this.rows[this.visibleRange.r1].top - this.cellsTop;
var arrFrozenRanges = [], arrOffsetsX = [], arrOffsetsY = [];
if (this.topLeftFrozenCell) { if (this.topLeftFrozenCell) {
var cFrozen = this.topLeftFrozenCell.getCol0(); cFrozen = this.topLeftFrozenCell.getCol0();
var rFrozen = this.topLeftFrozenCell.getRow0(); rFrozen = this.topLeftFrozenCell.getRow0();
offsetX -= this.cols[cFrozen].left - this.cols[0].left; offsetX -= this.cols[cFrozen].left - this.cols[0].left;
offsetY -= this.rows[rFrozen].top - this.rows[0].top; offsetY -= this.rows[rFrozen].top - this.rows[0].top;
var oFrozenRange;
cFrozen -= 1; rFrozen -= 1;
if (0 <= cFrozen && 0 <= rFrozen) {
oFrozenRange = new asc_Range(0, 0, cFrozen, rFrozen);
arrFrozenRanges.push(oFrozenRange);
arrOffsetsX.push(this.cols[0].left - this.cellsLeft);
arrOffsetsY.push(this.rows[0].top - this.cellsTop);
}
if (0 <= cFrozen) {
oFrozenRange = new asc_Range(0, this.visibleRange.r1, cFrozen, this.visibleRange.r2);
arrFrozenRanges.push(oFrozenRange);
arrOffsetsX.push(this.cols[0].left - this.cellsLeft);
arrOffsetsY.push(offsetY);
}
if (0 <= rFrozen) {
oFrozenRange = new asc_Range(this.visibleRange.c1, 0, this.visibleRange.c2, rFrozen);
arrFrozenRanges.push(oFrozenRange);
arrOffsetsX.push(offsetX);
arrOffsetsY.push(this.rows[0].top - this.cellsTop);
}
} }
ctx.setLineWidth(1); ctx.setLineWidth(1);
for (var i in arr) { for (var i in arr) {
var arFormulaTmp = arr[i].clone(true); if (!arr.hasOwnProperty(i))
var aFormulaIntersection = arFormulaTmp.intersection(this.visibleRange); continue;
var oFormulaTmp = arr[i].clone(true);
if (aFormulaIntersection) { var oFormulaIntersection = oFormulaTmp.intersection(this.visibleRange);
ctx.beginPath() this._drawFormulaRange(i, oFormulaTmp, oFormulaIntersection, this.visibleRange, offsetX, offsetY);
.setStrokeStyle(opt.formulaRangeBorderColor[i%opt.formulaRangeBorderColor.length]) for (var j = 0; j < arrFrozenRanges.length; ++j) {
.setFillStyle(opt.formulaRangeBorderColor[i%opt.formulaRangeBorderColor.length]); oFormulaIntersection = oFormulaTmp.intersection(arrFrozenRanges[j]);
var drawLeftSideFormula = aFormulaIntersection.c1 === arFormulaTmp.c1; this._drawFormulaRange(i, oFormulaTmp, oFormulaIntersection, arrFrozenRanges[j], arrOffsetsX[j], arrOffsetsY[j]);
var drawRightSideFormula = aFormulaIntersection.c2 === arFormulaTmp.c2;
var drawTopSideFormula = aFormulaIntersection.r1 === arFormulaTmp.r1;
var drawBottomSideFormula = aFormulaIntersection.r2 === arFormulaTmp.r2;
var xFormula1 = this.cols[aFormulaIntersection.c1].left - offsetX - this.width_1px;
var xFormula2 = this.cols[aFormulaIntersection.c2].left + this.cols[aFormulaIntersection.c2].width - offsetX - this.width_1px;
var yFormula1 = this.rows[aFormulaIntersection.r1].top - offsetY;
var yFormula2 = this.rows[aFormulaIntersection.r2].top + this.rows[aFormulaIntersection.r2].height - offsetY - this.height_1px;
if ( drawTopSideFormula && aFormulaIntersection.r1 != this.visibleRange.r1 ) {
ctx.lineHor( xFormula1 + this.width_1px, yFormula1 - this.height_1px, xFormula2 + this.width_1px );
}
if ( drawBottomSideFormula ) {
ctx.lineHor( xFormula1 + this.width_1px, yFormula2, xFormula2 + this.width_1px );
}
if ( drawLeftSideFormula && aFormulaIntersection.c1 != this.visibleRange.c1 ) {
ctx.lineVer( xFormula1, yFormula1 - this.width_1px * (aFormulaIntersection.r1 != this.visibleRange.r1), yFormula2 + this.width_1px );
}
if (drawRightSideFormula) {ctx.lineVer(xFormula2, yFormula1, yFormula2);}
if (drawLeftSideFormula && drawTopSideFormula)
ctx.fillRect(xFormula1 + this.width_1px, yFormula1, this.width_4px, this.height_4px);
if (drawRightSideFormula && drawTopSideFormula)
ctx.fillRect(xFormula2 - this.width_4px, yFormula1, this.width_4px, this.height_4px);
if (drawRightSideFormula && drawBottomSideFormula)
ctx.fillRect(xFormula2 - this.width_4px, yFormula2 - this.height_4px, this.width_4px, this.height_4px);
if (drawLeftSideFormula && drawBottomSideFormula)
ctx.fillRect(xFormula1 + this.width_1px, yFormula2 - this.height_4px, this.width_4px, this.height_4px);
ctx.closePath().stroke();
} }
} }
}, },
...@@ -3500,7 +3531,7 @@ ...@@ -3500,7 +3531,7 @@
for (i = 0; i < arrayElements.length; ++i) { for (i = 0; i < arrayElements.length; ++i) {
var arFormulaTmp = asc_Range (arrayElements[i].c1, arrayElements[i].r1, arrayElements[i].c2, arrayElements[i].r2); var arFormulaTmp = asc_Range (arrayElements[i].c1, arrayElements[i].r1, arrayElements[i].c2, arrayElements[i].r2);
var aFormulaIntersection = arFormulaTmp.intersection(this.visibleRange); var aFormulaIntersection = arFormulaTmp.intersection(range ? range : this.visibleRange);
if (aFormulaIntersection) { if (aFormulaIntersection) {
// Координаты для автозаполнения // Координаты для автозаполнения
...@@ -3523,7 +3554,7 @@ ...@@ -3523,7 +3554,7 @@
for (i = 0; i < this.arrActiveFormulaRanges.length; ++i) { for (i = 0; i < this.arrActiveFormulaRanges.length; ++i) {
var activeFormula = this.arrActiveFormulaRanges[i].clone(true); var activeFormula = this.arrActiveFormulaRanges[i].clone(true);
activeFormula = this.visibleRange.intersection(activeFormula); activeFormula = activeFormula.intersection(range ? range : activeFormula);
if (null === activeFormula) { if (null === activeFormula) {
// это ссылка из формулы на еще не добавленный рэндж // это ссылка из формулы на еще не добавленный рэндж
continue; continue;
...@@ -3552,7 +3583,7 @@ ...@@ -3552,7 +3583,7 @@
for (i in this.arrActiveChartsRanges ) { for (i in this.arrActiveChartsRanges ) {
var activeFormula = this.arrActiveChartsRanges[i].clone(true); var activeFormula = this.arrActiveChartsRanges[i].clone(true);
activeFormula = this.visibleRange.intersection(activeFormula); activeFormula = activeFormula.intersection(range ? range : activeFormula);
if (null === activeFormula) { if (null === activeFormula) {
// это ссылка из формулы на еще не добавленный рэндж // это ссылка из формулы на еще не добавленный рэндж
continue; continue;
......
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