Merge pull request #1450 from ChrisBuergi/fire-event-on-itext-object

Fire 'selection:changed' on IText object.
This commit is contained in:
Stefan Kienzle 2014-07-03 11:17:06 +02:00
commit 0572b99718
2 changed files with 4 additions and 0 deletions

View file

@ -156,6 +156,7 @@
selectAll: function() {
this.selectionStart = 0;
this.selectionEnd = this.text.length;
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
},

View file

@ -9,6 +9,7 @@
* @mixes fabric.Observable
*
* @fires changed ("text:changed" when observing canvas)
* @fires selection:changed ("text:selection:changed" when observing canvas)
* @fires editing:entered ("text:editing:entered" when observing canvas)
* @fires editing:exited ("text:editing:exited" when observing canvas)
*
@ -219,6 +220,7 @@
*/
setSelectionStart: function(index) {
if (this.selectionStart !== index) {
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
}
this.selectionStart = index;
@ -231,6 +233,7 @@
*/
setSelectionEnd: function(index) {
if (this.selectionEnd !== index) {
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
}
this.selectionEnd = index;