@urso/core 0.4.27 → 0.4.30

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.27",
3
+ "version": "0.4.30",
4
4
  "description": "HTML5 game engine",
5
5
  "main": "build/js/index.js",
6
6
  "author": "Megbrimef",
@@ -172,6 +172,20 @@ class ModulesObjectsBaseModel {
172
172
 
173
173
  return { x, y };
174
174
  }
175
+
176
+ /**
177
+ * generate texture from current object
178
+ * @param {String} [key]
179
+ * @returns {Object} - pixi.Texture
180
+ */
181
+ generateTexture(key = '') {
182
+ const newTexture = Urso.scenes.generateTexture(this._baseObject);
183
+
184
+ if (key)
185
+ Urso.cache.addTexture(key, newTexture);
186
+
187
+ return newTexture;
188
+ }
175
189
  }
176
190
 
177
191
  module.exports = ModulesObjectsBaseModel;
@@ -171,13 +171,14 @@ class ModulesObjectsModelsSpine extends Urso.Core.Modules.Objects.BaseModel {
171
171
  if (currentSlot) {
172
172
  object._baseObject.scale.y = -1;
173
173
 
174
- Urso.objects.removeChild(object.parent, object);
174
+ Urso.objects.removeChild(object.parent, object, true);
175
175
 
176
176
  if (replaceSlotContents)
177
177
  currentSlot.removeChildren(); //todo check if its proxy and reset parent
178
178
 
179
179
  object.parent = this; //todo make removeChild for addedToSlotObjects
180
180
  currentSlot.addChild(object._baseObject);
181
+ Urso.objects.refreshStyles();
181
182
  } else {
182
183
  Urso.logger.warn('ModulesObjectsModelsSpine _addToSlot error: no spine slot ' + slotName);
183
184
  }
@@ -76,6 +76,15 @@ class ModulesScenesController {
76
76
  return this._service.addObject(objects, parent, doNotRefreshStylesFlag);
77
77
  }
78
78
 
79
+ /**
80
+ * generateTexture from object
81
+ * @param {Object} obj
82
+ * @returns {Object} - pixi.Texture
83
+ */
84
+ generateTexture(obj) {
85
+ return this.getInstance('PixiWrapper').generateTexture(obj);
86
+ }
87
+
79
88
  /**
80
89
  * global timeScale getter
81
90
  */
@@ -220,6 +220,15 @@ class ModulesScenesPixiWrapper {
220
220
  }, 16);
221
221
  }
222
222
 
223
+ /**
224
+ * generateTexture from object
225
+ * @param {Object} obj
226
+ * @returns {Object} - pixi.Texture
227
+ */
228
+ generateTexture(obj) {
229
+ return this.renderer.generateTexture(obj);
230
+ }
231
+
223
232
  _subscribeOnce() {
224
233
  this.addListener(Urso.events.EXTRA_BROWSEREVENTS_WINDOW_VISIBILITYCHANGE, this.visibilityChangeHandler.bind(this), true);
225
234
  }