@urso/core 0.4.21 → 0.4.24

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.4.21",
3
+ "version": "0.4.24",
4
4
  "description": "HTML5 game engine",
5
5
  "main": "build/js/index.js",
6
6
  "author": "Megbrimef",
@@ -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
- this._baseObject = new PIXI.Text(this.text);
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;
@@ -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
 
@@ -4,6 +4,7 @@ class ModulesObjectsStyles {
4
4
 
5
5
  this._cache = {};
6
6
  this._tempObject = this.getInstance('BaseModel', {})
7
+ this._tempTextObject = this.getInstance('Models.Text', {})
7
8
  }
8
9
 
9
10
  refresh(parent) {
@@ -103,8 +104,10 @@ class ModulesObjectsStyles {
103
104
  if (object._originalModel[key])
104
105
  return;
105
106
 
107
+ const tempObject = (object.type === Urso.types.objects.TEXT) ? this._tempTextObject : this._tempObject;
108
+
106
109
  //restore defaults
107
- Urso.objects._safeSetValueToTarget(object, key, this._tempObject[key]);
110
+ Urso.objects._safeSetValueToTarget(object, key, tempObject[key]);
108
111
 
109
112
  //check other styles
110
113
  for (let [selector, style] of Object.entries(object._styles))