Fire selection:changed event when changing iText selection with keys. Closes #1165

This commit is contained in:
kangax 2014-11-08 17:04:04 +01:00
parent c38c9c3ffa
commit 1d8d998ed5
5 changed files with 73 additions and 1 deletions

24
dist/fabric.js vendored
View file

@ -22679,6 +22679,9 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
this.selectionStart = this.text.length;
}
this.selectionEnd = this.selectionStart;
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
},
/**
@ -22707,6 +22710,9 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
if (this.selectionEnd > this.text.length) {
this.selectionEnd = this.text.length;
}
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
},
/**
@ -22822,6 +22828,9 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
if (this.selectionStart < 0) {
this.selectionStart = 0;
}
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
},
/**
@ -22838,6 +22847,9 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
this.selectionEnd = this.selectionStart;
this._selectionDirection = 'left';
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
},
/**
@ -22904,6 +22916,9 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
this._moveLeft(e, 'selectionStart');
}
this.selectionEnd = this.selectionStart;
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
},
/**
@ -22926,6 +22941,9 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
this.selectionStart = 0;
}
}
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
},
/**
@ -22970,6 +22988,9 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
this.selectionEnd = this.text.length;
}
}
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
},
/**
@ -22990,6 +23011,9 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
}
this.selectionStart = this.selectionEnd;
}
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
},
/**

2
dist/fabric.min.js vendored

File diff suppressed because one or more lines are too long

BIN
dist/fabric.min.js.gz vendored

Binary file not shown.

View file

@ -22679,6 +22679,9 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
this.selectionStart = this.text.length;
}
this.selectionEnd = this.selectionStart;
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
},
/**
@ -22707,6 +22710,9 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
if (this.selectionEnd > this.text.length) {
this.selectionEnd = this.text.length;
}
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
},
/**
@ -22822,6 +22828,9 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
if (this.selectionStart < 0) {
this.selectionStart = 0;
}
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
},
/**
@ -22838,6 +22847,9 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
this.selectionEnd = this.selectionStart;
this._selectionDirection = 'left';
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
},
/**
@ -22904,6 +22916,9 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
this._moveLeft(e, 'selectionStart');
}
this.selectionEnd = this.selectionStart;
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
},
/**
@ -22926,6 +22941,9 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
this.selectionStart = 0;
}
}
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
},
/**
@ -22970,6 +22988,9 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
this.selectionEnd = this.text.length;
}
}
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
},
/**
@ -22990,6 +23011,9 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
}
this.selectionStart = this.selectionEnd;
}
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
},
/**

View file

@ -283,6 +283,9 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
this.selectionStart = this.text.length;
}
this.selectionEnd = this.selectionStart;
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
},
/**
@ -311,6 +314,9 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
if (this.selectionEnd > this.text.length) {
this.selectionEnd = this.text.length;
}
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
},
/**
@ -426,6 +432,9 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
if (this.selectionStart < 0) {
this.selectionStart = 0;
}
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
},
/**
@ -442,6 +451,9 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
this.selectionEnd = this.selectionStart;
this._selectionDirection = 'left';
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
},
/**
@ -508,6 +520,9 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
this._moveLeft(e, 'selectionStart');
}
this.selectionEnd = this.selectionStart;
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
},
/**
@ -530,6 +545,9 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
this.selectionStart = 0;
}
}
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
},
/**
@ -574,6 +592,9 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
this.selectionEnd = this.text.length;
}
}
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
},
/**
@ -594,6 +615,9 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
}
this.selectionStart = this.selectionEnd;
}
this.fire('selection:changed');
this.canvas && this.canvas.fire('text:selection:changed', { target: this });
},
/**