forked from paperjs/paper.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMouseEvent.js
More file actions
73 lines (67 loc) · 1.82 KB
/
Copy pathMouseEvent.js
File metadata and controls
73 lines (67 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
* Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
* http://paperjs.org/
*
* Copyright (c) 2011 - 2013, Juerg Lehni & Jonathan Puckey
* http://lehni.org/ & http://jonathanpuckey.com/
*
* Distributed under the MIT license. See LICENSE file for details.
*
* All rights reserved.
*/
/**
* @name MouseEvent
*
* @class The MouseEvent object is received by the {@link Item}'s mouse event
* handlers {@link Item#onMouseDown}, {@link Item#onMouseDrag},
* {@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.
*
* @extends Event
*/
var MouseEvent = this.MouseEvent = Event.extend(/** @lends MouseEvent# */{
initialize: function(type, event, point, target, delta) {
this.base(event);
this.type = type;
this.point = point;
this.target = target;
this.delta = delta;
},
/**
* 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
*/
/**
* @return {String} A string representation of the mouse event.
*/
toString: function() {
return "{ type: '" + this.type
+ "', point: " + this.point
+ ', target: ' + this.target
+ (this.delta ? ', delta: ' + this.delta : '')
+ ', modifiers: ' + this.getModifiers()
+ ' }';
}
});