Commit 79399dc6 authored by Alexander.Trofimov's avatar Alexander.Trofimov

add remove sparklines by clean all

ToDo undo/redo
parent 95d0b08f
......@@ -5706,8 +5706,23 @@ Woorksheet.prototype.updateSparklineCache = function(sheet, ranges) {
}
return null;
};
Woorksheet.prototype.insertSparkline = function (sparkline) {
this.aSparklineGroups.push(sparkline);
Woorksheet.prototype.removeSparkline = function (range) {
for (var i = 0; i < this.aSparklineGroups.length; ++i) {
if (this.aSparklineGroups[i].remove(range)) {
this.aSparklineGroups.splice(i--, 1);
}
}
};
Woorksheet.prototype.insertSparklineGroup = function (sparklineGroup) {
this.aSparklineGroups.push(sparklineGroup);
};
Woorksheet.prototype.removeSparklineGroup = function (id) {
for (var i = 0; i < this.aSparklineGroups.length; ++i) {
if (id === this.aSparklineGroups[i].Get_Id()) {
this.aSparklineGroups.splice(i, 1);
break;
}
}
};
//-------------------------------------------------------------------------------------------------
/**
......
......@@ -4717,7 +4717,7 @@ CellArea.prototype = {
this.f = null;
this.arrSparklines = [];
this.arrCachedSparklines = [];
this.arrCachedSparklines = {};
//for drawing preview
this.canvas = null;
......@@ -4922,7 +4922,7 @@ CellArea.prototype = {
var api_sheet = Asc['editor'];
this.worksheet = api_sheet.wbModel.getWorksheetById(r.GetString2());
if (this.worksheet) {
this.worksheet.insertSparkline(this);
this.worksheet.insertSparklineGroup(this);
}
};
sparklineGroup.prototype.Undo = function (data) {
......@@ -5195,13 +5195,13 @@ CellArea.prototype = {
graphics.init(oDrawingContext.ctx, oDrawingContext.getWidth(0), oDrawingContext.getHeight(0),
oDrawingContext.getWidth(3), oDrawingContext.getHeight(3));
graphics.m_oFontManager = AscCommon.g_fontManager;
for (var i = 0; i < this.arrCachedSparklines.length; ++i) {
for (var i in this.arrCachedSparklines) {
this.arrCachedSparklines[i].draw(graphics);
}
};
sparklineGroup.prototype.cleanCache = function () {
// ToDo clean only colors (for color scheme)
this.arrCachedSparklines = [];
this.arrCachedSparklines = {};
};
sparklineGroup.prototype.updateCache = function (sheet, ranges) {
var sparklineRange;
......@@ -5209,7 +5209,7 @@ CellArea.prototype = {
sparklineRange = this.arrSparklines[i]._f;
for (var j = 0; j < ranges.length; ++j) {
if (sparklineRange.isIntersect(ranges[j], sheet)) {
this.arrCachedSparklines[i] = null;
delete this.arrCachedSparklines[i];
break;
}
}
......@@ -5223,6 +5223,17 @@ CellArea.prototype = {
}
return -1;
};
sparklineGroup.prototype.remove = function (range) {
for (var i = 0; i < this.arrSparklines.length; ++i) {
if (this.arrSparklines[i].checkInRange(range)) {
this.arrSparklines.splice(i, 1);
delete this.arrCachedSparklines[i];
--i;
}
}
return 0 === this.arrSparklines.length;
};
sparklineGroup.prototype.asc_getId = function () {
return this.Id;
};
......
......@@ -8590,6 +8590,7 @@
if (val === c_oAscCleanOptions.All) {
range.cleanAll();
t.model.removeSparkline(arn);
// Удаляем комментарии
t.cellCommentator.deleteCommentsRange(arn);
} else if (val === c_oAscCleanOptions.Text || val === c_oAscCleanOptions.Formula) {
......
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