2018-02-12 16:01:20 +00:00
|
|
|
/**
|
|
|
|
* @author Richard Davey <rich@photonstorm.com>
|
|
|
|
* @copyright 2018 Photon Storm Ltd.
|
|
|
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
|
|
|
*/
|
|
|
|
|
2017-07-04 00:59:31 +00:00
|
|
|
var ScaleModes = require('../../renderer/ScaleModes');
|
2017-02-23 03:10:48 +00:00
|
|
|
|
2018-02-01 00:25:33 +00:00
|
|
|
/**
|
|
|
|
* Provides methods used for getting and setting the scale of a Game Object.
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Components.ScaleMode
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-02-23 03:10:48 +00:00
|
|
|
|
|
|
|
var ScaleMode = {
|
|
|
|
|
2017-02-24 01:45:15 +00:00
|
|
|
_scaleMode: ScaleModes.DEFAULT,
|
|
|
|
|
2018-02-01 00:25:33 +00:00
|
|
|
/**
|
|
|
|
* The Scale Mode being used by this Game Object.
|
|
|
|
* Can be either `ScaleModes.LINEAR` or `ScaleModes.NEAREST`.
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Components.ScaleMode#scaleMode
|
|
|
|
* @type {integer}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-02-23 03:10:48 +00:00
|
|
|
scaleMode: {
|
|
|
|
|
|
|
|
get: function ()
|
|
|
|
{
|
2017-02-24 01:45:15 +00:00
|
|
|
return this._scaleMode;
|
2017-02-23 03:10:48 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
set: function (value)
|
|
|
|
{
|
|
|
|
if (value === ScaleModes.LINEAR || value === ScaleModes.NEAREST)
|
|
|
|
{
|
2017-02-24 01:45:15 +00:00
|
|
|
this._scaleMode = value;
|
2017-02-23 03:10:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-21 02:12:25 +00:00
|
|
|
},
|
|
|
|
|
2018-02-01 00:25:33 +00:00
|
|
|
/**
|
|
|
|
* Sets the Scale Mode being used by this Game Object.
|
|
|
|
* Can be either `ScaleModes.LINEAR` or `ScaleModes.NEAREST`.
|
|
|
|
*
|
2018-02-01 01:36:52 +00:00
|
|
|
* @method Phaser.GameObjects.Components.ScaleMode#setScaleMode
|
2018-02-01 00:25:33 +00:00
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {integer} value - The Scale Mode to be used by this Game Object.
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.GameObject} This Game Object instance.
|
|
|
|
*/
|
2017-04-21 02:12:25 +00:00
|
|
|
setScaleMode: function (value)
|
|
|
|
{
|
|
|
|
this.scaleMode = value;
|
|
|
|
|
|
|
|
return this;
|
2017-02-23 03:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = ScaleMode;
|