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