Debian Codegraph @

mixmark-io-domino/lib/MouseEvent.js

raw symbols SCIP
1 "use strict";
2 var UIEvent = require('./UIEvent');
3
4 module.exports = MouseEvent;
5
6 function MouseEvent() {
7 // Just use the superclass constructor to initialize
8 UIEvent.call(this);
9
10 this.screenX = this.screenY = this.clientX = this.clientY = 0;
11 this.ctrlKey = this.altKey = this.shiftKey = this.metaKey = false;
12 this.button = 0;
13 this.buttons = 1;
14 this.relatedTarget = null;
15 }
16 MouseEvent.prototype = Object.create(UIEvent.prototype, {
17 constructor: { value: MouseEvent },
18 initMouseEvent: { value: function(type, bubbles, cancelable,
19 view, detail,
20 screenX, screenY, clientX, clientY,
21 ctrlKey, altKey, shiftKey, metaKey,
22 button, relatedTarget) {
23
24 this.initEvent(type, bubbles, cancelable, view, detail);
25 this.screenX = screenX;
26 this.screenY = screenY;
27 this.clientX = clientX;
28 this.clientY = clientY;
29 this.ctrlKey = ctrlKey;
30 this.altKey = altKey;
31 this.shiftKey = shiftKey;
32 this.metaKey = metaKey;
33 this.button = button;
34 switch(button) {
35 case 0: this.buttons = 1; break;
36 case 1: this.buttons = 4; break;
37 case 2: this.buttons = 2; break;
38 default: this.buttons = 0; break;
39 }
40 this.relatedTarget = relatedTarget;
41 }},
42
43 getModifierState: { value: function(key) {
44 switch(key) {
45 case "Alt": return this.altKey;
46 case "Control": return this.ctrlKey;
47 case "Shift": return this.shiftKey;
48 case "Meta": return this.metaKey;
49 default: return false;
50 }
51 }}
52 });