Remove try/catch clauses and add missing check for existance of onMouseUp

This commit is contained in:
Jonathan Puckey 2011-02-09 01:07:29 +01:00
parent 0cefc146bb
commit 440db1c1e3

View file

@ -101,7 +101,6 @@ ToolHandler = Base.extend({
},
onHandleEvent: function(type, pt, modifiers) {
try {
switch (type) {
case 'MOUSE_DOWN':
this.updateEvent(type, pt, null, null, true, false, false);
@ -121,12 +120,8 @@ ToolHandler = Base.extend({
this.matchMaxDistance = false;
while (this.updateEvent(type, pt, this.minDistance,
this.maxDistance, false, this.needsChange, this.matchMaxDistance)) {
try {
if(this.onMouseDrag)
this.onMouseDrag(new ToolEvent(this, type, modifiers));
} catch (e) {
// ScriptographerEngine.reportError(e);
}
this.needsChange = true;
this.matchMaxDistance = true;
}
@ -136,20 +131,13 @@ ToolHandler = Base.extend({
// mouse drag first, then mouse up.
if ((this.point.x != pt.x || this.point.y != pt.y) && this.updateEvent(
'MOUSE_DRAG', pt, this.minDistance, this.maxDistance, false, false, false)) {
try {
if(this.onMouseDrag)
this.onMouseDrag(new ToolEvent(this, type, modifiers));
} catch (e) {
// ScriptographerEngine.reportError(e);
}
}
this.updateEvent(type, pt, null, this.maxDistance, false,
false, false);
try {
if(this.onMouseUp)
this.onMouseUp(new ToolEvent(this, type, modifiers));
} catch (e) {
// ScriptographerEngine.reportError(e);
}
// Start with new values for TRACK_CURSOR
this.updateEvent(type, pt, null, null, true, false, false);
this.firstMove = true;
@ -157,18 +145,11 @@ ToolHandler = Base.extend({
case 'MOUSE_MOVE':
while (this.updateEvent(type, pt, this.minDistance,
this.maxDistance, this.firstMove, true, false)) {
try {
if(this.onMouseMove)
this.onMouseMove(new ToolEvent(this, type, modifiers));
} catch (e) {
// ScriptographerEngine.reportError(e);
}
this.firstMove = false;
}
break;
}
} catch (e) {
//ScriptographerEngine.reportError(e);
}
}
});