mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-20 22:39:50 -05:00
Remove hyphen from event types, to go with the naming of the browser world more.
This commit is contained in:
parent
04ff593adc
commit
af8fd22ae2
5 changed files with 20 additions and 20 deletions
|
@ -937,7 +937,7 @@ var Item = this.Item = Base.extend({
|
|||
if (!func || !func._installed) {
|
||||
var hash = {};
|
||||
hash[handler] = function(event) {
|
||||
// Always clear the drag set on mouse-up
|
||||
// Always clear the drag set on mouseup
|
||||
if (name === 'up')
|
||||
sets.drag = {};
|
||||
removeAll(sets[name]);
|
||||
|
|
|
@ -31,7 +31,7 @@ var Tool = this.Tool = ToolHandler.extend(new function() {
|
|||
this.events = {
|
||||
mousedown: function(event) {
|
||||
curPoint = viewToArtwork(event, that._document);
|
||||
that.onHandleEvent('mouse-down', curPoint, event);
|
||||
that.onHandleEvent('mousedown', curPoint, event);
|
||||
if (that.onMouseDown)
|
||||
that._document.redraw();
|
||||
if (that.eventInterval != null) {
|
||||
|
@ -54,9 +54,9 @@ var Tool = this.Tool = ToolHandler.extend(new function() {
|
|||
if (dragging && !onlyMove) {
|
||||
curPoint = point || curPoint;
|
||||
if (curPoint)
|
||||
that.onHandleEvent('mouse-drag', curPoint, event);
|
||||
that.onHandleEvent('mousedrag', curPoint, event);
|
||||
} else if (!dragging || onlyMove) {
|
||||
that.onHandleEvent('mouse-move', point, event);
|
||||
that.onHandleEvent('mousemove', point, event);
|
||||
}
|
||||
if (that.onMouseMove || that.onMouseDrag)
|
||||
that._document.redraw();
|
||||
|
@ -67,7 +67,7 @@ var Tool = this.Tool = ToolHandler.extend(new function() {
|
|||
curPoint = null;
|
||||
if (that.eventInterval != null)
|
||||
clearInterval(this.timer);
|
||||
that.onHandleEvent('mouse-up',
|
||||
that.onHandleEvent('mouseup',
|
||||
viewToArtwork(event, that._document), event);
|
||||
if (that.onMouseUp)
|
||||
that._document.redraw();
|
||||
|
|
|
@ -122,8 +122,8 @@ var ToolEvent = this.ToolEvent = Base.extend({
|
|||
|
||||
/**
|
||||
* The difference between the current position and the last position of the
|
||||
* mouse when the event was fired. In case of the mouse-up event, the
|
||||
* difference to the mouse-down position is returned.
|
||||
* mouse when the event was fired. In case of the mouseup event, the
|
||||
* difference to the mousedown position is returned.
|
||||
*/
|
||||
getDelta: function() {
|
||||
// Do not put the calculated delta into delta, since this only reserved
|
||||
|
@ -161,8 +161,8 @@ var ToolEvent = this.ToolEvent = Base.extend({
|
|||
*/
|
||||
getCount: function() {
|
||||
switch (this.type) {
|
||||
case 'mouse-down':
|
||||
case 'mouse-up':
|
||||
case 'mousedown':
|
||||
case 'mouseup':
|
||||
// Return downCount for both mouse down and up, since
|
||||
// the count is the same.
|
||||
return this.tool.downCount;
|
||||
|
@ -173,8 +173,8 @@ var ToolEvent = this.ToolEvent = Base.extend({
|
|||
|
||||
setCount: function(count) {
|
||||
switch (this.type) {
|
||||
case 'mouse-down':
|
||||
case 'mouse-up':
|
||||
case 'mousedown':
|
||||
case 'mouseup':
|
||||
this.tool.downCount = count;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -98,12 +98,12 @@ var ToolHandler = this.ToolHandler = Base.extend({
|
|||
this.lastPoint = this.point;
|
||||
this.point = pt;
|
||||
switch (type) {
|
||||
case 'mouse-down':
|
||||
case 'mousedown':
|
||||
this.lastPoint = this.downPoint;
|
||||
this.downPoint = this.point;
|
||||
this.downCount++;
|
||||
break;
|
||||
case 'mouse-up':
|
||||
case 'mouseup':
|
||||
// Mouse up events return the down point for last point,
|
||||
// so delta is spanning over the whole drag.
|
||||
this.lastPoint = this.downPoint;
|
||||
|
@ -119,12 +119,12 @@ var ToolHandler = this.ToolHandler = Base.extend({
|
|||
|
||||
onHandleEvent: function(type, pt, event) {
|
||||
switch (type) {
|
||||
case 'mouse-down':
|
||||
case 'mousedown':
|
||||
this.updateEvent(type, pt, null, null, true, false, false);
|
||||
if (this.onMouseDown)
|
||||
this.onMouseDown(new ToolEvent(this, type, event));
|
||||
break;
|
||||
case 'mouse-drag':
|
||||
case 'mousedrag':
|
||||
// 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
|
||||
|
@ -143,11 +143,11 @@ var ToolHandler = this.ToolHandler = Base.extend({
|
|||
matchMaxDistance = true;
|
||||
}
|
||||
break;
|
||||
case 'mouse-up':
|
||||
case 'mouseup':
|
||||
// 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('mousedrag', pt, this.minDistance,
|
||||
this.maxDistance, false, false, false)) {
|
||||
if (this.onMouseDrag)
|
||||
this.onMouseDrag(new ToolEvent(this, type, event));
|
||||
|
@ -156,11 +156,11 @@ var ToolHandler = this.ToolHandler = Base.extend({
|
|||
false, false);
|
||||
if (this.onMouseUp)
|
||||
this.onMouseUp(new ToolEvent(this, type, event));
|
||||
// Start with new values for 'mouse-move'
|
||||
// Start with new values for 'mousemove'
|
||||
this.updateEvent(type, pt, null, null, true, false, false);
|
||||
this.firstMove = true;
|
||||
break;
|
||||
case 'mouse-move':
|
||||
case 'mousemove':
|
||||
while (this.updateEvent(type, pt, this.minDistance,
|
||||
this.maxDistance, this.firstMove, true, false)) {
|
||||
if (this.onMouseMove)
|
||||
|
|
|
@ -18,7 +18,7 @@ var KeyEvent = this.KeyEvent = Event.extend(new function() {
|
|||
return {
|
||||
initialize: function(down, key, character, event) {
|
||||
this.base(event);
|
||||
this.type = down ? 'key-down' : 'key-up';
|
||||
this.type = down ? 'keydown' : 'keyup';
|
||||
this.key = key;
|
||||
this.character = character;
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue