@urso/core 0.8.0 → 0.8.1

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.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "HTML5 game engine",
5
5
  "main": "build/js/index.js",
6
6
  "author": "Megbrimef",
@@ -31,6 +31,7 @@ class ModulesObjectsModelsButton extends ModulesObjectsBaseModel {
31
31
  super.setupParams(params);
32
32
 
33
33
  this.action = Urso.helper.recursiveGet('action', params, () => { this.emit(Urso.events.MODULES_OBJECTS_BUTTON_PRESS, { name: this.name, class: this.class }) });
34
+ this.disableRightClick = Urso.helper.recursiveGet('disableRightClick', params, false);
34
35
  this.keyDownAction = Urso.helper.recursiveGet('keyDownAction', params, false);
35
36
  this.mouseOverAction = Urso.helper.recursiveGet('mouseOverAction', params, false);
36
37
  this.mouseOutAction = Urso.helper.recursiveGet('mouseOutAction', params, false);
@@ -110,10 +111,13 @@ class ModulesObjectsModelsButton extends ModulesObjectsBaseModel {
110
111
 
111
112
  };
112
113
 
113
- _onButtonDown() {
114
+ _onButtonDown(event) {
114
115
  if (this._isDisabled)
115
116
  return false;
116
117
 
118
+ if (this.disableRightClick && event.data.button !== 0)
119
+ return;
120
+
117
121
  this._isDown = true;
118
122
 
119
123
  if (this.keyDownAction)
@@ -125,10 +129,13 @@ class ModulesObjectsModelsButton extends ModulesObjectsBaseModel {
125
129
  this._changeTexture('pressed');
126
130
  }
127
131
 
128
- _onButtonUp() {
132
+ _onButtonUp(event) {
129
133
  if (this._isDisabled || !this._isDown)
130
134
  return false;
131
135
 
136
+ if (this.disableRightClick && event.data.button !== 0)
137
+ return;
138
+
132
139
  this._isDown = false;
133
140
 
134
141
  if (this.action) {
@@ -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.disableRightClick = Urso.helper.recursiveGet('disableRightClick', params, false);
23
24
  this.keyDownAction = Urso.helper.recursiveGet('keyDownAction', params, false);
24
25
  this.onOverCallback = Urso.helper.recursiveGet('onOverCallback', params, false);
25
26
  this.onOutCallback = Urso.helper.recursiveGet('onOutCallback', params, false);
@@ -73,6 +74,9 @@ class ModulesObjectsModelsHitArea extends ModulesObjectsBaseModel {
73
74
  if (this._isDisabled)
74
75
  return false;
75
76
 
77
+ if (this.disableRightClick && event.data.button !== 0)
78
+ return;
79
+
76
80
  if (this.keyDownAction) {
77
81
  const position = this._getEventLocalPosition(event);
78
82
  this.keyDownAction(position);
@@ -83,6 +87,9 @@ class ModulesObjectsModelsHitArea extends ModulesObjectsBaseModel {
83
87
  if (this._isDisabled)
84
88
  return false;
85
89
 
90
+ if (this.disableRightClick && event.data.button !== 0)
91
+ return;
92
+
86
93
  if (this.action) {
87
94
  const position = this._getEventLocalPosition(event);
88
95
  this.action(position);