@urso/core 0.8.0 → 0.8.2
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/build/js/index.js +1 -1
- package/package.json +1 -1
- package/src/js/modules/objects/models/button.js +14 -3
- package/src/js/modules/objects/models/checkbox.js +8 -4
- package/src/js/modules/objects/models/hitArea.js +12 -1
- package/src/js/modules/objects/models/slider.js +5 -0
- package/src/js/modules/objects/models/toggle.js +6 -1
package/package.json
CHANGED
|
@@ -31,10 +31,12 @@ 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);
|
|
37
38
|
this.noActionOnMouseOut = Urso.helper.recursiveGet('noActionOnMouseOut', params, this._checkIsDesktop());
|
|
39
|
+
this.handlePointerupoutside = Urso.helper.recursiveGet('handlePointerupoutside', params, true);
|
|
38
40
|
|
|
39
41
|
this.buttonFrames = {
|
|
40
42
|
over: Urso.helper.recursiveGet('buttonFrames.over', params, false),
|
|
@@ -104,16 +106,22 @@ class ModulesObjectsModelsButton extends ModulesObjectsBaseModel {
|
|
|
104
106
|
this._baseObject
|
|
105
107
|
.on('pointerdown', this._onButtonDown.bind(this))
|
|
106
108
|
.on('pointerup', this._onButtonUp.bind(this))
|
|
107
|
-
.on('pointerupoutside', this._onButtonUp.bind(this))
|
|
108
109
|
.on('pointerover', this._onButtonOver.bind(this))
|
|
109
110
|
.on('pointerout', this._onButtonOut.bind(this));
|
|
110
111
|
|
|
112
|
+
if (this.handlePointerupoutside) {
|
|
113
|
+
this._baseObject.on('pointerupoutside', this._onButtonUp.bind(this))
|
|
114
|
+
}
|
|
115
|
+
|
|
111
116
|
};
|
|
112
117
|
|
|
113
|
-
_onButtonDown() {
|
|
118
|
+
_onButtonDown(event) {
|
|
114
119
|
if (this._isDisabled)
|
|
115
120
|
return false;
|
|
116
121
|
|
|
122
|
+
if (this.disableRightClick && event.data.button !== 0)
|
|
123
|
+
return;
|
|
124
|
+
|
|
117
125
|
this._isDown = true;
|
|
118
126
|
|
|
119
127
|
if (this.keyDownAction)
|
|
@@ -125,10 +133,13 @@ class ModulesObjectsModelsButton extends ModulesObjectsBaseModel {
|
|
|
125
133
|
this._changeTexture('pressed');
|
|
126
134
|
}
|
|
127
135
|
|
|
128
|
-
_onButtonUp() {
|
|
136
|
+
_onButtonUp(event) {
|
|
129
137
|
if (this._isDisabled || !this._isDown)
|
|
130
138
|
return false;
|
|
131
139
|
|
|
140
|
+
if (this.disableRightClick && event.data.button !== 0)
|
|
141
|
+
return;
|
|
142
|
+
|
|
132
143
|
this._isDown = false;
|
|
133
144
|
|
|
134
145
|
if (this.action) {
|
|
@@ -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
|
|
@@ -20,10 +20,12 @@ 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);
|
|
26
27
|
this.onTouchMoveCallback = Urso.helper.recursiveGet('onTouchMoveCallback', params, false);
|
|
28
|
+
this.handlePointerupoutside = Urso.helper.recursiveGet('handlePointerupoutside', params, true);
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
enable() {
|
|
@@ -56,10 +58,13 @@ class ModulesObjectsModelsHitArea extends ModulesObjectsBaseModel {
|
|
|
56
58
|
this._baseObject
|
|
57
59
|
.on('pointerdown', this._onPressDown.bind(this))
|
|
58
60
|
.on('pointerup', this._onPressUp.bind(this))
|
|
59
|
-
.on('pointerupoutside', this._onPressUp.bind(this))
|
|
60
61
|
.on('pointerover', this._onOver.bind(this))
|
|
61
62
|
.on('pointerout', this._onOut.bind(this))
|
|
62
63
|
.on('touchmove', this._onTouchmove.bind(this));
|
|
64
|
+
|
|
65
|
+
if (this.handlePointerupoutside) {
|
|
66
|
+
this._baseObject.on('pointerupoutside', this._onPressUp.bind(this))
|
|
67
|
+
}
|
|
63
68
|
};
|
|
64
69
|
|
|
65
70
|
_onTouchmove(event) {
|
|
@@ -73,6 +78,9 @@ class ModulesObjectsModelsHitArea extends ModulesObjectsBaseModel {
|
|
|
73
78
|
if (this._isDisabled)
|
|
74
79
|
return false;
|
|
75
80
|
|
|
81
|
+
if (this.disableRightClick && event.data.button !== 0)
|
|
82
|
+
return;
|
|
83
|
+
|
|
76
84
|
if (this.keyDownAction) {
|
|
77
85
|
const position = this._getEventLocalPosition(event);
|
|
78
86
|
this.keyDownAction(position);
|
|
@@ -83,6 +91,9 @@ class ModulesObjectsModelsHitArea extends ModulesObjectsBaseModel {
|
|
|
83
91
|
if (this._isDisabled)
|
|
84
92
|
return false;
|
|
85
93
|
|
|
94
|
+
if (this.disableRightClick && event.data.button !== 0)
|
|
95
|
+
return;
|
|
96
|
+
|
|
86
97
|
if (this.action) {
|
|
87
98
|
const position = this._getEventLocalPosition(event);
|
|
88
99
|
this.action(position);
|
|
@@ -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() {
|