@urso/core 0.7.68 → 0.7.70

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@urso/core",
3
- "version": "0.7.68",
3
+ "version": "0.7.70",
4
4
  "description": "HTML5 game engine",
5
5
  "main": "build/js/index.js",
6
6
  "author": "Megbrimef",
@@ -20,6 +20,7 @@ class ModulesObjectsModelsHitArea extends ModulesObjectsBaseModel {
20
20
  this.action = Urso.helper.recursiveGet(
21
21
  'action', params, (position) => { this.emit(Urso.events.MODULES_OBJECTS_HIT_AREA_PRESS, { position, name: this.name, class: this.class }) }
22
22
  );
23
+ this.keyDownAction = Urso.helper.recursiveGet('keyDownAction', params, false);
23
24
  this.onOverCallback = Urso.helper.recursiveGet('onOverCallback', params, false);
24
25
  this.onOutCallback = Urso.helper.recursiveGet('onOutCallback', params, false);
25
26
  this.onTouchMoveCallback = Urso.helper.recursiveGet('onTouchMoveCallback', params, false);
@@ -53,7 +54,9 @@ class ModulesObjectsModelsHitArea extends ModulesObjectsBaseModel {
53
54
  this._baseObject.buttonMode = true;
54
55
 
55
56
  this._baseObject
57
+ .on('pointerdown', this._onPressDown.bind(this))
56
58
  .on('pointerup', this._onPressUp.bind(this))
59
+ .on('pointerupoutside', this._onPressUp.bind(this))
57
60
  .on('pointerover', this._onOver.bind(this))
58
61
  .on('pointerout', this._onOut.bind(this))
59
62
  .on('touchmove', this._onTouchmove.bind(this));
@@ -66,6 +69,16 @@ class ModulesObjectsModelsHitArea extends ModulesObjectsBaseModel {
66
69
  this.onTouchMoveCallback(position);
67
70
  }
68
71
 
72
+ _onPressDown(event) {
73
+ if (this._isDisabled)
74
+ return false;
75
+
76
+ if (this.keyDownAction) {
77
+ const position = this._getEventLocalPosition(event);
78
+ this.keyDownAction(position);
79
+ }
80
+ }
81
+
69
82
  _onPressUp(event) {
70
83
  if (this._isDisabled)
71
84
  return false;