@urso/core 0.8.1 → 0.8.3

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.
@@ -149,10 +149,10 @@ object-assign
149
149
  */
150
150
 
151
151
  /*!
152
- * GSAP 3.12.5
152
+ * GSAP 3.12.7
153
153
  * https://gsap.com
154
154
  *
155
- * @license Copyright 2008-2024, GreenSock. All rights reserved.
155
+ * @license Copyright 2008-2025, GreenSock. All rights reserved.
156
156
  * Subject to the terms at https://gsap.com/standard-license or for
157
157
  * Club GSAP members, the agreement issued with that membership.
158
158
  * @author: Jack Doyle, jack@greensock.com
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@urso/core",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
4
4
  "description": "HTML5 game engine",
5
5
  "main": "build/js/index.js",
6
6
  "author": "Megbrimef",
@@ -36,6 +36,7 @@ class ModulesObjectsModelsButton extends ModulesObjectsBaseModel {
36
36
  this.mouseOverAction = Urso.helper.recursiveGet('mouseOverAction', params, false);
37
37
  this.mouseOutAction = Urso.helper.recursiveGet('mouseOutAction', params, false);
38
38
  this.noActionOnMouseOut = Urso.helper.recursiveGet('noActionOnMouseOut', params, this._checkIsDesktop());
39
+ this.handlePointerupoutside = Urso.helper.recursiveGet('handlePointerupoutside', params, true);
39
40
 
40
41
  this.buttonFrames = {
41
42
  over: Urso.helper.recursiveGet('buttonFrames.over', params, false),
@@ -105,10 +106,13 @@ class ModulesObjectsModelsButton extends ModulesObjectsBaseModel {
105
106
  this._baseObject
106
107
  .on('pointerdown', this._onButtonDown.bind(this))
107
108
  .on('pointerup', this._onButtonUp.bind(this))
108
- .on('pointerupoutside', this._onButtonUp.bind(this))
109
109
  .on('pointerover', this._onButtonOver.bind(this))
110
110
  .on('pointerout', this._onButtonOut.bind(this));
111
111
 
112
+ if (this.handlePointerupoutside) {
113
+ this._baseObject.on('pointerupoutside', this._onButtonUp.bind(this))
114
+ }
115
+
112
116
  };
113
117
 
114
118
  _onButtonDown(event) {
@@ -21,13 +21,14 @@ class ModulesObjectsModelsCheckbox extends UrsoCoreModulesObjectsModelsToggle {
21
21
 
22
22
  this.contents = [];
23
23
 
24
- this.action = Urso.helper.recursiveGet('action', params, () => {
25
- this.emit(Urso.events.MODULES_OBJECTS_CHECKBOX_PRESS, { name: this.name, status: this.status, class: this.class })
24
+ this.action = Urso.helper.recursiveGet('action', params, () => {
25
+ this.emit(Urso.events.MODULES_OBJECTS_CHECKBOX_PRESS, { name: this.name, status: this.status, class: this.class })
26
26
  });
27
27
 
28
28
  this.lable = Urso.helper.recursiveGet('lable', params, false);
29
29
 
30
30
  this.defaultStatus = Urso.helper.recursiveGet('defaultStatus', params, 'unpressed'); //pressed or unpressed
31
+ this.handlePointerupoutside = Urso.helper.recursiveGet('handlePointerupoutside', params, true);
31
32
  }
32
33
 
33
34
  _createCheckbox() {
@@ -48,10 +49,13 @@ class ModulesObjectsModelsCheckbox extends UrsoCoreModulesObjectsModelsToggle {
48
49
  object._baseObject
49
50
  .on('pointerdown', this._onButtonDown.bind(this))
50
51
  .on('pointerup', this._onButtonUp.bind(this))
51
- .on('pointerupoutside', this._onButtonUp.bind(this))
52
52
  .on('pointerover', this._onButtonOver.bind(this))
53
53
  .on('pointerout', this._onButtonOut.bind(this));
54
54
 
55
+ if (this.handlePointerupoutside) {
56
+ this._baseObject.on('pointerupoutside', this._onButtonUp.bind(this))
57
+ }
58
+
55
59
  return object;
56
60
  }
57
61
 
@@ -85,7 +89,7 @@ class ModulesObjectsModelsCheckbox extends UrsoCoreModulesObjectsModelsToggle {
85
89
  this._changeTexture(`${this.status}Out`); // load default texture for this key
86
90
  return false;
87
91
  }
88
-
92
+
89
93
  if (this.buttonFrames[key].type === Urso.types.objects.GRAPHICS)
90
94
  this._drawGraphics(this.buttonFrames[key].figure);
91
95
  else
@@ -1,9 +1,11 @@
1
1
  const ModulesObjectsBaseModel = require('./../baseModel');
2
2
 
3
3
  class ModulesObjectsModelsHitArea extends ModulesObjectsBaseModel {
4
+
4
5
  constructor(params) {
5
6
  super(params);
6
7
  this._isDisabled = false;
8
+ this._isDown = false;
7
9
 
8
10
  this.type = Urso.types.objects.HITAREA;
9
11
 
@@ -25,6 +27,17 @@ class ModulesObjectsModelsHitArea extends ModulesObjectsBaseModel {
25
27
  this.onOverCallback = Urso.helper.recursiveGet('onOverCallback', params, false);
26
28
  this.onOutCallback = Urso.helper.recursiveGet('onOutCallback', params, false);
27
29
  this.onTouchMoveCallback = Urso.helper.recursiveGet('onTouchMoveCallback', params, false);
30
+ this.handlePointerupoutside = Urso.helper.recursiveGet('handlePointerupoutside', params, true);
31
+ /**
32
+ * customInteractionArea object ex:
33
+ * Circle: { "type": "circle", "params": [0, 0, 100] }
34
+ * Rectangle: { "type": "rectangle", "params": [0, 0, 100, 100] }
35
+ * Polygon: {
36
+ * "type": "polygon",
37
+ * "params": [ 0, 0, 100, 0, 100, 100, 50, 150, 0, 100 ];
38
+ * }
39
+ * */
40
+ this.customInteractionArea = Urso.helper.recursiveGet('customInteractionArea', params, null);
28
41
  }
