@urso/core 0.5.12 → 0.5.13

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.
Files changed (159) hide show
  1. package/.babelrc +11 -11
  2. package/LICENSE +20 -20
  3. package/README.md +220 -220
  4. package/build/js/index.js +1 -1
  5. package/build/js/index.js.LICENSE.txt +38 -222
  6. package/package.json +52 -52
  7. package/src/js/app.js +78 -78
  8. package/src/js/components/_info.js +10 -10
  9. package/src/js/components/base/_info.js +3 -3
  10. package/src/js/components/base/controller.js +78 -78
  11. package/src/js/components/debug/_info.js +7 -7
  12. package/src/js/components/debug/controller.js +38 -38
  13. package/src/js/components/debug/coords.js +23 -23
  14. package/src/js/components/debug/fps.js +34 -34
  15. package/src/js/components/debug/template.js +55 -55
  16. package/src/js/components/debug/timescale.js +60 -60
  17. package/src/js/components/deviceRotate/_info.js +3 -3
  18. package/src/js/components/deviceRotate/controller.js +86 -86
  19. package/src/js/components/editor/_info.js +4 -0
  20. package/src/js/components/editor/api.js +72 -0
  21. package/src/js/components/editor/controller.js +13 -0
  22. package/src/js/components/fullscreen/_info.js +6 -6
  23. package/src/js/components/fullscreen/android.js +104 -104
  24. package/src/js/components/fullscreen/controller.js +76 -76
  25. package/src/js/components/fullscreen/desktop.js +49 -49
  26. package/src/js/components/fullscreen/ios.js +115 -115
  27. package/src/js/components/layersSwitcher/_info.js +4 -4
  28. package/src/js/components/layersSwitcher/config.js +26 -26
  29. package/src/js/components/layersSwitcher/controller.js +34 -34
  30. package/src/js/components/loader/_info.js +4 -4
  31. package/src/js/components/loader/controller.js +65 -65
  32. package/src/js/components/loader/template.js +70 -70
  33. package/src/js/components/soundInitialPopup/_info.js +3 -3
  34. package/src/js/components/soundInitialPopup/controller.js +42 -42
  35. package/src/js/components/soundInitialPopup/template.js +109 -109
  36. package/src/js/components/stateDriven/_info.js +3 -3
  37. package/src/js/components/stateDriven/controller.js +118 -118
  38. package/src/js/config/load.js +5 -5
  39. package/src/js/config/main.js +12 -12
  40. package/src/js/extra/_info.js +26 -26
  41. package/src/js/extra/browserEvents.js +51 -51
  42. package/src/js/extra/pixiPatch.js +150 -148
  43. package/src/js/extra/setTimeout.js +7 -7
  44. package/src/js/index.js +8 -8
  45. package/src/js/lib/_info.js +13 -13
  46. package/src/js/lib/cache.js +105 -105
  47. package/src/js/lib/composition.js +85 -85
  48. package/src/js/lib/device.js +1286 -1286
  49. package/src/js/lib/helper.js +539 -539
  50. package/src/js/lib/loader.js +136 -136
  51. package/src/js/lib/localData.js +15 -15
  52. package/src/js/lib/logger.js +69 -69
  53. package/src/js/lib/math.js +35 -35
  54. package/src/js/lib/objectPool.js +54 -54
  55. package/src/js/lib/time.js +18 -18
  56. package/src/js/lib/tween.js +147 -147
  57. package/src/js/modules/_info.js +12 -12
  58. package/src/js/modules/assets/_info.js +7 -7
  59. package/src/js/modules/assets/baseModel.js +18 -18
  60. package/src/js/modules/assets/config.js +37 -37
  61. package/src/js/modules/assets/controller.js +46 -46
  62. package/src/js/modules/assets/models/_info.js +11 -11
  63. package/src/js/modules/assets/models/atlas.js +8 -8
  64. package/src/js/modules/assets/models/audiosprite.js +27 -27
  65. package/src/js/modules/assets/models/bitmapFont.js +8 -8
  66. package/src/js/modules/assets/models/container.js +16 -16
  67. package/src/js/modules/assets/models/font.js +8 -8
  68. package/src/js/modules/assets/models/image.js +13 -13
  69. package/src/js/modules/assets/models/json.js +8 -8
  70. package/src/js/modules/assets/models/sound.js +14 -14
  71. package/src/js/modules/assets/models/spine.js +14 -14
  72. package/src/js/modules/assets/service.js +365 -365
  73. package/src/js/modules/i18n/_info.js +4 -4
  74. package/src/js/modules/i18n/config.js +17 -17
  75. package/src/js/modules/i18n/controller.js +79 -79
  76. package/src/js/modules/instances/_info.js +3 -3
  77. package/src/js/modules/instances/controller.js +261 -261
  78. package/src/js/modules/logic/_info.js +4 -4
  79. package/src/js/modules/logic/config/_info.js +2 -2
  80. package/src/js/modules/logic/config/sounds.js +23 -23
  81. package/src/js/modules/logic/controller.js +48 -48
  82. package/src/js/modules/logic/sounds.js +103 -103
  83. package/src/js/modules/objects/_info.js +13 -13
  84. package/src/js/modules/objects/baseModel.js +198 -198
  85. package/src/js/modules/objects/cache.js +99 -99
  86. package/src/js/modules/objects/controller.js +131 -131
  87. package/src/js/modules/objects/find.js +58 -58
  88. package/src/js/modules/objects/models/_info.js +27 -27
  89. package/src/js/modules/objects/models/atlasImage.js +50 -50
  90. package/src/js/modules/objects/models/bitmapText.js +37 -37
  91. package/src/js/modules/objects/models/button.js +189 -189
  92. package/src/js/modules/objects/models/buttonComposite.js +35 -35
  93. package/src/js/modules/objects/models/checkbox.js +96 -96
  94. package/src/js/modules/objects/models/collection.js +54 -54
  95. package/src/js/modules/objects/models/component.js +44 -44
  96. package/src/js/modules/objects/models/container.js +19 -19
  97. package/src/js/modules/objects/models/dragContainer.js +675 -675
  98. package/src/js/modules/objects/models/emitter.js +67 -67
  99. package/src/js/modules/objects/models/emitterFx.js +99 -99
  100. package/src/js/modules/objects/models/graphics.js +38 -38
  101. package/src/js/modules/objects/models/group.js +19 -19
  102. package/src/js/modules/objects/models/hitArea.js +104 -104
  103. package/src/js/modules/objects/models/image.js +34 -34
  104. package/src/js/modules/objects/models/imagesAnimation.js +113 -113
  105. package/src/js/modules/objects/models/mask.js +38 -38
  106. package/src/js/modules/objects/models/nineSlicePlane.js +30 -30
  107. package/src/js/modules/objects/models/scrollbox.js +64 -64
  108. package/src/js/modules/objects/models/slider.js +253 -253
  109. package/src/js/modules/objects/models/spine.js +276 -276
  110. package/src/js/modules/objects/models/text.js +59 -59
  111. package/src/js/modules/objects/models/textInput.js +66 -66
  112. package/src/js/modules/objects/models/toggle.js +180 -180
  113. package/src/js/modules/objects/models/world.js +19 -19
  114. package/src/js/modules/objects/propertyAdapter.js +587 -587
  115. package/src/js/modules/objects/proxy.js +294 -294
  116. package/src/js/modules/objects/selector.js +136 -136
  117. package/src/js/modules/objects/service.js +242 -242
  118. package/src/js/modules/objects/styles.js +210 -210
  119. package/src/js/modules/observer/_info.js +4 -4
  120. package/src/js/modules/observer/controller.js +99 -99
  121. package/src/js/modules/observer/events.js +52 -51
  122. package/src/js/modules/scenes/_info.js +8 -8
  123. package/src/js/modules/scenes/controller.js +103 -103
  124. package/src/js/modules/scenes/model.js +28 -28
  125. package/src/js/modules/scenes/pixiWrapper.js +237 -237
  126. package/src/js/modules/scenes/resolutions.js +173 -173
  127. package/src/js/modules/scenes/resolutionsConfig.js +73 -73
  128. package/src/js/modules/scenes/service.js +142 -142
  129. package/src/js/modules/soundManager/_info.js +3 -3
  130. package/src/js/modules/soundManager/controller.js +100 -100
  131. package/src/js/modules/soundManager/soundSprite.js +251 -250
  132. package/src/js/modules/statesManager/_info.js +12 -12
  133. package/src/js/modules/statesManager/action.js +60 -60
  134. package/src/js/modules/statesManager/actions/_info.js +3 -3
  135. package/src/js/modules/statesManager/all.js +23 -23
  136. package/src/js/modules/statesManager/configStates.js +71 -71
  137. package/src/js/modules/statesManager/controller.js +170 -170
  138. package/src/js/modules/statesManager/functionsStorage.js +82 -82
  139. package/src/js/modules/statesManager/helper.js +27 -27
  140. package/src/js/modules/statesManager/race.js +75 -75
  141. package/src/js/modules/statesManager/sequence.js +47 -47
  142. package/src/js/modules/template/_info.js +6 -6
  143. package/src/js/modules/template/controller.js +28 -28
  144. package/src/js/modules/template/model.js +11 -11
  145. package/src/js/modules/template/service.js +137 -137
  146. package/src/js/modules/template/types.js +46 -46
  147. package/src/js/modules/transport/_info.js +8 -8
  148. package/src/js/modules/transport/baseConnectionType.js +24 -24
  149. package/src/js/modules/transport/config.js +13 -13
  150. package/src/js/modules/transport/connectionTypes/_info.js +3 -3
  151. package/src/js/modules/transport/connectionTypes/websocket.js +74 -74
  152. package/src/js/modules/transport/connectionTypes/xhr.js +44 -44
  153. package/src/js/modules/transport/controller.js +48 -48
  154. package/src/js/modules/transport/decorator.js +17 -17
  155. package/src/js/modules/transport/service.js +153 -153
  156. package/src/js/templates/_info.js +4 -4
  157. package/src/js/templates/groups/_info.js +1 -1
  158. package/src/js/templates/scenes/_info.js +1 -1
  159. package/webpack.config.js +47 -47
