@urso/core 0.4.23 → 0.4.26
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/i18n/controller.js +4 -1
- package/src/js/modules/objects/create.js +3 -0
- package/src/js/modules/objects/models/_info.js +6 -5
- package/src/js/modules/objects/models/nineSlicePlane.js +30 -0
- package/src/js/modules/objects/models/text.js +5 -2
- package/src/js/modules/objects/propertyAdapter.js +6 -5
- package/src/js/modules/objects/proxy.js +2 -0
- package/src/js/modules/template/types.js +3 -1
package/package.json
CHANGED
|
@@ -68,7 +68,10 @@ class ModulesI18nController {
|
|
|
68
68
|
_interpolate(string, params) {
|
|
69
69
|
const names = Object.keys(params);
|
|
70
70
|
const vals = Object.values(params);
|
|
71
|
-
|
|
71
|
+
const encodedString = encodeURIComponent(string);
|
|
72
|
+
const resultEncodedString = new Function(...names, `return \`${encodedString}\`;`)(...vals);
|
|
73
|
+
|
|
74
|
+
return decodeURIComponent(resultEncodedString);
|
|
72
75
|
}
|
|
73
76
|
}
|
|
74
77
|
|
|
@@ -98,6 +98,9 @@ class ModulesObjectsCreate {
|
|
|
98
98
|
case Urso.types.objects.TEXTINPUT:
|
|
99
99
|
model = this.getInstance('Models.TextInput', object);
|
|
100
100
|
break;
|
|
101
|
+
case Urso.types.objects.NINESLICEPLANE:
|
|
102
|
+
model = this.getInstance('Models.NineSlicePlane', object);
|
|
103
|
+
break;
|
|
101
104
|
|
|
102
105
|
default:
|
|
103
106
|
const objectName = Urso.helper.capitaliseFirstLetter(
|
|
@@ -3,6 +3,7 @@ Urso.Core.Modules.Objects.Models = {
|
|
|
3
3
|
BitmapText: require('./bitmapText.js'),
|
|
4
4
|
Button: require('./button.js'),
|
|
5
5
|
ButtonComposite: require('./buttonComposite.js'),
|
|
6
|
+
Checkbox: require('./checkbox.js'),
|
|
6
7
|
Collection: require('./collection.js'),
|
|
7
8
|
Component: require('./component.js'),
|
|
8
9
|
Container: require('./container.js'),
|
|
@@ -13,12 +14,12 @@ Urso.Core.Modules.Objects.Models = {
|
|
|
13
14
|
Image: require('./image.js'),
|
|
14
15
|
ImagesAnimation: require('./imagesAnimation.js'),
|
|
15
16
|
Mask: require('./mask.js'),
|
|
17
|
+
NineSlicePlane: require('./nineSlicePlane.js'),
|
|
18
|
+
Scrollbox: require('./scrollbox.js'),
|
|
19
|
+
Slider: require('./slider.js'),
|
|
16
20
|
Spine: require('./spine.js'),
|
|
17
21
|
Text: require('./text.js'),
|
|
18
|
-
Slider: require('./slider.js'),
|
|
19
|
-
Toggle: require('./toggle.js'),
|
|
20
|
-
Checkbox: require('./checkbox.js'),
|
|
21
|
-
Scrollbox: require('./scrollbox.js'),
|
|
22
22
|
TextInput: require('./textInput.js'),
|
|
23
|
-
|
|
23
|
+
Toggle: require('./toggle.js'),
|
|
24
|
+
World: require('./world.js')
|
|
24
25
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
class ModulesObjectsModelsNineSlicePlane extends Urso.Core.Modules.Objects.BaseModel {
|
|
2
|
+
constructor(params) {
|
|
3
|
+
super(params);
|
|
4
|
+
|
|
5
|
+
this.type = Urso.types.objects.NINESLICEPLANE;
|
|
6
|
+
this._addBaseObject();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
setupParams(params) {
|
|
10
|
+
super.setupParams(params);
|
|
11
|
+
|
|
12
|
+
this.assetKey = Urso.helper.recursiveGet('assetKey', params, false);
|
|
13
|
+
this.leftWidth = Urso.helper.recursiveGet('leftWidth', params, false);
|
|
14
|
+
this.topHeight = Urso.helper.recursiveGet('topHeight', params, false);
|
|
15
|
+
this.rightWidth = Urso.helper.recursiveGet('rightWidth', params, false);
|
|
16
|
+
this.bottomHeight = Urso.helper.recursiveGet('bottomHeight', params, false);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
_addBaseObject() {
|
|
21
|
+
let texture = Urso.cache.getTexture(this.assetKey)
|
|
22
|
+
|
|
23
|
+
if (!texture)
|
|
24
|
+
Urso.logger.error('ModulesObjectsModelsImage assets error: no image with key: ' + this.assetKey);
|
|
25
|
+
|
|
26
|
+
this._baseObject = new PIXI.NineSlicePlane(texture, this.leftWidth, this.topHeight, this.rightWidth, this.bottomHeight);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
module.exports = ModulesObjectsModelsNineSlicePlane;
|
|
@@ -29,14 +29,17 @@ class ModulesObjectsModelsText extends Urso.Core.Modules.Objects.BaseModel {
|
|
|
29
29
|
this.dropShadowAngle = Urso.helper.recursiveGet('dropShadowAngle', params, 0); //Math.PI / 6
|
|
30
30
|
this.dropShadowDistance = Urso.helper.recursiveGet('dropShadowBlur', params, 0); // 6
|
|
31
31
|
this.wordWrap = Urso.helper.recursiveGet('wordWrap', params, false);
|
|
32
|
-
this.wordWrapWidth = Urso.helper.recursiveGet('wordWrapWidth', params, 100)
|
|
32
|
+
this.wordWrapWidth = Urso.helper.recursiveGet('wordWrapWidth', params, 100);
|
|
33
|
+
this.leading = Urso.helper.recursiveGet('leading', params, 0);
|
|
34
|
+
this.textAlign = Urso.helper.recursiveGet('textAlign', params, 'left');
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
_addBaseObject() {
|
|
36
38
|
if (this.localeId)
|
|
37
39
|
this._originalModel.text = this.text = Urso.i18n.get(this.localeId, this.localeVariables);
|
|
38
40
|
|
|
39
|
-
|
|
41
|
+
const styles = { fontFamily: this.fontFamily, leading: this.leading, align: this.textAlign }
|
|
42
|
+
this._baseObject = new PIXI.Text(this.text, styles);
|
|
40
43
|
|
|
41
44
|
if (this.fillCustomColors) {
|
|
42
45
|
this._baseObject.fillCustomColors = this.fillCustomColors;
|
|
@@ -31,21 +31,22 @@ class PropertyAdapter {
|
|
|
31
31
|
Urso.types.objects.COMPONENT,
|
|
32
32
|
Urso.types.objects.CONTAINER,
|
|
33
33
|
Urso.types.objects.GROUP,
|
|
34
|
-
Urso.types.objects.WORLD,
|
|
35
|
-
Urso.types.objects.SLIDER,
|
|
36
34
|
Urso.types.objects.SCROLLBOX,
|
|
35
|
+
Urso.types.objects.SLIDER,
|
|
36
|
+
Urso.types.objects.WORLD
|
|
37
37
|
];
|
|
38
38
|
|
|
39
39
|
this._typesWithoutAnchor = [
|
|
40
|
+
Urso.types.objects.CHECKBOX,
|
|
40
41
|
Urso.types.objects.EMITTER,
|
|
41
42
|
Urso.types.objects.GRAPHICS,
|
|
42
43
|
Urso.types.objects.HITAREA,
|
|
43
44
|
Urso.types.objects.MASK,
|
|
44
|
-
Urso.types.objects.
|
|
45
|
+
Urso.types.objects.NINESLICEPLANE,
|
|
45
46
|
Urso.types.objects.SLIDER,
|
|
47
|
+
Urso.types.objects.SPINE,
|
|
46
48
|
Urso.types.objects.TEXTINPUT,
|
|
47
|
-
Urso.types.objects.
|
|
48
|
-
Urso.types.objects.WORLD,
|
|
49
|
+
Urso.types.objects.WORLD
|
|
49
50
|
];
|
|
50
51
|
}
|
|
51
52
|
|
|
@@ -197,6 +197,8 @@ class ModulesObjectsProxy {
|
|
|
197
197
|
'dropShadowDistance': 'style.dropShadowDistance',
|
|
198
198
|
'wordWrap': 'style.wordWrap',
|
|
199
199
|
'wordWrapWidth': 'style.wordWrapWidth',
|
|
200
|
+
'leading ': 'style.leading',
|
|
201
|
+
'textAlign ': 'style.align',
|
|
200
202
|
'enabled': 'input.enabled',
|
|
201
203
|
'cacheAsBitmap': 'cacheAsBitmap',
|
|
202
204
|
|