1 | import { Event as GEvent } from '../dependents';
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | var Event = (function () {
|
7 | function Event(view, gEvent, data) {
|
8 | this.view = view;
|
9 | this.gEvent = gEvent;
|
10 | this.data = data;
|
11 | this.type = gEvent.type;
|
12 | }
|
13 | |
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | Event.fromData = function (view, type, data) {
|
20 | return new Event(view, new GEvent(type, {}), data);
|
21 | };
|
22 | Object.defineProperty(Event.prototype, "target", {
|
23 |
|
24 |
|
25 | get: function () {
|
26 |
|
27 |
|
28 | return this.gEvent.target;
|
29 | },
|
30 | enumerable: false,
|
31 | configurable: true
|
32 | });
|
33 | Object.defineProperty(Event.prototype, "event", {
|
34 |
|
35 | get: function () {
|
36 | return this.gEvent.originalEvent;
|
37 | },
|
38 | enumerable: false,
|
39 | configurable: true
|
40 | });
|
41 | Object.defineProperty(Event.prototype, "x", {
|
42 |
|
43 | get: function () {
|
44 | return this.gEvent.x;
|
45 | },
|
46 | enumerable: false,
|
47 | configurable: true
|
48 | });
|
49 | Object.defineProperty(Event.prototype, "y", {
|
50 |
|
51 | get: function () {
|
52 | return this.gEvent.y;
|
53 | },
|
54 | enumerable: false,
|
55 | configurable: true
|
56 | });
|
57 | Object.defineProperty(Event.prototype, "clientX", {
|
58 |
|
59 | get: function () {
|
60 | return this.gEvent.clientX;
|
61 | },
|
62 | enumerable: false,
|
63 | configurable: true
|
64 | });
|
65 | Object.defineProperty(Event.prototype, "clientY", {
|
66 |
|
67 | get: function () {
|
68 | return this.gEvent.clientY;
|
69 | },
|
70 | enumerable: false,
|
71 | configurable: true
|
72 | });
|
73 |
|
74 | |
75 |
|
76 |
|
77 |
|
78 | Event.prototype.toString = function () {
|
79 | return "[Event (type=".concat(this.type, ")]");
|
80 | };
|
81 | |
82 |
|
83 |
|
84 |
|
85 | Event.prototype.clone = function () {
|
86 | return new Event(this.view, this.gEvent, this.data);
|
87 | };
|
88 | return Event;
|
89 | }());
|
90 | export default Event;
|
91 |
|
\ | No newline at end of file |