mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Convert ToolEvent type constants to Sg-style hyphenated lowercase strings.
This commit is contained in:
parent
ba7d2c0acf
commit
6619447aa1
3 changed files with 15 additions and 15 deletions
|
@ -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();
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue