From 6619447aa1e0058d9b693c7c5712a9be85dfe686 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Thu, 3 Mar 2011 23:06:53 +0000 Subject: [PATCH] Convert ToolEvent type constants to Sg-style hyphenated lowercase strings. --- src/tool/Tool.js | 8 ++++---- src/tool/ToolEvent.js | 8 ++++---- src/tool/ToolHandler.js | 14 +++++++------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/tool/Tool.js b/src/tool/Tool.js index fc729dee..2dccfe10 100644 --- a/src/tool/Tool.js +++ b/src/tool/Tool.js @@ -23,7 +23,7 @@ var Tool = ToolHandler.extend(new function() { var events = { dragstart: function(e) { curPoint = viewToArtwork(e, that._document); - that.onHandleEvent('MOUSE_DOWN', curPoint, null, null); + that.onHandleEvent('mouse-down', curPoint, null, null); if (that.onMouseDown) that._document.redraw(); if (that.eventInterval != -1) @@ -34,7 +34,7 @@ var Tool = ToolHandler.extend(new function() { drag: function(e) { if (e) curPoint = viewToArtwork(e, that._document); if (curPoint) { - that.onHandleEvent('MOUSE_DRAG', curPoint, null, null); + that.onHandleEvent('mouse-drag', curPoint, null, null); if (that.onMouseDrag) that._document.redraw(); } @@ -43,7 +43,7 @@ var Tool = ToolHandler.extend(new function() { curPoint = null; if (this.eventInterval != -1) clearInterval(this.intervalId); - that.onHandleEvent('MOUSE_UP', + that.onHandleEvent('mouse-up', viewToArtwork(e, that._document), null, null); if (that.onMouseUp) that._document.redraw(); @@ -51,7 +51,7 @@ var Tool = ToolHandler.extend(new function() { }, mousemove: function(e) { if (!dragging) { - that.onHandleEvent('MOUSE_MOVE', + that.onHandleEvent('mouse-move', viewToArtwork(e, that._document), null, null); if (that.onMouseMove) that._document.redraw(); diff --git a/src/tool/ToolEvent.js b/src/tool/ToolEvent.js index 76030f01..f8f0a4a7 100644 --- a/src/tool/ToolEvent.js +++ b/src/tool/ToolEvent.js @@ -182,8 +182,8 @@ ToolEvent = Base.extend({ */ getCount: function() { switch (this.type) { - case 'MOUSE_DOWN': - case 'MOUSE_UP': + case 'mouse-down': + case 'mouse-up': // Return downCount for both mouse down and up, since // the count is the same. return this.tool.downCount; @@ -194,8 +194,8 @@ ToolEvent = Base.extend({ setCount: function(count) { switch (this.type) { - case 'MOUSE_DOWN': - case 'MOUSE_UP': + case 'mouse-down': + case 'mouse-up': this.tool.downCount = count; break; default: diff --git a/src/tool/ToolHandler.js b/src/tool/ToolHandler.js index 8d5e311c..b0f432da 100644 --- a/src/tool/ToolHandler.js +++ b/src/tool/ToolHandler.js @@ -83,12 +83,12 @@ var ToolHandler = Base.extend({ this.lastPoint = this.point; this.point = pt; switch (type) { - case 'MOUSE_DOWN': + case 'mouse-down': this.lastPoint = this.downPoint; this.downPoint = this.point; this.downCount++; break; - case 'MOUSE_UP': + case 'mouse-up': // Mouse up events return the down point for last point, // so delta is spanning over the whole drag. this.lastPoint = this.downPoint; @@ -104,12 +104,12 @@ var ToolHandler = Base.extend({ onHandleEvent: function(type, pt, modifiers) { switch (type) { - case 'MOUSE_DOWN': + case 'mouse-down': this.updateEvent(type, pt, null, null, true, false, false); if (this.onMouseDown) this.onMouseDown(new ToolEvent(this, type, modifiers)); break; - case 'MOUSE_DRAG': + case 'mouse-drag': // In order for idleInterval drag events to work, we need to // not check the first call for a change of position. // Subsequent calls required by min/maxDistance functionality @@ -129,11 +129,11 @@ var ToolHandler = Base.extend({ this.matchMaxDistance = true; } break; - case 'MOUSE_UP': + case 'mouse-up': // If the last mouse drag happened in a different place, call // 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.updateEvent('mouse-drag', pt, this.minDistance, this.maxDistance, false, false, false)) { if (this.onMouseDrag) this.onMouseDrag(new ToolEvent(this, type, modifiers)); @@ -146,7 +146,7 @@ var ToolHandler = Base.extend({ this.updateEvent(type, pt, null, null, true, false, false); this.firstMove = true; break; - case 'MOUSE_MOVE': + case 'mouse-move': while (this.updateEvent(type, pt, this.minDistance, this.maxDistance, this.firstMove, true, false)) { if (this.onMouseMove)