2011-11-12 17:57:25 -05:00
|
|
|
/*
|
2013-01-28 21:03:27 -05:00
|
|
|
* Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
|
2011-11-12 17:57:25 -05:00
|
|
|
* http://paperjs.org/
|
|
|
|
*
|
2013-01-28 21:03:27 -05:00
|
|
|
* Copyright (c) 2011 - 2013, Juerg Lehni & Jonathan Puckey
|
2011-11-12 17:57:25 -05:00
|
|
|
* http://lehni.org/ & http://jonathanpuckey.com/
|
|
|
|
*
|
|
|
|
* Distributed under the MIT license. See LICENSE file for details.
|
|
|
|
*
|
|
|
|
* All rights reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name MouseEvent
|
|
|
|
*
|
2012-12-23 10:01:53 -05:00
|
|
|
* @class The MouseEvent object is received by the {@link Item}'s mouse event
|
|
|
|
* handlers {@link Item#onMouseDown}, {@link Item#onMouseDrag},
|
2011-12-01 05:57:10 -05:00
|
|
|
* {@link Item#onMouseMove}, {@link Item#onMouseUp}, {@link Item#onClick},
|
|
|
|
* {@link Item#onDoubleClick}, {@link Item#onMouseEnter} and
|
|
|
|
* {@link Item#onMouseLeave}. The MouseEvent object is the only parameter passed
|
|
|
|
* to these functions and contains information about the mouse event.
|
|
|
|
*
|
2011-11-12 17:57:25 -05:00
|
|
|
* @extends Event
|
|
|
|
*/
|
2013-05-27 15:48:58 -04:00
|
|
|
var MouseEvent = Event.extend(/** @lends MouseEvent# */{
|
2013-06-23 23:18:32 -04:00
|
|
|
_class: 'MouseEvent',
|
|
|
|
|
2013-05-27 15:48:58 -04:00
|
|
|
initialize: function MouseEvent(type, event, point, target, delta) {
|
2013-05-27 12:11:50 -04:00
|
|
|
Event.call(this, event);
|
2011-11-16 16:54:03 -05:00
|
|
|
this.type = type;
|
|
|
|
this.point = point;
|
|
|
|
this.target = target;
|
2011-11-16 18:04:30 -05:00
|
|
|
this.delta = delta;
|
2011-11-16 16:54:03 -05:00
|
|
|
},
|
2011-11-12 17:57:25 -05:00
|
|
|
|
2011-11-16 16:54:03 -05:00
|
|
|
/**
|
2011-12-01 05:57:10 -05:00
|
|
|
* The type of mouse event.
|
|
|
|
*
|
|
|
|
* @name MouseEvent#type
|
|
|
|
* @type String('mousedown', 'mouseup', 'mousedrag', 'click',
|
|
|
|
* 'doubleclick', 'mousemove', 'mouseenter', 'mouseleave')
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The position of the mouse in project coordinates when the event was
|
|
|
|
* fired.
|
|
|
|
*
|
|
|
|
* @name MouseEvent#point
|
|
|
|
* @type Point
|
|
|
|
*/
|
|
|
|
|
|
|
|
// DOCS: document MouseEvent#target
|
|
|
|
/**
|
|
|
|
* @name MouseEvent#target
|
|
|
|
* @type Item
|
|
|
|
*/
|
|
|
|
|
|
|
|
// DOCS: document MouseEvent#delta
|
|
|
|
/**
|
|
|
|
* @name MouseEvent#delta
|
|
|
|
* @type Point
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2013-08-23 22:45:28 -04:00
|
|
|
* @return {String} a string representation of the mouse event
|
2011-11-16 16:54:03 -05:00
|
|
|
*/
|
|
|
|
toString: function() {
|
2012-12-08 22:57:04 -05:00
|
|
|
return "{ type: '" + this.type
|
|
|
|
+ "', point: " + this.point
|
2011-11-16 16:54:03 -05:00
|
|
|
+ ', target: ' + this.target
|
2011-11-16 18:04:30 -05:00
|
|
|
+ (this.delta ? ', delta: ' + this.delta : '')
|
2011-11-16 16:54:03 -05:00
|
|
|
+ ', modifiers: ' + this.getModifiers()
|
|
|
|
+ ' }';
|
|
|
|
}
|
2011-11-12 17:57:25 -05:00
|
|
|
});
|