Commit 442cfa53 authored by Alexander.Trofimov's avatar Alexander.Trofimov

add CCacheMeasureEmpty for empty cells with font

parent 18ee6a2a
......@@ -1825,6 +1825,19 @@
asc_CCompleteMenu.prototype.asc_getName = function () {return this.name;};
asc_CCompleteMenu.prototype.asc_getType = function () {return this.type;};
function CCacheMeasureEmpty() {
this.cache = {};
}
CCacheMeasureEmpty.prototype.add = function (elem, val) {
var font = (this.cache[elem.fn] || (this.cache[elem.fn] = {}));
font[elem.fs] = val;
};
CCacheMeasureEmpty.prototype.get = function (elem) {
var font = this.cache[elem.fn];
return font ? font[elem.fs] : null;
};
var g_oCacheMeasureEmpty = new CCacheMeasureEmpty();
/*
* Export
* -----------------------------------------------------------------------------
......@@ -1987,4 +2000,6 @@
prot = asc_CCompleteMenu.prototype;
prot["asc_getName"] = prot.asc_getName;
prot["asc_getType"] = prot.asc_getType;
window["AscCommonExcel"].g_oCacheMeasureEmpty = g_oCacheMeasureEmpty;
})(window);
......@@ -4472,10 +4472,14 @@
// Пустая ячейка с измененной гарнитурой или размером, учитвается в высоте
str = c.getValue2();
if (0 < str.length) {
// Без текста не будет толка
strCopy = [str[0].clone()];
strCopy[0].text = 'A';
tm = this._roundTextMetrics(this.stringRender.measureString(strCopy, fl));
strCopy = str[0];
if (!(tm = AscCommonExcel.g_oCacheMeasureEmpty.get(strCopy))) {
// Без текста не будет толка
strCopy = strCopy.clone();
strCopy.text = 'A';
tm = this._roundTextMetrics(this.stringRender.measureString([strCopy], fl));
AscCommonExcel.g_oCacheMeasureEmpty.add(strCopy, tm);
}
this._updateRowHeight(tm, col, row, isMerged, fMergedRows);
}
}
......
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