29
42
 
30
43
  enable() {
@@ -57,11 +70,14 @@ class ModulesObjectsModelsHitArea extends ModulesObjectsBaseModel {
57
70
  this._baseObject
58
71
  .on('pointerdown', this._onPressDown.bind(this))
59
72
  .on('pointerup', this._onPressUp.bind(this))
60
- .on('pointerupoutside', this._onPressUp.bind(this))
73
+ .on('pointerupoutside', this._onPressUpOutside.bind(this))
61
74
  .on('pointerover', this._onOver.bind(this))
62
75
  .on('pointerout', this._onOut.bind(this))
63
76
  .on('touchmove', this._onTouchmove.bind(this));
64
- };
77
+
78
+ if (this.customInteractionArea)
79
+ this._baseObject.hitArea = this._getHitAreaObject(this.customInteractionArea);
80
+ }
65
81
 
66
82
  _onTouchmove(event) {
67
83
  const position = this._getEventLocalPosition(event);
@@ -77,6 +93,11 @@ class ModulesObjectsModelsHitArea extends ModulesObjectsBaseModel {
77
93
  if (this.disableRightClick && event.data.button !== 0)
78
94
  return;
79
95
 
96
+ if (this._isDown)
97
+ return false;
98
+
99
+ this._isDown = true;
100
+
80
101
  if (this.keyDownAction) {
81
102
  const position = this._getEventLocalPosition(event);
82
103
  this.keyDownAction(position);
@@ -90,12 +111,29 @@ class ModulesObjectsModelsHitArea extends ModulesObjectsBaseModel {
90
111
  if (this.disableRightClick && event.data.button !== 0)
91
112
  return;
92
113
 
114
+ if (!this._isDown)
115
+ return false;
116
+
117
+ this._isDown = false;
118
+
93
119
  if (this.action) {
94
120
  const position = this._getEventLocalPosition(event);
95
121
  this.action(position);
96
122
  }
97
123
  }
98
124
 
125
+ _onPressUpOutside() {
126
+ if (this.handlePointerupoutside) {
127
+ this._onPressUp();
128
+ return;
129
+ }
130
+
131
+ if (this._isDisabled)
132
+ return false;
133
+
134
+ this._isDown = false;
135
+ }
136
+
99
137
  _onOver() {
100
138
  if (this._isDisabled)
101
139
  return false;
@@ -121,6 +159,24 @@ class ModulesObjectsModelsHitArea extends ModulesObjectsBaseModel {
121
159
 
122
160
  return { x, y };
123
161
  }
162
+
163
+ _getHitAreaObject({ type, params }) {
164
+ if (!type) {
165
+ return null;
166
+ }
167
+
168
+ const objects = {
169
+ 'rectangle': PIXI.Rectangle,
170
+ 'circle': PIXI.Circle,
171
+ 'polygon': PIXI.Polygon
172
+ }
173
+
174
+ if (!objects[type]) {
175
+ return null;
176
+ }
177
+
178
+ return new objects[type](...params);
179
+ }
124
180
  }
125
181
 
126
182
  module.exports = ModulesObjectsModelsHitArea;
@@ -36,6 +36,7 @@ class ModulesObjectsModelsSlider extends ModulesObjectsBaseModel {
36
36
  this.maxValueTextModel = Urso.helper.recursiveGet('maxValueTextModel', params, false);
37
37
  this.currentValueTextModel = Urso.helper.recursiveGet('currentValueTextModel', params, false);
38
38
  this.isVertical = Urso.helper.recursiveGet('isVertical', params, false);
39
+ this.handlePointerupoutside = Urso.helper.recursiveGet('handlePointerupoutside', params, true);
39
40
  }
40
41
 
41
42
  /**
@@ -145,6 +146,10 @@ class ModulesObjectsModelsSlider extends ModulesObjectsBaseModel {
145
146
  .on('pointerup', this._onPointerUp.bind(this))
146
147
  .on('pointerupoutside', this._onPointerUp.bind(this))
147
148
  .on('touchmove', this._onTouchmove.bind(this));
149
+
150
+ if (this.handlePointerupoutside) {
151
+ this._baseObject.on('pointerupoutside', this._onPointerUp.bind(this))
152
+ }
148
153
  };
149
154
 
150
155
  /**
@@ -30,6 +30,8 @@ class ModulesObjectsModelsToggle extends UrsoCoreModulesObjectsModelsButton {
30
30
  pressedDisabled: Urso.helper.recursiveGet('buttonFrames.pressedDisabled', params, false),
31
31
  unpressedDisabled: Urso.helper.recursiveGet('buttonFrames.unpressedDisabled', params, false),
32
32
  }
33
+
34
+ this.handlePointerupoutside = Urso.helper.recursiveGet('handlePointerupoutside', params, true);
33
35
  }
34
36
 
35
37
  setButtonFrame(key, assetKey) {
@@ -85,9 +87,12 @@ class ModulesObjectsModelsToggle extends UrsoCoreModulesObjectsModelsButton {
85
87
  this._baseObject
86
88
  .on('pointerdown', this._onButtonDown.bind(this))
87
89
  .on('pointerup', this._onButtonUp.bind(this))
88
- .on('pointerupoutside', this._onButtonUp.bind(this))
89
90
  .on('pointerover', this._onButtonOver.bind(this))
90
91
  .on('pointerout', this._onButtonOut.bind(this));
92
+
93
+ if (this.handlePointerupoutside) {
94
+ this._baseObject.on('pointerupoutside', this._onButtonUp.bind(this))
95
+ }
91
96
  };
92
97
 
93
98
  _onButtonDown() {
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_urso_core=self.webpackChunk_urso_core||[]).push([[162],{88058:(d,a,r)=>{var O=r(8507),X=r(36697),e=r(46719);O.XO.add(X.U),O.XO.add(e.y)},42162:(d,a,r)=>{r.r(a),r(88058),r(26197),r(17801),r(25361),r(28849),r(28299),r(15311),r(4241),r(11981),r(51437),r(95902)},95902:(d,a,r)=>{var O=r(8507),X=r(69430),e=r(90825);O.XO.add(e.u),O.XO.add(X.L)},25361:(d,a,r)=>{var O=r(8507),X=r(40378),e=r(49260);O.XO.add(e.S),O.XO.add(X.GH)},28849:(d,a,r)=>{var O=r(8507),X=r(41892);O.XO.add(X.G)},51437:(d,a,r)=>{var O=r(8507),X=r(56880);O.XO.add(X.e)},11981:(d,a,r)=>{var O=r(8507),X=r(75773);O.XO.add(X.x)},15311:(d,a,r)=>{var O=r(8507),X=r(70661);O.XO.add(X.n)},4241:(d,a,r)=>{var O=r(8507),X=r(76829),e=r(47602);O.XO.add(e.Q),O.XO.add(X.n)},28299:(d,a,r)=>{var O=r(8507),X=r(45369),e=r(87278);O.XO.add(e.p),O.XO.add(X.e)}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_urso_core=self.webpackChunk_urso_core||[]).push([[24],{88058:(d,a,r)=>{var O=r(8507),X=r(36697),v=r(46719);O.XO.add(X.U),O.XO.add(v.y)},22024:(d,a,r)=>{r.r(a);var O=r(8507),X=r(44980),v=r(83946),e=r(74302);O.XO.add(v.a),X.mc.mixin(e.K),r(88058);var c=r(60809),s=r(90317);O.XO.add(c.C),X.mc.mixin(s.e),r(26197),r(17801),r(25361),r(28849),r(28299),r(15311),r(4241),r(11981),r(51437),r(95902)},95902:(d,a,r)=>{var O=r(8507),X=r(69430),v=r(90825);O.XO.add(v.u),O.XO.add(X.L)},25361:(d,a,r)=>{var O=r(8507),X=r(40378),v=r(49260);O.XO.add(v.S),O.XO.add(X.GH)},28849:(d,a,r)=>{var O=r(8507),X=r(41892);O.XO.add(X.G)},51437:(d,a,r)=>{var O=r(8507),X=r(56880);O.XO.add(X.e)},11981:(d,a,r)=>{var O=r(8507),X=r(75773);O.XO.add(X.x)},15311:(d,a,r)=>{var O=r(8507),X=r(70661);O.XO.add(X.n)},4241:(d,a,r)=>{var O=r(8507),X=r(76829),v=r(47602);O.XO.add(v.Q),O.XO.add(X.n)},28299:(d,a,r)=>{var O=r(8507),X=r(45369),v=r(87278);O.XO.add(v.p),O.XO.add(X.e)}}]);