mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-03-16 22:10:32 +00:00
fix (#4774)
This commit is contained in:
parent
d0a4ecba21
commit
8235c1aea5
1 changed files with 30 additions and 18 deletions
|
|
@ -15,12 +15,17 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
|
|||
this.on('mousedown', this.onMouseDown.bind(this));
|
||||
},
|
||||
|
||||
/**
|
||||
* Default event handler to simulate triple click
|
||||
* @private
|
||||
*/
|
||||
onMouseDown: function(options) {
|
||||
|
||||
if (!this.canvas) {
|
||||
return;
|
||||
}
|
||||
this.__newClickTime = +new Date();
|
||||
var newPointer = this.canvas.getPointer(options.e);
|
||||
|
||||
if (this.isTripleClick(newPointer, options.e)) {
|
||||
if (this.isTripleClick(newPointer)) {
|
||||
this.fire('tripleclick', options);
|
||||
this._stopEvent(options.e);
|
||||
}
|
||||
|
|
@ -104,6 +109,7 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
|
|||
},
|
||||
|
||||
/**
|
||||
* detect if object moved
|
||||
* @private
|
||||
*/
|
||||
_isObjectMoved: function(e) {
|
||||
|
|
@ -117,23 +123,29 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
|
|||
* Initializes "mouseup" event handler
|
||||
*/
|
||||
initMouseupHandler: function() {
|
||||
this.on('mouseup', function(options) {
|
||||
this.__isMousedown = false;
|
||||
if (!this.editable || this._isObjectMoved(options.e) || (options.e.button && options.e.button !== 1)) {
|
||||
return;
|
||||
}
|
||||
this.on('mouseup', this.mouseUpHandler);
|
||||
},
|
||||
|
||||
if (this.__lastSelected && !this.__corner) {
|
||||
this.enterEditing(options.e);
|
||||
if (this.selectionStart === this.selectionEnd) {
|
||||
this.initDelayedCursor(true);
|
||||
}
|
||||
else {
|
||||
this.renderCursorOrSelection();
|
||||
}
|
||||
/**
|
||||
* standard hander for mouse up, overridable
|
||||
* @private
|
||||
*/
|
||||
mouseUpHandler: function(options) {
|
||||
this.__isMousedown = false;
|
||||
if (!this.editable || this._isObjectMoved(options.e) || (options.e.button && options.e.button !== 1)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.__lastSelected && !this.__corner) {
|
||||
this.enterEditing(options.e);
|
||||
if (this.selectionStart === this.selectionEnd) {
|
||||
this.initDelayedCursor(true);
|
||||
}
|
||||
this.selected = true;
|
||||
});
|
||||
else {
|
||||
this.renderCursorOrSelection();
|
||||
}
|
||||
}
|
||||
this.selected = true;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue