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

fix bug 33626 🐛

parent 7d269741
...@@ -1169,13 +1169,6 @@ ...@@ -1169,13 +1169,6 @@
canExpH = this._expandHeight(); canExpH = this._expandHeight();
doAjust = true; 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) { if (doAjust) {
this._adjustCanvas(); this._adjustCanvas();
...@@ -1328,16 +1321,16 @@ ...@@ -1328,16 +1321,16 @@
} }
}; };
CellEditor.prototype._renderText = function ( dy ) { CellEditor.prototype._renderText = function (dy) {
var t = this, opt = t.options, ctx = t.drawingCtx; var t = this, opt = t.options, ctx = t.drawingCtx;
if ( !window['IS_NATIVE_EDITOR'] ) { if (!window['IS_NATIVE_EDITOR']) {
ctx.setFillStyle( opt.background ) ctx.setFillStyle(opt.background)
.fillRect( 0, 0, ctx.getWidth(), ctx.getHeight() ); .fillRect(0, 0, ctx.getWidth(), ctx.getHeight());
} }
if ( opt.fragments.length > 0 ) { if (opt.fragments.length > 0) {
t.textRender.render( t._getContentLeft(), (dy === undefined ? 0 : dy), t._getContentWidth(), opt.textColor ); t.textRender.render(t._getContentLeft(), dy || 0, t._getContentWidth(), opt.textColor);
} }
}; };
......
...@@ -208,14 +208,6 @@ ...@@ -208,14 +208,6 @@
} }
co = this.charOffset(pos, i - 1, h); 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; return co;
}; };
...@@ -240,10 +232,6 @@ ...@@ -240,10 +232,6 @@
return this.charWidths[pos]; return this.charWidths[pos];
}; };
CellTextRender.prototype.isLastCharNL = function () {
return this.charWidths[this.chars.length - 1] === 0;
};
//------------------------------------------------------------export--------------------------------------------------- //------------------------------------------------------------export---------------------------------------------------
window['AscCommonExcel'] = window['AscCommonExcel'] || {}; window['AscCommonExcel'] = window['AscCommonExcel'] || {};
......
...@@ -648,13 +648,13 @@ ...@@ -648,13 +648,13 @@
*/ */
StringRender.prototype._calcTextMetrics = function (dontCalcRepeatChars) { StringRender.prototype._calcTextMetrics = function (dontCalcRepeatChars) {
var self = this, i = 0, p, p_, lm, beg = 0; 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) { function addLine(b, e) {
if (-1 !== b) if (-1 !== b)
l.tw += self._calcLineWidth(b, e - 1); l.tw += self._calcLineWidth(b, e);
l.beg = b; l.beg = b;
l.end = e - 1; l.end = e;
self.lines.push(l); self.lines.push(l);
if (TW < l.tw) {TW = l.tw;} if (TW < l.tw) {TW = l.tw;}
BL = TH + l.bl; BL = TH + l.bl;
...@@ -696,21 +696,17 @@ ...@@ -696,21 +696,17 @@
// process 'new line' marker // process 'new line' marker
if (p && (p.nl || p.hp)) { if (p && (p.nl || p.hp)) {
addLine(beg, i); 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); 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); l = new LineInfo(0, lm.th, lm.bl, lm.a, lm.d);
} }
} }
} if (beg <= i) {
if (beg < i) {
// add last line of text // add last line of text
addLine(beg, i); addLine(beg, i - 1);
} }
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 () { StringRender.prototype._getRepeatCharPos = function () {
...@@ -836,7 +832,7 @@ ...@@ -836,7 +832,7 @@
if (isNL) { if (isNL) {
// add new line marker // add new line marker
nlPos = chPos + 1; nlPos = chPos;
self._getCharPropAt(nlPos).nl = true; self._getCharPropAt(nlPos).nl = true;
self._getCharPropAt(nlPos).delta = delta; self._getCharPropAt(nlPos).delta = delta;
ch = " "; ch = " ";
...@@ -1067,6 +1063,9 @@ ...@@ -1067,6 +1063,9 @@
x1 += renderFragment(strBeg, i, p_, this.angle); x1 += renderFragment(strBeg, i, p_, this.angle);
strBeg = i; strBeg = i;
} }
if (p.nl) {
strBeg += 1;
}
if (p.font) { if (p.font) {
// change canvas font style // 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