Update itext_behavior.mixin.js

This commit is contained in:
Andrea Bogazzi 2015-03-02 13:48:55 +01:00
parent dda96f9b81
commit 57329b39be

View file

@ -342,28 +342,31 @@
this._tick();
this.fire('editing:entered');
if (this.canvas) {
var _this = this;
this.canvas.renderAll();
this.canvas.fire('text:editing:entered', { target: this });
this.canvas.on('mouse:move', function(options) {
if (!_this.__isMousedown || !_this.isEditing) {
return;
}
var newSelectionStart = _this.getSelectionStartFromPointer(options.e);
if (newSelectionStart >= _this.__selectionStartOnMouseDown) {
_this.setSelectionStart(_this.__selectionStartOnMouseDown);
_this.setSelectionEnd(newSelectionStart);
}
else {
_this.setSelectionStart(newSelectionStart);
_this.setSelectionEnd(_this.__selectionStartOnMouseDown);
}
});
if (!this.canvas) {
return this;
}
var _this = this;
this.canvas.renderAll();
this.canvas.fire('text:editing:entered', { target: this });
this.canvas.on('mouse:move', function(options) {
if (!_this.__isMousedown || !_this.isEditing) {
return;
}
var newSelectionStart = _this.getSelectionStartFromPointer(options.e);
if (newSelectionStart >= _this.__selectionStartOnMouseDown) {
_this.setSelectionStart(_this.__selectionStartOnMouseDown);
_this.setSelectionEnd(newSelectionStart);
}
else {
_this.setSelectionStart(newSelectionStart);
_this.setSelectionEnd(_this.__selectionStartOnMouseDown);
}
});
return this;
},