fixing text editor bug when dragging nodes

This commit is contained in:
Pablo Luna 2011-04-03 08:00:17 +01:00
parent a0010e7cc7
commit dc2d074fa5
2 changed files with 17 additions and 6 deletions

View File

@ -58,7 +58,7 @@ mindplot.DragManager.prototype.add = function(node)
window.document.body.style.cursor = 'move'; window.document.body.style.cursor = 'move';
} }
}; };
dragManager._mouseMoveListener = mouseDownListener; dragManager._mouseDownListener = mouseDownListener;
node.addEventListener('mousedown', mouseDownListener); node.addEventListener('mousedown', mouseDownListener);
}; };

View File

@ -68,8 +68,9 @@ mindplot.TextEditor = function(screenManager,actionRunner)
}; };
//Register onLostFocus/onBlur event //Register onLostFocus/onBlur event
$(this.inputText).addEvent('blur', this.lostFocusEvent.bind(this)); $(this.inputText).addEvent('blur', this.lostFocusEvent.bind(this));
$(this.inputText).addEvent('click', this.clickEvent.bindWithEvent(this)); $(this._myOverlay).addEvent('click', this.clickEvent.bindWithEvent(this));
$(this.inputText).addEvent('dblclick', this.clickEvent.bindWithEvent(this)); $(this._myOverlay).addEvent('dblclick', this.clickEvent.bindWithEvent(this));
$(this._myOverlay).addEvent('mousedown', this.mouseDownEvent.bindWithEvent(this));
var elem = this; var elem = this;
var onComplete = function() { var onComplete = function() {
@ -99,7 +100,6 @@ mindplot.TextEditor.prototype.lostFocusEvent = function ()
{ {
this.fx.options.duration = 10; this.fx.options.duration = 10;
this.fx.start(1, 0); this.fx.start(1, 0);
designer.getWorkSpace().enableWorkspaceEvents(true);
//myAnim.animate(); //myAnim.animate();
}; };
@ -326,7 +326,6 @@ mindplot.TextEditor.prototype.setPosition = function (x, y, scale)
mindplot.TextEditor.prototype.showTextEditor = function(selectText) mindplot.TextEditor.prototype.showTextEditor = function(selectText)
{ {
designer.getWorkSpace().enableWorkspaceEvents(false);
//this._myOverlay.show(); //this._myOverlay.show();
//var myAnim = new YAHOO.util.Anim('inputText',{opacity: {to:1}}, 0.10, YAHOO.util.Easing.easeOut); //var myAnim = new YAHOO.util.Anim('inputText',{opacity: {to:1}}, 0.10, YAHOO.util.Easing.easeOut);
//$('inputText').style.opacity='1'; //$('inputText').style.opacity='1';
@ -398,7 +397,19 @@ mindplot.TextEditor.prototype.clickEvent = function(event){
{ {
event.cancelBubble = true; event.cancelBubble = true;
} }
}
event.preventDefault(); event.preventDefault();
}
};
mindplot.TextEditor.prototype.mouseDownEvent = function(event){
if(this._isVisible()){
if (event.stopPropagation)
{
event.stopPropagation(true);
} else
{
event.cancelBubble = true;
}
}
}; };