Merge pull request #1532 from boonkerz/patch-1

Update to Fix select text in itext last letter issue #1429
This commit is contained in:
Juriy Zaytsev 2014-07-29 10:15:44 +02:00
commit 6769228d18

View file

@ -239,7 +239,7 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
if (mouseOffset.y < height) {
return this._getNewSelectionStartFromOffset(
mouseOffset, prevWidth, width, charIndex + i, jlen, j);
mouseOffset, prevWidth, width, charIndex + i, jlen);
}
}
@ -252,7 +252,7 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
/**
* @private
*/
_getNewSelectionStartFromOffset: function(mouseOffset, prevWidth, width, index, jlen, j) {
_getNewSelectionStartFromOffset: function(mouseOffset, prevWidth, width, index, jlen) {
var distanceBtwLastCharAndCursor = mouseOffset.x - prevWidth,
distanceBtwNextCharAndCursor = width - mouseOffset.x,
@ -268,10 +268,6 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
newSelectionStart = this.text.length;
}
if (j === jlen) {
newSelectionStart--;
}
return newSelectionStart;
}
});