mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 06:30:38 +00:00
Merge pull request #6236 from samme/feature/group-post-creation-options
Skip the Group createMultiple() post-creation options if not set
This commit is contained in:
commit
a5b3b91da1
1 changed files with 51 additions and 29 deletions
|
@ -11,6 +11,7 @@ var EventEmitter = require('eventemitter3');
|
|||
var GetAll = require('../../utils/array/GetAll');
|
||||
var GetFastValue = require('../../utils/object/GetFastValue');
|
||||
var GetValue = require('../../utils/object/GetValue');
|
||||
var HasValue = require('../../utils/object/HasValue');
|
||||
var IsPlainObject = require('../../utils/object/IsPlainObject');
|
||||
var Range = require('../../utils/array/Range');
|
||||
var Set = require('../../structs/Set');
|
||||
|
@ -443,48 +444,69 @@ var Group = new Class({
|
|||
|
||||
// Post-creation options (applied only to those items created in this call):
|
||||
|
||||
if (HasValue(options, 'setXY'))
|
||||
{
|
||||
var x = GetValue(options, 'setXY.x', 0);
|
||||
var y = GetValue(options, 'setXY.y', 0);
|
||||
var stepX = GetValue(options, 'setXY.stepX', 0);
|
||||
var stepY = GetValue(options, 'setXY.stepY', 0);
|
||||
|
||||
Actions.SetXY(entries, x, y, stepX, stepY);
|
||||
}
|
||||
|
||||
if (HasValue(options, 'setRotation'))
|
||||
{
|
||||
var rotation = GetValue(options, 'setRotation.value', 0);
|
||||
var stepRotation = GetValue(options, 'setRotation.step', 0);
|
||||
|
||||
Actions.SetRotation(entries, rotation, stepRotation);
|
||||
}
|
||||
|
||||
if (HasValue(options, 'setScale'))
|
||||
{
|
||||
var scaleX = GetValue(options, 'setScale.x', 1);
|
||||
var scaleY = GetValue(options, 'setScale.y', scaleX);
|
||||
var stepScaleX = GetValue(options, 'setScale.stepX', 0);
|
||||
var stepScaleY = GetValue(options, 'setScale.stepY', 0);
|
||||
|
||||
Actions.SetScale(entries, scaleX, scaleY, stepScaleX, stepScaleY);
|
||||
}
|
||||
|
||||
if (HasValue(options, 'setOrigin'))
|
||||
{
|
||||
var originX = GetValue(options, 'setOrigin.x', 0.5);
|
||||
var originY = GetValue(options, 'setOrigin.y', originX);
|
||||
var stepOriginX = GetValue(options, 'setOrigin.stepX', 0);
|
||||
var stepOriginY = GetValue(options, 'setOrigin.stepY', 0);
|
||||
|
||||
Actions.SetOrigin(entries, originX, originY, stepOriginX, stepOriginY);
|
||||
}
|
||||
|
||||
if (HasValue(options, 'setAlpha'))
|
||||
{
|
||||
var alpha = GetValue(options, 'setAlpha.value', 1);
|
||||
var stepAlpha = GetValue(options, 'setAlpha.step', 0);
|
||||
|
||||
Actions.SetAlpha(entries, alpha, stepAlpha);
|
||||
}
|
||||
|
||||
if (HasValue(options, 'setDepth'))
|
||||
{
|
||||
var depth = GetValue(options, 'setDepth.value', 0);
|
||||
var stepDepth = GetValue(options, 'setDepth.step', 0);
|
||||
|
||||
Actions.SetDepth(entries, depth, stepDepth);
|
||||
}
|
||||
|
||||
if (HasValue(options, 'setScrollFactor'))
|
||||
{
|
||||
var scrollFactorX = GetValue(options, 'setScrollFactor.x', 1);
|
||||
var scrollFactorY = GetValue(options, 'setScrollFactor.y', scrollFactorX);
|
||||
var stepScrollFactorX = GetValue(options, 'setScrollFactor.stepX', 0);
|
||||
var stepScrollFactorY = GetValue(options, 'setScrollFactor.stepY', 0);
|
||||
|
||||
Actions.SetScrollFactor(entries, scrollFactorX, scrollFactorY, stepScrollFactorX, stepScrollFactorY);
|
||||
}
|
||||
|
||||
var hitArea = GetFastValue(options, 'hitArea', null);
|
||||
var hitAreaCallback = GetFastValue(options, 'hitAreaCallback', null);
|
||||
|
|
Loading…
Reference in a new issue