Skip to content

Commit c0d677e

Browse files
committed
Added display origin and size component
1 parent d096ef6 commit c0d677e

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

plugins/spine/src/gameobject/SpineGameObject.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
var Class = require('../../../../src/utils/Class');
88
var ComponentsAlpha = require('../../../../src/gameobjects/components/Alpha');
99
var ComponentsBlendMode = require('../../../../src/gameobjects/components/BlendMode');
10+
var ComponentsComputedSize = require('../../../../src/gameobjects/components/ComputedSize');
1011
var ComponentsDepth = require('../../../../src/gameobjects/components/Depth');
1112
var ComponentsFlip = require('../../../../src/gameobjects/components/Flip');
1213
var ComponentsScrollFactor = require('../../../../src/gameobjects/components/ScrollFactor');
@@ -33,6 +34,7 @@ var SpineGameObject = new Class({
3334
Mixins: [
3435
ComponentsAlpha,
3536
ComponentsBlendMode,
37+
ComponentsComputedSize,
3638
ComponentsDepth,
3739
ComponentsFlip,
3840
ComponentsScrollFactor,
@@ -60,6 +62,9 @@ var SpineGameObject = new Class({
6062

6163
this.timeScale = 1;
6264

65+
this.displayOriginX = 0;
66+
this.displayOriginY = 0;
67+
6368
this.setPosition(x, y);
6469

6570
if (key)
@@ -136,6 +141,15 @@ var SpineGameObject = new Class({
136141

137142
this.root = this.getRootBone();
138143

144+
var w = this.skeletonData.width;
145+
var h = this.skeletonData.height;
146+
147+
this.width = w;
148+
this.height = h;
149+
150+
this.displayOriginX = w / 2;
151+
this.displayOriginY = h / 2;
152+
139153
return this;
140154
},
141155

0 commit comments

Comments
 (0)