wgge 2.0.39 → 2.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import ControllerBase from "../../core/controller/ControllerBase";
|
|
2
2
|
|
|
3
3
|
export default class ControlsController extends ControllerBase {
|
|
4
|
+
|
|
4
5
|
dom;
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -29,7 +30,7 @@ export default class ControlsController extends ControllerBase {
|
|
|
29
30
|
|
|
30
31
|
onKeyDown(event) {
|
|
31
32
|
const key = event.keyCode ? event.keyCode : event.charCode;
|
|
32
|
-
if (this.
|
|
33
|
+
if (this.model.logPressedKeys.get()) console.log(key);
|
|
33
34
|
this.model.triggerEvent(`key-down-${key}`);
|
|
34
35
|
this.model.triggerEvent(`key-down`, key);
|
|
35
36
|
}
|
|
@@ -47,7 +48,6 @@ export default class ControlsController extends ControllerBase {
|
|
|
47
48
|
this.model.triggerEvent(`key-up-${key}`);
|
|
48
49
|
this.model.triggerEvent(`key-up`, key);
|
|
49
50
|
}
|
|
50
|
-
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
onMouseMove(e) {
|
|
@@ -10,6 +10,11 @@ export const EVENT_RIGHT_CLICK = 'right-click';
|
|
|
10
10
|
|
|
11
11
|
export default class ControlsModel extends ObjectModel {
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* @type BoolValue
|
|
15
|
+
*/
|
|
16
|
+
logPressedKeys;
|
|
17
|
+
|
|
13
18
|
/**
|
|
14
19
|
* @type BoolValue
|
|
15
20
|
*/
|
|
@@ -20,14 +25,24 @@ export default class ControlsModel extends ObjectModel {
|
|
|
20
25
|
*/
|
|
21
26
|
mouseCoordinates;
|
|
22
27
|
|
|
28
|
+
/**
|
|
29
|
+
* @type BoolValue
|
|
30
|
+
*/
|
|
23
31
|
mouseDownLeft;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @type BoolValue
|
|
35
|
+
*/
|
|
24
36
|
mouseDownRight;
|
|
37
|
+
|
|
25
38
|
leftClickTime;
|
|
39
|
+
|
|
26
40
|
rightClickTime;
|
|
27
41
|
|
|
28
42
|
constructor() {
|
|
29
43
|
super();
|
|
30
44
|
|
|
45
|
+
this.logPressedKeys = this.addProperty('logPressedKeys', new BoolValue(false));
|
|
31
46
|
this.isMouseOver = this.addProperty('isMouseOver', new BoolValue(false));
|
|
32
47
|
this.mouseCoordinates = this.addProperty('mouseCoordinates', new Vector2());
|
|
33
48
|
this.mouseDownLeft = this.addProperty('mouseDownLeft', new BoolValue(false));
|