- Move keyboard events as part of a separate class.

- TextEditor is now one instance peer node.
- Broken: f2 and start writting on typing.
This commit is contained in:
Paulo Veiga
2011-08-19 13:38:37 -03:00
parent 78f312ef0a
commit f3e024735d
22 changed files with 759 additions and 799 deletions

View File

@@ -26,9 +26,7 @@ mindplot.Topic = new Class({
this._relationships = [];
this._isInWorkspace = false;
this._helpers = [];
this._buildShape();
this.setMouseEventsEnabled(true);
// Position a topic ....
var pos = model.getPosition();
@@ -36,15 +34,31 @@ mindplot.Topic = new Class({
this.setPosition(pos);
}
this.registerEvents();
// Register events for the topic ...
this._registerEvents();
},
registerEvents:function () {
_registerEvents : function() {
this.setMouseEventsEnabled(true);
// Prevent click on the topics being propagated ...
this.addEventListener('click', function(event) {
event.stopPropagation();
});
this.addEventListener('dblclick', function (event) {
this._textEditor.show();
event.stopPropagation(true);
}.bind(this));
this.addEventListener('keydown', function(event) {
if (this.isOnFocus()) {
this._textEditor.show();
}
}.bind(this));
},
setShapeType : function(type) {