still removing .bind(this) usages

This commit is contained in:
Ezequiel Bergamaschi
2014-12-26 18:07:31 -03:00
parent c1e3d07957
commit dc58509a0f
12 changed files with 60 additions and 215 deletions

View File

@@ -82,9 +82,10 @@ mindplot.RelationshipPivot = new Class({
var model = this._designer.getModel();
var topics = model.getTopics();
var me = this;
_.each(topics, function (topic) {
topic.removeEvent('ontfocus', this._onTopicClick);
}.bind(this));
topic.removeEvent('ontfocus', me._onTopicClick);
});
workspace.removeChild(this._pivot);
workspace.removeChild(this._startArrow);

View File

@@ -26,7 +26,7 @@ mindplot.ScreenManager = new Class({
this._clickEvents = [];
this._divContainer.bind('click', function(event) {
event.stopPropagation()
}.bind(this));
});
this._divContainer.bind('dblclick', function(event) {
event.stopPropagation();

View File

@@ -50,11 +50,11 @@ mindplot.ShirinkConnector = new Class({
ellipse.setFill('rgb(153, 0, 255)');
});
var me = this;
ellipse.addEvent('mouseout', function(event) {
var color = topic.getBackgroundColor();
this.setFill(color);
}.bind(this));
me.setFill(color);
});
ellipse.setCursor('default');
this._fillColor = '#f7f7f7';
@@ -104,4 +104,4 @@ mindplot.ShirinkConnector = new Class({
moveToFront: function() {
this._ellipse.moveToFront();
}
});
});

View File

@@ -68,14 +68,15 @@ mindplot.TextEditor = new Class({
_registerEvents : function(divElem) {
var inputElem = this._getTextareaElem();
var spanElem = this._getSpanElem();
var me = this;
divElem.addEvent('keydown', function (event) {
switch (event.key) {
case 'esc':
this.close(false);
me.close(false);
break;
case 'enter':
this.close(true);
me.close(true);
break;
default:
spanElem.innerHTML = inputElem.value;
@@ -87,7 +88,7 @@ mindplot.TextEditor = new Class({
break;
}
event.stopPropagation();
}.bind(this));
});
// If the user clicks on the input, all event must be ignored ...
divElem.addEvent('click', function(event) {

View File

@@ -47,11 +47,11 @@ mindplot.Topic = new Class({
this.addEvent('click', function (event) {
event.stopPropagation();
});
var me = this;
this.addEvent('dblclick', function (event) {
this._getTopicEventDispatcher().show(this);
me._getTopicEventDispatcher().show(me);
event.stopPropagation();
}.bind(this));
});
},
setShapeType:function (type) {
@@ -576,24 +576,25 @@ mindplot.Topic = new Class({
};
elem.addEvent('mouseout', outout);
var me = this;
// Focus events ...
elem.addEvent('mousedown', function (event) {
if (!this.isReadOnly()) {
if (!me.isReadOnly()) {
// Disable topic selection of readOnly mode ...
var value = true;
if ((event.metaKey && Browser.Platform.mac) || (event.ctrlKey && !Browser.Platform.mac)) {
value = !this.isOnFocus();
value = !me.isOnFocus();
event.stopPropagation();
event.preventDefault();
}
topic.setOnFocus(value);
}
var eventDispatcher = this._getTopicEventDispatcher();
eventDispatcher.process(mindplot.TopicEvent.CLICK, this);
var eventDispatcher = me._getTopicEventDispatcher();
eventDispatcher.process(mindplot.TopicEvent.CLICK, me);
event.stopPropagation();
}.bind(this));
});
},
areChildrenShrunken:function () {
@@ -626,10 +627,11 @@ mindplot.Topic = new Class({
// Do some fancy animation ....
var elements = this._flatten2DElements(this);
var fade = new mindplot.util.FadeEffect(elements, !value);
var me = this;
fade.addEvent('complete', function () {
// Set focus on the parent node ...
if (value) {
this.setOnFocus(true);
me.setOnFocus(true);
}
// Set focus in false for all the children ...
@@ -638,7 +640,7 @@ mindplot.Topic = new Class({
elem.setOnFocus(false);
}
});
}.bind(this));
});
fade.start();
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeShrinkEvent, model);

View File

@@ -189,7 +189,7 @@ mindplot.Workspace = new Class({
wasDragged = true;
}.bind(this);
};
screenManager.addEvent('mousemove', workspace._mouseMoveListener);
// Register mouse up listeners ...