@@ -1,588 +1,588 @@
1
- /**
2
- * adapter Urso to Pixi objects
3
- */
4
- class PropertyAdapter {
5
-
6
- constructor() {
7
- this.singleton = true;
8
-
9
- /**
10
- * dependencies, functions to handle changing property
11
- */
12
- this._dependencies = {
13
- 'x': this._updateHorizontal.bind(this),
14
- 'y': this._updateVertical.bind(this),
15
- 'anchorX': this._updateHorizontal.bind(this),
16
- 'anchorY': this._updateVertical.bind(this),
17
- 'scaleX': this._adaptScaleX.bind(this),
18
- 'scaleY': this._adaptScaleY.bind(this),
19
- 'alignX': this._updateHorizontal.bind(this),
20
- 'alignY': this._updateVertical.bind(this),
21
- 'width': this._updateHorizontal.bind(this),
22
- 'height': this._updateVertical.bind(this),
23
- 'angle': this._updateAngle.bind(this),
24
- 'stretchingType': this._adaptStretchingType.bind(this), //todo check on parent change
25
- 'parent': this._parentChangeHandler.bind(this)
26
- };
27
-
28
- /**
29
- * functions to handle changing parent property
30
- */
31
- this._parentToChildDependencies = {
32
- 'width': { children: ['width'] },
33
- 'height': { children: ['height'] },
34
- 'anchorX': { children: ['x'] },
35
- 'anchorY': { children: ['y'] },
36
- 'stretchingType': { children: ['width', 'height'] }
37
- };
38
-
39
- /**
40
- * parent types list
41
- */
42
- this._parentTypes = [
43
- Urso.types.objects.COMPONENT,
44
- Urso.types.objects.CONTAINER,
45
- Urso.types.objects.DRAGCONTAINER,
46
- Urso.types.objects.GROUP,
47
- Urso.types.objects.SCROLLBOX,
48
- Urso.types.objects.SLIDER,
49
- Urso.types.objects.WORLD
50
- ];
51
-
52
- /**
53
- * types without ahchor list
54
- */
55
- this._typesWithoutAnchor = [
56
- Urso.types.objects.CHECKBOX,
57
- Urso.types.objects.EMITTER,
58
- Urso.types.objects.EMITTERFX,
59
- Urso.types.objects.GRAPHICS,
60
- Urso.types.objects.HITAREA,
61
- Urso.types.objects.MASK,
62
- Urso.types.objects.NINESLICEPLANE,
63
- Urso.types.objects.SLIDER,
64
- Urso.types.objects.SPINE,
65
- Urso.types.objects.TEXTINPUT,
66
- Urso.types.objects.WORLD
67
- ];
68
- }
69
-
70
- /**
71
- * check is adaptive property
72
- * @param {String} property
73
- * @returns {Boolean}
74
- */
75
- isAdaptiveProperty(property) {
76
- return Object.keys(this._dependencies).includes(property);
77
- };
78
-
79
- /**
80
- * property change handler (main function)
81
- * @param {Object} object
82
- * @param {String} propertyName
83
- */
84
- propertyChangeHandler(object, propertyName) {
85
- this._adaptProperty(object, propertyName);
86
- this._adaptChildProperties(object, propertyName);
87
- }
88
-
89
- /**
90
- * adapt property (launch handler changing property)
91
- * @param {Object} object
92
- * @param {String} propertyName
93
- */
94
- _adaptProperty(object, propertyName) {
95
- if (this._dependencies[propertyName])
96
- this._dependencies[propertyName](object);
97
- }
98
-
99
- /**
100
- * main function to calculate x and width
101
- * @param {Object} object
102
- */
103
- _updateHorizontal(object) {
104
- let x = this._getXAsNumber(object);
105
- x += this._adaptAnchorX(object);
106
- x += this._adaptAlignX(object);
107
- object._baseObject.x = x;
108
-
109
- this._adaptWidth(object);
110
- }
111
-
112
- /**
113
- * main function to calculate angle
114
- * @param {Object} object
115
- */
116
- _updateAngle(object) {
117
- object._baseObject.angle = object.angle;
118
-
119
- if (!this._canBeParent(object)) {
120
- return;
121
- }
122
-
123
- this._updateHorizontal(object);
124
- this._updateVertical(object);
125
- }
126
-
127
- /**
128
- * main function to calculate y and height
129
- * @param {Object} object
130
- */
131
- _updateVertical(object) {
132
- let y = this._getYAsNumber(object);
133
- y += this._adaptAnchorY(object);
134
- y += this._adaptAlignY(object);
135
- object._baseObject.y = y;
136
-
137
- this._adaptHeight(object);
138
- }
139
-
140
- /**
141
- * set property value without adaptation
142
- * @param {Object} object
143
- * @param {String} propertyName
144
- * @param {mixed} value
145
- */
146
- _setPropertyWithoutAdaption(object, propertyName, value) { //in error case
147
- object[propertyName] = value;
148
- }
149
-
150
- /**
151
- * adapt child properties if parent properties was changed
152
- * @param {Object} object
153
- * @param {String} propertyName
154
- */
155
- _adaptChildProperties(object, propertyName) {
156
- const { children } = this._parentToChildDependencies[propertyName] || {};
157
- const objectHasChildren = this._canBeParent(object) && object.hasOwnProperty('contents');
158
-
159
- if (!children || !objectHasChildren)
160
- return;
161
-
162
- for (let dependency of children)
163
- for (let child of object.contents)
164
- this.propertyChangeHandler(child, dependency);
165
- }
166
-
167
- /**
168
- * main handler when new parent was setted
169
- * @param {Object} child
170
- */
171
- _parentChangeHandler(child) {
172
- if (child.parent == null)
173
- return;
174
-
175
- for (let propertyName of this._propertiesDependentOnParent())
176
- this.propertyChangeHandler(child, propertyName);
177
- }
178
-
179
- /**
180
- * get array of properties dependent on parent
181
- * //todo cache them and get just one time
182
- * @returns {Array}
183
- */
184
- _propertiesDependentOnParent() {
185
- const properties = [];
186
-
187
- for (let propertyName of Object.keys(this._parentToChildDependencies)) {
188
- const { children } = this._parentToChildDependencies[propertyName];
189
-
190
- if (children)
191
- for (let dependency of children)
192
- properties.push(dependency);
193
- }
194
-
195
- return properties;
196
- }
197
-
198
- /**
199
- * adapt anchorX
200
- * @param {Object} object
201
- */
202
- _adaptAnchorX(object) {
203
- if (typeof object.anchorX !== 'number' || object.anchorX < 0 || object.anchorX > 1)
204
- Urso.logger.error('AnchorX value is not valid!', object);
205
-
206
- if (this._canBeParent(object)) { //parent types
207
- if (object.anchorX === 0)
208
- return 0;
209
-
210
- if (object.angle) {
211
- return this._getAnchorOffsetByAngle(object, 'x');
212
- }
213
-
214
- const objectWidth = this._getWidthAsNumber(object);
215
- return - objectWidth * object.anchorX;
216
- } else if (!this._typesWithoutAnchor.includes(object.type)) { //regular type and not a type without anchor
217
- const pixiObject = object._baseObject;
218
- pixiObject.anchor.x = object.anchorX;
219
- } else {
220
- Urso.logger.warn(); ('AnchorX value cannot be used with this object type !', object);
221
- }
222
-
223
- return 0;
224
- }
225
-
226
- /**
227
- * adapt anchorY
228
- * @param {Object} object
229
- */
230
- _adaptAnchorY(object) {
231
- if (typeof object.anchorY !== 'number' || object.anchorY < 0 || object.anchorY > 1)
232
- Urso.logger.error('AnchorY value is not valid!', object);
233
-
234
- if (this._canBeParent(object)) { //parent types
235
- if (object.anchorY === 0)
236
- return 0;
237
-
238
- if (object.angle) {
239
- return this._getAnchorOffsetByAngle(object, 'y');
240
- }
241
-
242
- const objectHeight = this._getHeightAsNumber(object);
243
- return - objectHeight * object.anchorY;
244
- } else if (!this._typesWithoutAnchor.includes(object.type)) { //regular type and not a type without anchor
245
- const pixiObject = object._baseObject;
246
- pixiObject.anchor.y = object.anchorY;
247
- } else {
248
- Urso.logger.warn(); ('AnchorY value cannot be used with this object type !', object);
249
- }
250
-
251
- return 0;
252
- }
253
-
254
- /**
255
- * get anchor offset by angle for parent types
256
- * @param {Object} object
257
- * @param {String} side - x or y
258
- * @returns {Number}
259
- */
260
- _getAnchorOffsetByAngle(object, side) { //side can be x or y
261
- const objectWidth = this._getWidthAsNumber(object);
262
- const objectHeight = this._getHeightAsNumber(object);
263
- const xCatet = (objectWidth * object.anchorX);
264
- const yCatet = (objectHeight * object.anchorY);
265
- const offsetRadius = Math.sqrt(Math.pow(xCatet, 2) + Math.pow(yCatet, 2));
266
- const angleRadian = Math.atan(xCatet / yCatet); //todo or yCatet/xCatet ?
267
- const angle = Urso.helper.getAngle(angleRadian);
268
- const offsetAngle = object.angle + angle;
269
- const offsetFunction = side === 'x' ? 'cos' : 'sin';
270
- const angleOffset = - offsetRadius * Math[offsetFunction](Urso.helper.getRadian(offsetAngle));
271
-
272
- return angleOffset;
273
- }
274
-
275
- /**
276
- * adapt scaleX
277
- * @param {Object} object
278
- */
279
- _adaptScaleX(object) {
280
- if (object.scaleX !== 1 && typeof object.width !== 'boolean') {
281
- Urso.logger.error('ScaleX value cannot be set. Width already used!!');
282
- this._setPropertyWithoutAdaption(object, 'scaleX', 1);
283
- return;
284
- }
285
-
286
- if (typeof object.scaleX === 'number') {
287
- const pixiObject = object._baseObject;
288
- pixiObject.scale.x = object.scaleX;
289
- } else
290
- Urso.logger.error('ScaleX value is not valid!');
291
- }
292
-
293
- /**
294
- * adapt scaleY
295
- * @param {Object} object
296
- */
297
- _adaptScaleY(object) {
298
- if (object.scaleY !== 1 && typeof object.height !== 'boolean') {
299
- Urso.logger.error('ScaleY value cannot be set. Height already used!!');
300
- this._setPropertyWithoutAdaption(object, 'scaleY', 1);
301
- return;
302
- }
303
-
304
- if (typeof object.scaleY === 'number' && object.scaleY >= 0) { // TODO: CHECK SCALE CAN BE NEGATIVE
305
- const pixiObject = object._baseObject;
306
- pixiObject.scale.y = object.scaleY;
307
- } else
308
- Urso.logger.error('ScaleY value is not valid!');
309
- }
310
-
311
- /**
312
- * adapt alignX
313
- * @param {Object} object
314
- */
315
- _adaptAlignX(object) {
316
- if (typeof object.alignX !== 'string') {
317
- Urso.logger.error('AlignX value is not string!');
318
- return 0;
319
- }
320
-
321
- switch (object.alignX) {
322
- case 'left':
323
- return 0;
324
- case 'right':
325
- return object.parent ? this._getWidthAsNumber(object.parent) : 0; //parentWidth
326
- case 'center':
327
- const parentWidth = object.parent ? this._getWidthAsNumber(object.parent) : 0;
328
- return parentWidth / 2;
329
- default:
330
- Urso.logger.error('AlignX string is not valid!');
331
- return 0;
332
- }
333
- }
334
-
335
- /**
336
- * adapt alignY
337
- * @param {Object} object
338
- */
339
- _adaptAlignY(object) {
340
- if (typeof object.alignY !== 'string') {
341
- Urso.logger.error('AlignY value is not string!');
342
- return 0;
343
- }
344
-
345
- switch (object.alignY) {
346
- case 'top':
347
- return 0;
348
- case 'bottom':
349
- return object.parent ? this._getHeightAsNumber(object.parent) : 0; //parentHeight
350
- case 'center':
351
- const parentHeight = object.parent ? this._getHeightAsNumber(object.parent) : 0;
352
- return parentHeight / 2;
353
- default:
354
- Urso.logger.error('AlignY string is not valid!');
355
- return 0;
356
- }
357
- }
358
-
359
- /**
360
- * adapt width
361
- * @param {Object} object
362
- */
363
- _adaptWidth(object) {
364
- if (typeof object.width !== 'boolean' && object.scaleX !== 1) {
365
- Urso.logger.error('Width value cannot be set. ScaleX already used!!', object);
366
- this._setPropertyWithoutAdaption(object, 'width', false);
367
- return;
368
- }
369
-
370
- if (!object.width)
371
- return;
372
-
373
- if (!this._isValueANumberOrPercentsString(object.width))
374
- return Urso.logger.error('Width value is not valid!!');
375
-
376
- if (!this._canBeParent(object)) {
377
- const pixiObject = object._baseObject;
378
- pixiObject.width = this._getWidthAsNumber(object);
379
- }
380
- }
381
-
382
- /**
383
- * adapt height
384
- * @param {Object} object
385
- */
386
- _adaptHeight(object) {
387
- if (typeof object.height !== 'boolean' && object.scaleY !== 1) {
388
- Urso.logger.error('Height value cannot be set. ScaleY already used!!', object);
389
- this._setPropertyWithoutAdaption(object, 'height', false);
390
- return;
391
- }
392
-
393
- if (!object.height)
394
- return;
395
-
396
- if (!this._isValueANumberOrPercentsString(object.height))
397
- return Urso.logger.error('Height value not valid!');
398
-
399
- if (!this._canBeParent(object)) {
400
- const pixiObject = object._baseObject;
401
- pixiObject.height = this._getHeightAsNumber(object);
402
- }
403
- }
404
-
405
- /**
406
- * get x number value
407
- * @param {Object} object
408
- * @returns {Number}
409
- */
410
- _getXAsNumber(object) {
411
- return this._getPropertyAsNumber(object, 'x', 'width');
412
- }
413
-
414
- /**
415
- * get y number value
416
- * @param {Object} object
417
- * @returns {Number}
418
- */
419
- _getYAsNumber(object) {
420
- return this._getPropertyAsNumber(object, 'y', 'height');
421
- }
422
-
423
- /**
424
- * get width number value
425
- * @param {Object} object
426
- * @returns {Number}
427
- */
428
- _getWidthAsNumber(object) {
429
- return this._getPropertyAsNumber(object, 'width', 'width');
430
- }
431
-
432
- /**
433
- * get height number value
434
- * @param {Object} object
435
- * @returns {Number}
436
- */
437
- _getHeightAsNumber(object) {
438
- return this._getPropertyAsNumber(object, 'height', 'height');
439
- }
440
-
441
- /**
442
- * get x, y, width or height number value
443
- * @param {Object} object
444
- * @param {String} propertyName
445
- * @param {String} parentPropertyName
446
- * @returns {Number}
447
- */
448
- _getPropertyAsNumber(object, propertyName, parentPropertyName) {
449
- const propType = typeof object[propertyName];
450
-
451
- switch (propType) {
452
- case 'number':
453
- return object[propertyName];
454
-
455
- case 'string':
456
- const parentValue = this._getPropertyAsNumber(object.parent, parentPropertyName, parentPropertyName);
457
- return this._getRoundedPercentageOfNumber(object[propertyName], parentValue);
458
-
459
- case 'boolean':
460
- return this._getPropertyAsNumber(object.parent, propertyName, parentPropertyName)
461
-
462
- default:
463
- Urso.logger.error('Property value not number or string!', object, propertyName);
464
- return;
465
- }
466
- }
467
-
468
- /**
469
- * get rounded persents of number
470
- * @param {String} percentsString
471
- * @param {Number} number
472
- * @returns {Number}
473
- */
474
- _getRoundedPercentageOfNumber(percentsString, number) {
475
- const percentsFloat = parseFloat(percentsString);
476
- return ~~(percentsFloat * number / 100);
477
- }
478
-
479
- /**
480
- * check can be object a parent (by type)
481
- * @param {Object} object
482
- * @returns {Boolean}
483
- */
484
- _canBeParent(object) {
485
- return this._parentTypes.includes(object.type);
486
- }
487
-
488
- /**
489
- * check is value a number or a percents string
490
- * @param {mixed} value
491
- * @returns {Boolean}
492
- */
493
- _isValueANumberOrPercentsString(value) {
494
- return typeof value === 'number' || (typeof value === 'string' && value.endsWith('%'))
495
- }
496
-
497
- /**
498
- * main function to handle stretchingType
499
- * @param {Object} object
500
- */
501
- _adaptStretchingType(object) {
502
- if (object.width !== '100%' || object.height !== '100%' || !object.stretchingType)
503
- return;
504
-
505
- switch (object.stretchingType) {
506
- case 'inscribed':
507
- this._inscribe(object);
508
- break;
509
-
510
- case 'circumscribed':
511
- this._circumscribe(object);
512
- break;
513
-
514
- case 'false':
515
- break;
516
-
517
- default:
518
- Urso.logger.error('StretchingType value not valid!');
519
- break;
520
- }
521
- }
522
-
523
- /**
524
- * set property and adapt it (only for stretchingType)
525
- * @param {Object} object
526
- * @param {String} propertyName
527
- * @param {Number} value
528
- */
529
- _setPropertyAndAdaptIt(object, propertyName, value) {
530
- object[propertyName] = value;
531
- this.propertyChangeHandler(object, propertyName);
532
- }
533
-
534
- /**
535
- * set streching (only for stretchingType)
536
- * @param {Object} object
537
- * @param {Object} params
538
- */
539
- _setStreching(object, { scale, objectWidth, objectHeight }) {
540
- if (object.scaleX === 1)
541
- this._setPropertyAndAdaptIt(object, 'width', objectWidth * scale);
542
- else
543
- this._setPropertyAndAdaptIt(object, 'scaleX', scale);
544
-
545
- if (object.scaleY === 1)
546
- this._setPropertyAndAdaptIt(object, 'height', objectHeight * scale);
547
- else
548
- this._setPropertyAndAdaptIt(object, 'scaleY', scale);
549
- }
550
-
551
- /**
552
- * get object values for streching (only for stretchingType)
553
- * @param {Object} object
554
- */
555
- _getObjectValuesForStreching(object) {
556
- const objectWidth = this._getWidthAsNumber(object);
557
- const objectHeight = this._getHeightAsNumber(object);
558
- const parentWidth = this._getWidthAsNumber(object.parent);
559
- const parentHeight = this._getHeightAsNumber(object.parent);
560
-
561
- const scaleX = parentWidth / objectWidth;
562
- const scaleY = parentHeight / objectHeight;
563
-
564
- return { objectWidth, objectHeight, scaleX, scaleY };
565
- }
566
-
567
- /**
568
- * inscribe handler (only for stretchingType)
569
- * @param {Object} object
570
- */
571
- _inscribe(object) {
572
- const { objectWidth, objectHeight, scaleX, scaleY } = this._getObjectValuesForStreching(object);
573
- const scale = Math.min(scaleX, scaleY);
574
- this._setStreching(object, { scale, objectWidth, objectHeight });
575
- }
576
-
577
- /**
578
- * circumscribe handler (only for stretchingType)
579
- * @param {Object} object
580
- */
581
- _circumscribe(object) {
582
- const { objectWidth, objectHeight, scaleX, scaleY } = this._getObjectValuesForStreching(object);
583
- const scale = Math.max(scaleX, scaleY);
584
- this._setStreching(object, { scale, objectWidth, objectHeight });
585
- }
586
- }
587
-
1
+ /**
2
+ * adapter Urso to Pixi objects
3
+ */
4
+ class PropertyAdapter {
5
+
6
+ constructor() {
7
+ this.singleton = true;
8
+
9
+ /**
10
+ * dependencies, functions to handle changing property
11
+ */
12
+ this._dependencies = {
13
+ 'x': this._updateHorizontal.bind(this),
14
+ 'y': this._updateVertical.bind(this),
15
+ 'anchorX': this._updateHorizontal.bind(this),
16
+ 'anchorY': this._updateVertical.bind(this),
17
+ 'scaleX': this._adaptScaleX.bind(this),
18
+ 'scaleY': this._adaptScaleY.bind(this),
19
+ 'alignX': this._updateHorizontal.bind(this),
20
+ 'alignY': this._updateVertical.bind(this),
21
+ 'width': this._updateHorizontal.bind(this),
22
+ 'height': this._updateVertical.bind(this),
23
+ 'angle': this._updateAngle.bind(this),
24
+ 'stretchingType': this._adaptStretchingType.bind(this), //todo check on parent change
25
+ 'parent': this._parentChangeHandler.bind(this)
26
+ };
27
+
28
+ /**
29
+ * functions to handle changing parent property
30
+ */
31
+ this._parentToChildDependencies = {
32
+ 'width': { children: ['width'] },
33
+ 'height': { children: ['height'] },
34
+ 'anchorX': { children: ['x'] },
35
+ 'anchorY': { children: ['y'] },
36
+ 'stretchingType': { children: ['width', 'height'] }
37
+ };
38
+
39
+ /**
40
+ * parent types list
41
+ */
42
+ this._parentTypes = [
43
+ Urso.types.objects.COMPONENT,
44
+ Urso.types.objects.CONTAINER,
45
+ Urso.types.objects.DRAGCONTAINER,
46
+ Urso.types.objects.GROUP,
47
+ Urso.types.objects.SCROLLBOX,
48
+ Urso.types.objects.SLIDER,
49
+ Urso.types.objects.WORLD
50
+ ];
51
+
52
+ /**
53
+ * types without ahchor list
54
+ */
55
+ this._typesWithoutAnchor = [
56
+ Urso.types.objects.CHECKBOX,
57
+ Urso.types.objects.EMITTER,
58
+ Urso.types.objects.EMITTERFX,
59
+ Urso.types.objects.GRAPHICS,
60
+ Urso.types.objects.HITAREA,
61
+ Urso.types.objects.MASK,
62
+ Urso.types.objects.NINESLICEPLANE,
63
+ Urso.types.objects.SLIDER,
64
+ Urso.types.objects.SPINE,
65
+ Urso.types.objects.TEXTINPUT,
66
+ Urso.types.objects.WORLD
67
+ ];
68
+ }
69
+
70
+ /**
71
+ * check is adaptive property
72
+ * @param {String} property
73
+ * @returns {Boolean}
74
+ */
75
+ isAdaptiveProperty(property) {
76
+ return Object.keys(this._dependencies).includes(property);
77
+ };
78
+
79
+ /**
80
+ * property change handler (main function)
81
+ * @param {Object} object
82
+ * @param {String} propertyName
83
+ */
84
+ propertyChangeHandler(object, propertyName) {
85
+ this._adaptProperty(object, propertyName);
86
+ this._adaptChildProperties(object, propertyName);
87
+ }
88
+
89
+ /**
90
+ * adapt property (launch handler changing property)
91
+ * @param {Object} object
92
+ * @param {String} propertyName
93
+ */
94
+ _adaptProperty(object, propertyName) {
95
+ if (this._dependencies[propertyName])
96
+ this._dependencies[propertyName](object);
97
+ }
98
+
99
+ /**
100
+ * main function to calculate x and width
101
+ * @param {Object} object
102
+ */
103
+ _updateHorizontal(object) {
104
+ let x = this._getXAsNumber(object);
105
+ x += this._adaptAnchorX(object);
106
+ x += this._adaptAlignX(object);
107
+ object._baseObject.x = x;
108
+
109
+ this._adaptWidth(object);
110
+ }
111
+
112
+ /**
113
+ * main function to calculate angle
114
+ * @param {Object} object
115
+ */
116
+ _updateAngle(object) {
117
+ object._baseObject.angle = object.angle;
118
+
119
+ if (!this._canBeParent(object)) {
120
+ return;
121
+ }
122
+
123
+ this._updateHorizontal(object);
124
+ this._updateVertical(object);
125
+ }
126
+
127
+ /**
128
+ * main function to calculate y and height
129
+ * @param {Object} object
130
+ */
131
+ _updateVertical(object) {
132
+ let y = this._getYAsNumber(object);
133
+ y += this._adaptAnchorY(object);
134
+ y += this._adaptAlignY(object);
135
+ object._baseObject.y = y;
136
+
137
+ this._adaptHeight(object);
138
+ }
139
+
140
+ /**
141
+ * set property value without adaptation
142
+ * @param {Object} object
143
+ * @param {String} propertyName
144
+ * @param {mixed} value
145
+ */
146
+ _setPropertyWithoutAdaption(object, propertyName, value) { //in error case
147
+ object[propertyName] = value;
148
+ }
149
+
150
+ /**
151
+ * adapt child properties if parent properties was changed
152
+ * @param {Object} object
153
+ * @param {String} propertyName
154
+ */
155
+ _adaptChildProperties(object, propertyName) {
156
+ const { children } = this._parentToChildDependencies[propertyName] || {};
157
+ const objectHasChildren = this._canBeParent(object) && object.hasOwnProperty('contents');
158
+
159
+ if (!children || !objectHasChildren)
160
+ return;
161
+
162
+ for (let dependency of children)
163
+ for (let child of object.contents)
164
+ this.propertyChangeHandler(child, dependency);
165
+ }
166
+
167
+ /**
168
+ * main handler when new parent was setted
169
+ * @param {Object} child
170
+ */
171
+ _parentChangeHandler(child) {
172
+ if (child.parent == null)
173
+ return;
174
+
175
+ for (let propertyName of this._propertiesDependentOnParent())
176
+ this.propertyChangeHandler(child, propertyName);
177
+ }
178
+
179
+ /**
180
+ * get array of properties dependent on parent
181
+ * //todo cache them and get just one time
182
+ * @returns {Array}
183
+ */
184
+ _propertiesDependentOnParent() {
185
+ const properties = [];
186
+
187
+ for (let propertyName of Object.keys(this._parentToChildDependencies)) {
188
+ const { children } = this._parentToChildDependencies[propertyName];
189
+
190
+ if (children)
191
+ for (let dependency of children)
192
+ properties.push(dependency);
193
+ }
194
+
195
+ return properties;
196
+ }
197
+
198
+ /**
199
+ * adapt anchorX
200
+ * @param {Object} object
201
+ */
202
+ _adaptAnchorX(object) {
203
+ if (typeof object.anchorX !== 'number' || object.anchorX < 0 || object.anchorX > 1)
204
+ Urso.logger.error('AnchorX value is not valid!', object);
205
+
206
+ if (this._canBeParent(object)) { //parent types
207
+ if (object.anchorX === 0)
208
+ return 0;
209
+
210
+ if (object.angle) {
211
+ return this._getAnchorOffsetByAngle(object, 'x');
212
+ }
213
+
214
+ const objectWidth = this._getWidthAsNumber(object);
215
+ return - objectWidth * object.anchorX;
216
+ } else if (!this._typesWithoutAnchor.includes(object.type)) { //regular type and not a type without anchor
217
+ const pixiObject = object._baseObject;
218
+ pixiObject.anchor.x = object.anchorX;
219
+ } else {
220
+ Urso.logger.warn(); ('AnchorX value cannot be used with this object type !', object);
221
+ }
222
+
223
+ return 0;
224
+ }
225
+
226
+ /**
227
+ * adapt anchorY
228
+ * @param {Object} object
229
+ */
230
+ _adaptAnchorY(object) {
231
+ if (typeof object.anchorY !== 'number' || object.anchorY < 0 || object.anchorY > 1)
232
+ Urso.logger.error('AnchorY value is not valid!', object);
233
+
234
+ if (this._canBeParent(object)) { //parent types
235
+ if (object.anchorY === 0)
236
+ return 0;
237
+
238
+ if (object.angle) {
239
+ return this._getAnchorOffsetByAngle(object, 'y');
240
+ }
241
+
242
+ const objectHeight = this._getHeightAsNumber(object);
243
+ return - objectHeight * object.anchorY;
244
+ } else if (!this._typesWithoutAnchor.includes(object.type)) { //regular type and not a type without anchor
245
+ const pixiObject = object._baseObject;
246
+ pixiObject.anchor.y = object.anchorY;
247
+ } else {
248
+ Urso.logger.warn(); ('AnchorY value cannot be used with this object type !', object);
249
+ }
250
+
251
+ return 0;
252
+ }
253
+
254
+ /**
255
+ * get anchor offset by angle for parent types
256
+ * @param {Object} object
257
+ * @param {String} side - x or y
258
+ * @returns {Number}
259
+ */
260
+ _getAnchorOffsetByAngle(object, side) { //side can be x or y
261
+ const objectWidth = this._getWidthAsNumber(object);
262
+ const objectHeight = this._getHeightAsNumber(object);
263
+ const xCatet = (objectWidth * object.anchorX);
264
+ const yCatet = (objectHeight * object.anchorY);
265
+ const offsetRadius = Math.sqrt(Math.pow(xCatet, 2) + Math.pow(yCatet, 2));
266
+ const angleRadian = Math.atan(xCatet / yCatet); //todo or yCatet/xCatet ?
267
+ const angle = Urso.helper.getAngle(angleRadian);
268
+ const offsetAngle = object.angle + angle;
269
+ const offsetFunction = side === 'x' ? 'cos' : 'sin';
270
+ const angleOffset = - offsetRadius * Math[offsetFunction](Urso.helper.getRadian(offsetAngle));
271
+
272
+ return angleOffset;
273
+ }
274
+
275
+ /**
276
+ * adapt scaleX
277
+ * @param {Object} object
278
+ */
279
+ _adaptScaleX(object) {
280
+ if (object.scaleX !== 1 && typeof object.width !== 'boolean') {
281
+ Urso.logger.error('ScaleX value cannot be set. Width already used!!');
282
+ this._setPropertyWithoutAdaption(object, 'scaleX', 1);
283
+ return;
284
+ }
285
+
286
+ if (typeof object.scaleX === 'number') {
287
+ const pixiObject = object._baseObject;
288
+ pixiObject.scale.x = object.scaleX;
289
+ } else
290
+ Urso.logger.error('ScaleX value is not valid!');
291
+ }
292
+
293
+ /**
294
+ * adapt scaleY
295
+ * @param {Object} object
296
+ */
297
+ _adaptScaleY(object) {
298
+ if (object.scaleY !== 1 && typeof object.height !== 'boolean') {
299
+ Urso.logger.error('ScaleY value cannot be set. Height already used!!');
300
+ this._setPropertyWithoutAdaption(object, 'scaleY', 1);
301
+ return;
302
+ }
303
+
304
+ if (typeof object.scaleY === 'number' && object.scaleY >= 0) { // TODO: CHECK SCALE CAN BE NEGATIVE
305
+ const pixiObject = object._baseObject;
306
+ pixiObject.scale.y = object.scaleY;
307
+ } else
308
+ Urso.logger.error('ScaleY value is not valid!');
309
+ }
310
+
311
+ /**
312
+ * adapt alignX
313
+ * @param {Object} object
314
+ */
315
+ _adaptAlignX(object) {
316
+ if (typeof object.alignX !== 'string') {
317
+ Urso.logger.error('AlignX value is not string!');
318
+ return 0;
319
+ }
320
+
321
+ switch (object.alignX) {
322
+ case 'left':
323
+ return 0;
324
+ case 'right':
325
+ return object.parent ? this._getWidthAsNumber(object.parent) : 0; //parentWidth
326
+ case 'center':
327
+ const parentWidth = object.parent ? this._getWidthAsNumber(object.parent) : 0;
328
+ return parentWidth / 2;
329
+ default:
330
+ Urso.logger.error('AlignX string is not valid!');
331
+ return 0;
332
+ }
333
+ }
334
+
335
+ /**
336
+ * adapt alignY
337
+ * @param {Object} object
338
+ */
339
+ _adaptAlignY(object) {
340
+ if (typeof object.alignY !== 'string') {
341
+ Urso.logger.error('AlignY value is not string!');
342
+ return 0;
343
+ }
344
+
345
+ switch (object.alignY) {
346
+ case 'top':
347
+ return 0;
348
+ case 'bottom':
349
+ return object.parent ? this._getHeightAsNumber(object.parent) : 0; //parentHeight
350
+ case 'center':
351
+ const parentHeight = object.parent ? this._getHeightAsNumber(object.parent) : 0;
352
+ return parentHeight / 2;
353
+ default:
354
+ Urso.logger.error('AlignY string is not valid!');
355
+ return 0;
356
+ }
357
+ }
358
+
359
+ /**
360
+ * adapt width
361
+ * @param {Object} object
362
+ */
363
+ _adaptWidth(object) {
364
+ if (typeof object.width !== 'boolean' && object.scaleX !== 1) {
365
+ Urso.logger.error('Width value cannot be set. ScaleX already used!!', object);
366
+ this._setPropertyWithoutAdaption(object, 'width', false);
367
+ return;
368
+ }
369
+
370
+ if (!object.width)
371
+ return;
372
+
373
+ if (!this._isValueANumberOrPercentsString(object.width))
374
+ return Urso.logger.error('Width value is not valid!!');
375
+
376
+ if (!this._canBeParent(object)) {
377
+ const pixiObject = object._baseObject;
378
+ pixiObject.width = this._getWidthAsNumber(object);
379
+ }
380
+ }
381
+
382
+ /**
383
+ * adapt height
384
+ * @param {Object} object
385
+ */
386
+ _adaptHeight(object) {
387
+ if (typeof object.height !== 'boolean' && object.scaleY !== 1) {
388
+ Urso.logger.error('Height value cannot be set. ScaleY already used!!', object);
389
+ this._setPropertyWithoutAdaption(object, 'height', false);
390
+ return;
391
+ }
392
+
393
+ if (!object.height)
394
+ return;
395
+
396
+ if (!this._isValueANumberOrPercentsString(object.height))
397
+ return Urso.logger.error('Height value not valid!');
398
+
399
+ if (!this._canBeParent(object)) {
400
+ const pixiObject = object._baseObject;
401
+ pixiObject.height = this._getHeightAsNumber(object);
402
+ }
403
+ }
404
+
405
+ /**
406
+ * get x number value
407
+ * @param {Object} object
408
+ * @returns {Number}
409
+ */
410
+ _getXAsNumber(object) {
411
+ return this._getPropertyAsNumber(object, 'x', 'width');
412
+ }
413
+
414
+ /**
415
+ * get y number value
416
+ * @param {Object} object
417
+ * @returns {Number}
418
+ */
419
+ _getYAsNumber(object) {
420
+ return this._getPropertyAsNumber(object, 'y', 'height');
421
+ }
422
+
423
+ /**
424
+ * get width number value
425
+ * @param {Object} object
426
+ * @returns {Number}
427
+ */
428
+ _getWidthAsNumber(object) {
429
+ return this._getPropertyAsNumber(object, 'width', 'width');
430
+ }
431
+
432
+ /**
433
+ * get height number value
434
+ * @param {Object} object
435
+ * @returns {Number}
436
+ */
437
+ _getHeightAsNumber(object) {
438
+ return this._getPropertyAsNumber(object, 'height', 'height');
439
+ }
440
+
441
+ /**
442
+ * get x, y, width or height number value
443
+ * @param {Object} object
444
+ * @param {String} propertyName
445
+ * @param {String} parentPropertyName
446
+ * @returns {Number}
447
+ */
448
+ _getPropertyAsNumber(object, propertyName, parentPropertyName) {
449
+ const propType = typeof object[propertyName];
450
+
451
+ switch (propType) {
452
+ case 'number':
453
+ return object[propertyName];
454
+
455
+ case 'string':
456
+ const parentValue = this._getPropertyAsNumber(object.parent, parentPropertyName, parentPropertyName);
457
+ return this._getRoundedPercentageOfNumber(object[propertyName], parentValue);
458
+
459
+ case 'boolean':
460
+ return this._getPropertyAsNumber(object.parent, propertyName, parentPropertyName)
461
+
462
+ default:
463
+ Urso.logger.error('Property value not number or string!', object, propertyName);
464
+ return;
465
+ }
466
+ }
467
+
468
+ /**
469
+ * get rounded persents of number
470
+ * @param {String} percentsString
471
+ * @param {Number} number
472
+ * @returns {Number}
473
+ */
474
+ _getRoundedPercentageOfNumber(percentsString, number) {
475
+ const percentsFloat = parseFloat(percentsString);
476
+ return ~~(percentsFloat * number / 100);
477
+ }
478
+
479
+ /**
480
+ * check can be object a parent (by type)
481
+ * @param {Object} object
482
+ * @returns {Boolean}
483
+ */
484
+ _canBeParent(object) {
485
+ return this._parentTypes.includes(object.type);
486
+ }
487
+
488
+ /**
489
+ * check is value a number or a percents string
490
+ * @param {mixed} value
491
+ * @returns {Boolean}
492
+ */
493
+ _isValueANumberOrPercentsString(value) {
494
+ return typeof value === 'number' || (typeof value === 'string' && value.endsWith('%'))
495
+ }
496
+
497
+ /**
498
+ * main function to handle stretchingType
499
+ * @param {Object} object
500
+ */
501
+ _adaptStretchingType(object) {
502
+ if (object.width !== '100%' || object.height !== '100%' || !object.stretchingType)
503
+ return;
504
+
505
+ switch (object.stretchingType) {
506
+ case 'inscribed':
507
+ this._inscribe(object);
508
+ break;
509
+
510
+ case 'circumscribed':
511
+ this._circumscribe(object);
512
+ break;
513
+
514
+ case 'false':
515
+ break;
516
+
517
+ default:
518
+ Urso.logger.error('StretchingType value not valid!');
519
+ break;
520
+ }
521
+ }
522
+
523
+ /**
524
+ * set property and adapt it (only for stretchingType)
525
+ * @param {Object} object
526
+ * @param {String} propertyName
527
+ * @param {Number} value
528
+ */
529
+ _setPropertyAndAdaptIt(object, propertyName, value) {
530
+ object[propertyName] = value;
531
+ this.propertyChangeHandler(object, propertyName);
532
+ }
533
+
534
+ /**
535
+ * set streching (only for stretchingType)
536
+ * @param {Object} object
537
+ * @param {Object} params
538
+ */
539
+ _setStreching(object, { scale, objectWidth, objectHeight }) {
540
+ if (object.scaleX === 1)
541
+ this._setPropertyAndAdaptIt(object, 'width', objectWidth * scale);
542
+ else
543
+ this._setPropertyAndAdaptIt(object, 'scaleX', scale);
544
+
545
+ if (object.scaleY === 1)
546
+ this._setPropertyAndAdaptIt(object, 'height', objectHeight * scale);
547
+ else
548
+ this._setPropertyAndAdaptIt(object, 'scaleY', scale);
549
+ }
550
+
551
+ /**
552
+ * get object values for streching (only for stretchingType)
553
+ * @param {Object} object
554
+ */
555
+ _getObjectValuesForStreching(object) {
556
+ const objectWidth = this._getWidthAsNumber(object);
557
+ const objectHeight = this._getHeightAsNumber(object);
558
+ const parentWidth = this._getWidthAsNumber(object.parent);
559
+ const parentHeight = this._getHeightAsNumber(object.parent);
560
+
561
+ const scaleX = parentWidth / objectWidth;
562
+ const scaleY = parentHeight / objectHeight;
563
+
564
+ return { objectWidth, objectHeight, scaleX, scaleY };
565
+ }
566
+
567
+ /**
568
+ * inscribe handler (only for stretchingType)
569
+ * @param {Object} object
570
+ */
571
+ _inscribe(object) {
572
+ const { objectWidth, objectHeight, scaleX, scaleY } = this._getObjectValuesForStreching(object);
573
+ const scale = Math.min(scaleX, scaleY);
574
+ this._setStreching(object, { scale, objectWidth, objectHeight });
575
+ }
576
+
577
+ /**
578
+ * circumscribe handler (only for stretchingType)
579
+ * @param {Object} object
580
+ */
581
+ _circumscribe(object) {
582
+ const { objectWidth, objectHeight, scaleX, scaleY } = this._getObjectValuesForStreching(object);
583
+ const scale = Math.max(scaleX, scaleY);
584
+ this._setStreching(object, { scale, objectWidth, objectHeight });
585
+ }
586
+ }
587
+
588
588
  module.exports = PropertyAdapter;