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

fix bug 33626 🐛

parent 7d269741
......@@ -1169,13 +1169,6 @@
canExpH = this._expandHeight();
doAjust = true;
}
if (this.textRender.isLastCharNL() && !doAjust && canExpH) {
var lm = this.textRender.calcCharHeight(this.textRender.getCharsCount() - 1);
if (tm.height + lm.th > this._getContentHeight()) {
this._expandHeight();
doAjust = true;
}
}
}
if (doAjust) {
this._adjustCanvas();
......@@ -1328,16 +1321,16 @@
}
};
CellEditor.prototype._renderText = function ( dy ) {
CellEditor.prototype._renderText = function (dy) {
var t = this, opt = t.options, ctx = t.drawingCtx;
if ( !window['IS_NATIVE_EDITOR'] ) {
ctx.setFillStyle( opt.background )
.fillRect( 0, 0, ctx.getWidth(), ctx.getHeight() );
if (!window['IS_NATIVE_EDITOR']) {
ctx.setFillStyle(opt.background)
.fillRect(0, 0, ctx.getWidth(), ctx.getHeight());
}
if ( opt.fragments.length > 0 ) {
t.textRender.render( t._getContentLeft(), (dy === undefined ? 0 : dy), t._getContentWidth(), opt.textColor );
if (opt.fragments.length > 0) {
t.textRender.render(t._getContentLeft(), dy || 0, t._getContentWidth(), opt.textColor);
}
};
......
......@@ -208,14 +208,6 @@
}
co = this.charOffset(pos, i - 1, h);
// если самый последний символ - это новая строка, то надо сместить еще на одну линию
if (t.charWidths[t.chars.length - 1] === 0) {
co.left = null;
co.top += l[i - 1].th;
co.lineIndex++;
}
return co;
};
......@@ -240,10 +232,6 @@
return this.charWidths[pos];
};
CellTextRender.prototype.isLastCharNL = function () {
return this.charWidths[this.chars.length - 1] === 0;
};
//------------------------------------------------------------export---------------------------------------------------
window['AscCommonExcel'] = window['AscCommonExcel'] || {};
......
......@@ -648,13 +648,13 @@
*/
StringRender.prototype._calcTextMetrics = function (dontCalcRepeatChars) {
var self = this, i = 0, p, p_, lm, beg = 0;
var l = new LineInfo(), TW = 0, TH = 0, BL = 0, CL = 0;
var l = new LineInfo(), TW = 0, TH = 0, BL = 0;
function addLine(b, e) {
if (-1 !== b)
l.tw += self._calcLineWidth(b, e - 1);
l.tw += self._calcLineWidth(b, e);
l.beg = b;
l.end = e - 1;
l.end = e;
self.lines.push(l);
if (TW < l.tw) {TW = l.tw;}
BL = TH + l.bl;
......@@ -696,21 +696,17 @@
// process 'new line' marker
if (p && (p.nl || p.hp)) {
addLine(beg, i);
beg = i;
beg = i + (p.nl ? 1 : 0);
lm = this._calcLineMetrics(p_.fsz !== undefined ? p_.fsz : p_.font.FontSize, p_.va, p_.fm);
l = new LineInfo(0, lm.th, lm.bl, lm.a, lm.d);
}
}
if (beg <= i) {
// add last line of text
addLine(beg, i - 1);
}
}
if (beg < i) {
// add last line of text
addLine(beg, i);
}
if (this.lines.length > 0) {
CL = (this.lines[0].bl - this.lines[0].a + BL + l.d) / 2;
}
return new asc.TextMetrics(TW, TH, 0, BL, 0, 0, CL);
return new asc.TextMetrics(TW, TH, 0, BL, 0, 0, (this.lines[0].bl - this.lines[0].a + BL + l.d) / 2);
};
StringRender.prototype._getRepeatCharPos = function () {
......@@ -836,7 +832,7 @@
if (isNL) {
// add new line marker
nlPos = chPos + 1;
nlPos = chPos;
self._getCharPropAt(nlPos).nl = true;
self._getCharPropAt(nlPos).delta = delta;
ch = " ";
......@@ -1067,6 +1063,9 @@
x1 += renderFragment(strBeg, i, p_, this.angle);
strBeg = i;
}
if (p.nl) {
strBeg += 1;
}
if (p.font) {
// change canvas font style
......
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