Skip to content

Commit b9e5f3e

Browse files
committed
GroupCreateConfig, which is used when calling Group.createMultiple or Group.createFromConfig, can now accept the following new properties: setOrigin: { x, y, stepX, stepY } which are applied to the items created by the Group.
1 parent f505f6a commit b9e5f3e

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

src/gameobjects/group/Group.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,13 @@ var Group = new Class({
445445

446446
Actions.SetScale(entries, scaleX, scaleY, stepScaleX, stepScaleY);
447447

448+
var originX = GetValue(options, 'setOrigin.x', 0.5);
449+
var originY = GetValue(options, 'setOrigin.y', originX);
450+
var stepOriginX = GetValue(options, 'setOrigin.stepX', 0);
451+
var stepOriginY = GetValue(options, 'setOrigin.stepY', 0);
452+
453+
Actions.SetOrigin(entries, originX, originY, stepOriginX, stepOriginY);
454+
448455
var alpha = GetValue(options, 'setAlpha.value', 1);
449456
var stepAlpha = GetValue(options, 'setAlpha.step', 0);
450457

src/gameobjects/group/typedefs/GroupCreateConfig.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@
3535
* @property {?number} [setScale.y=0] - The vertical scale of each new Game Object.
3636
* @property {?number} [setScale.stepX=0] - Increment each Game Object's horizontal scale from the previous by this amount, starting from `setScale.x`.
3737
* @property {?number} [setScale.stepY=0] - Increment each Game object's vertical scale from the previous by this amount, starting from `setScale.y`.
38+
* @property {?object} [setOrigin]
39+
* @property {?number} [setOrigin.x=0] - The horizontal origin of each new Game Object.
40+
* @property {?number} [setOrigin.y=0] - The vertical origin of each new Game Object.
41+
* @property {?number} [setOrigin.stepX=0] - Increment each Game Object's horizontal origin from the previous by this amount, starting from `setOrigin.x`.
42+
* @property {?number} [setOrigin.stepY=0] - Increment each Game object's vertical origin from the previous by this amount, starting from `setOrigin.y`.
3843
* @property {?object} [setAlpha]
3944
* @property {?number} [setAlpha.value=0] - The alpha value of each new Game Object.
4045
* @property {?number} [setAlpha.step=0] - Increment each Game Object's alpha from the previous by this amount, starting from `setAlpha.value`.

0 commit comments

Comments
 (0)