Commit 6743f584 authored by Alexander.Trofimov's avatar Alexander.Trofimov

Убрал $.extend, перешел на []

Добавил прототип drawSparklines
parent 0cac3da6
...@@ -2437,19 +2437,28 @@ ...@@ -2437,19 +2437,28 @@
} }
}; };
/** Рисует спарклайны */
WorksheetView.prototype._drawSparklines = function(drawingCtx, range, offsetX, offsetY) {
};
/** Рисует ячейки таблицы */ /** Рисует ячейки таблицы */
WorksheetView.prototype._drawCells = function ( drawingCtx, range, offsetX, offsetY ) { WorksheetView.prototype._drawCells = function ( drawingCtx, range, offsetX, offsetY ) {
this._prepareCellTextMetricsCache( range ); this._prepareCellTextMetricsCache( range );
var mergedCells = {}, mc, i; var mergedCells = [], mc, i;
for ( var row = range.r1; row <= range.r2; ++row ) { for ( var row = range.r1; row <= range.r2; ++row ) {
$.extend( mergedCells, this._drawRowBG( drawingCtx, row, range.c1, range.c2, offsetX, offsetY, null ), this._drawRowText( drawingCtx, row, range.c1, range.c2, offsetX, offsetY ) ); mergedCells =
mergedCells.concat(this._drawRowBG(drawingCtx, row, range.c1, range.c2, offsetX, offsetY, null),
this._drawRowText(drawingCtx, row, range.c1, range.c2, offsetX, offsetY));
} }
// draw merged cells at last stage to fix cells background issue // draw merged cells at last stage to fix cells background issue
for ( i in mergedCells ) { for (i = 0; i < mergedCells.length; ++i) {
mc = mergedCells[i]; if (i === mergedCells.indexOf(mergedCells[i])) {
this._drawRowBG( drawingCtx, mc.r1, mc.c1, mc.c1, offsetX, offsetY, mc ); mc = mergedCells[i];
this._drawCellText( drawingCtx, mc.c1, mc.r1, range.c1, range.c2, offsetX, offsetY, true ); this._drawRowBG(drawingCtx, mc.r1, mc.c1, mc.c1, offsetX, offsetY, mc);
this._drawCellText(drawingCtx, mc.c1, mc.r1, range.c1, range.c2, offsetX, offsetY, true);
}
} }
return mergedCells; return mergedCells;
}; };
...@@ -2460,7 +2469,7 @@ ...@@ -2460,7 +2469,7 @@
return {}; return {};
} }
var mergedCells = {}; var mergedCells = [];
var ctx = (undefined === drawingCtx) ? this.drawingCtx : drawingCtx; var ctx = (undefined === drawingCtx) ? this.drawingCtx : drawingCtx;
for ( var col = colStart; col <= colEnd; ++col ) { for ( var col = colStart; col <= colEnd; ++col ) {
if ( this.cols[col].width < this.width_1px && null === oMergedCell ) { if ( this.cols[col].width < this.width_1px && null === oMergedCell ) {
...@@ -2480,7 +2489,7 @@ ...@@ -2480,7 +2489,7 @@
if ( null === oMergedCell ) { if ( null === oMergedCell ) {
mc = this.model.getMergedByCell( row, col ); mc = this.model.getMergedByCell( row, col );
if ( null !== mc ) { if ( null !== mc ) {
mergedCells[mc.r1 + "_" + mc.c1] = {c1: mc.c1, r1: mc.r1, c2: mc.c2, r2: mc.r2}; mergedCells.push(mc);
col = mc.c2; col = mc.c2;
continue; continue;
} }
...@@ -2540,7 +2549,7 @@ ...@@ -2540,7 +2549,7 @@
return {}; return {};
} }
var dependentCells = {}, mergedCells = {}, i, mc, col; var dependentCells = {}, mergedCells = [], i, mc, col;
// draw cells' text // draw cells' text
for ( col = colStart; col <= colEnd; ++col ) { for ( col = colStart; col <= colEnd; ++col ) {
if ( this.cols[col].width < this.width_1px ) { if ( this.cols[col].width < this.width_1px ) {
...@@ -2548,7 +2557,7 @@ ...@@ -2548,7 +2557,7 @@
} }
mc = this._drawCellText( drawingCtx, col, row, colStart, colEnd, offsetX, offsetY, false ); mc = this._drawCellText( drawingCtx, col, row, colStart, colEnd, offsetX, offsetY, false );
if ( mc !== null ) { if ( mc !== null ) {
mergedCells[mc.index] = {c1: mc.c1, r1: mc.r1, c2: mc.c2, r2: mc.r2}; mergedCells.push(mc);
} }
// check if long text overlaps this cell // check if long text overlaps this cell
i = this._findSourceOfCellText( col, row ); i = this._findSourceOfCellText( col, row );
...@@ -2584,7 +2593,7 @@ ...@@ -2584,7 +2593,7 @@
if ( isMerged ) { if ( isMerged ) {
range = ct.flags.merged; range = ct.flags.merged;
if ( !drawMergedCells ) { if ( !drawMergedCells ) {
return {c1: range.c1, r1: range.r1, c2: range.c2, r2: range.r2, index: range.r1 + "_" + range.c1}; return range;
} }
if ( col !== range.c1 || row !== range.r1 ) { if ( col !== range.c1 || row !== range.r1 ) {
return null; return null;
......
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