mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 21:53:59 +00:00
Added refresh method and updated bones properly
This commit is contained in:
parent
ec0773ab93
commit
47eca23e26
1 changed files with 27 additions and 0 deletions
|
@ -15,6 +15,8 @@ var ComponentsTransform = require('../../../../src/gameobjects/components/Transf
|
|||
var ComponentsVisible = require('../../../../src/gameobjects/components/Visible');
|
||||
var GameObject = require('../../../../src/gameobjects/GameObject');
|
||||
var SpineGameObjectRender = require('./SpineGameObjectRender');
|
||||
var CounterClockwise = require('../../../../src/math/angle/CounterClockwise');
|
||||
var RadToDeg = require('../../../../src/math/RadToDeg');
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
|
@ -123,9 +125,34 @@ var SpineGameObject = new Class({
|
|||
|
||||
this.root = this.getRootBone();
|
||||
|
||||
if (this.root)
|
||||
{
|
||||
// +90 degrees to account for the difference in Spine vs. Phaser rotation
|
||||
this.root.rotation = RadToDeg(CounterClockwise(this.rotation)) + 90;
|
||||
}
|
||||
|
||||
this.state.apply(skeleton);
|
||||
|
||||
skeleton.updateCache();
|
||||
|
||||
return this.updateSize();
|
||||
},
|
||||
|
||||
refresh: function ()
|
||||
{
|
||||
if (this.root)
|
||||
{
|
||||
// +90 degrees to account for the difference in Spine vs. Phaser rotation
|
||||
this.root.rotation = RadToDeg(CounterClockwise(this.rotation)) + 90;
|
||||
}
|
||||
|
||||
this.updateSize();
|
||||
|
||||
this.skeleton.updateCache();
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
setSize: function (width, height, offsetX, offsetY)
|
||||
{
|
||||
var skeleton = this.skeleton;
|
||||
|
|
Loading…
Reference in a new issue