mirror of
https://github.com/photonstorm/phaser
synced 2025-02-17 22:48:34 +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 ComponentsVisible = require('../../../../src/gameobjects/components/Visible');
|
||||||
var GameObject = require('../../../../src/gameobjects/GameObject');
|
var GameObject = require('../../../../src/gameobjects/GameObject');
|
||||||
var SpineGameObjectRender = require('./SpineGameObjectRender');
|
var SpineGameObjectRender = require('./SpineGameObjectRender');
|
||||||
|
var CounterClockwise = require('../../../../src/math/angle/CounterClockwise');
|
||||||
|
var RadToDeg = require('../../../../src/math/RadToDeg');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @classdesc
|
* @classdesc
|
||||||
|
@ -123,9 +125,34 @@ var SpineGameObject = new Class({
|
||||||
|
|
||||||
this.root = this.getRootBone();
|
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();
|
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)
|
setSize: function (width, height, offsetX, offsetY)
|
||||||
{
|
{
|
||||||
var skeleton = this.skeleton;
|
var skeleton = this.skeleton;
|
||||||
|
|
Loading…
Add table
Reference in a new issue