Commit d4433d20 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Поправил баг с позицией курсора в редакторе ячейки

Баг http://bugzserver/show_bug.cgi?id=25503

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57377 954022d7-b5bf-4e40-9824-e11837661b57
parent e4b7d166
...@@ -1081,44 +1081,43 @@ ...@@ -1081,44 +1081,43 @@
CellEditor.prototype._updateCursorPosition = function (redrawText) { CellEditor.prototype._updateCursorPosition = function (redrawText) {
// ToDo стоит переправить данную функцию // ToDo стоит переправить данную функцию
var t = this; var h = this.canvas.height;
var h = t.canvas.height; var y = - this.textRender.calcLineOffset(this.topLineIndex);
var y = - t.textRender.calcLineOffset(t.topLineIndex); var cur = this.textRender.calcCharOffset(this.cursorPos);
var cur = t.textRender.calcCharOffset(t.cursorPos); var charsCount = this.textRender.getCharsCount();
var charsCount = t.textRender.getCharsCount(); var curLeft = asc_round(((kRightAlign !== this.textFlags.textAlign || this.cursorPos !== charsCount) &&
var curLeft = asc_round(((kRightAlign !== t.textFlags.textAlign || t.cursorPos !== charsCount) && cur !== null && cur.left !== null ? cur.left : this._getContentPosition()) * this.kx);
cur !== null && cur.left !== null ? cur.left : t._getContentPosition()) * t.kx); var curTop = asc_round(((cur !== null ? cur.top : 0) + y) * this.ky);
var curTop = asc_round(((cur !== null ? cur.top : 0) + y) * t.ky); var curHeight = asc_round((cur !== null ? cur.height : this._getContentHeight()) * this.ky);
var curHeight = asc_round((cur !== null ? cur.height : t._getContentHeight()) * t.ky);
var i, dy; var i, dy;
while (t.textRender.getLinesCount() > 1) { while (this.textRender.getLinesCount() > 1) {
if (curTop + curHeight - 1 > h) { if (curTop + curHeight - 1 > h) {
i = i === undefined ? 0 : i + 1; i = i === undefined ? 0 : i + 1;
dy = t.textRender.getLineInfo(i).th; dy = this.textRender.getLineInfo(i).th;
y -= dy; y -= dy;
curTop -= asc_round(dy * t.ky); curTop -= asc_round(dy * this.ky);
++t.topLineIndex; ++this.topLineIndex;
continue; continue;
} }
if (curTop < 0) { if (curTop < 0) {
--t.topLineIndex; --this.topLineIndex;
dy = t.textRender.getLineInfo(t.topLineIndex).th; dy = this.textRender.getLineInfo(this.topLineIndex).th;
y += dy; y += dy;
curTop += asc_round(dy * t.ky); curTop += asc_round(dy * this.ky);
continue; continue;
} }
break; break;
} }
if (dy !== undefined || redrawText) {t._renderText(y);} if (dy !== undefined || redrawText) {this._renderText(y);}
t.cursorStyle.left = curLeft + "px"; this.cursorStyle.left = curLeft + "px";
t.cursorStyle.top = curTop + "px"; this.cursorStyle.top = curTop + "px";
t.cursorStyle.height = curHeight + "px"; this.cursorStyle.height = curHeight + "px";
if (cur) {t.input.scrollTop = t.input.clientHeight * cur.lineIndex;} if (cur) {this.input.scrollTop = this.input.clientHeight * cur.lineIndex;}
if (t.isTopLineActive && !t.skipTLUpdate) {t._updateTopLineCurPos();} if (this.isTopLineActive && !this.skipTLUpdate) {this._updateTopLineCurPos();}
}; };
CellEditor.prototype._moveCursor = function (kind, pos) { CellEditor.prototype._moveCursor = function (kind, pos) {
......
...@@ -165,9 +165,8 @@ ...@@ -165,9 +165,8 @@
}, },
charOffset: function (pos, lineIndex, h) { charOffset: function (pos, lineIndex, h) {
var ci = this.getCharInfo(pos);
var li = this.lines[lineIndex]; var li = this.lines[lineIndex];
return new CharOffset(li.startX + (pos > 0 ? this._calcCharsWidth(li.beg, pos - 1) : 0), h, ci.h, lineIndex); return new CharOffset(li.startX + (pos > 0 ? this._calcCharsWidth(li.beg, pos - 1) : 0), h, li.th, lineIndex);
}, },
calcCharOffset: function (pos) { calcCharOffset: function (pos) {
......
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