Skip to content

Commit bf18120

Browse files
committed
Fixed a bug about actionNode position error
1 parent 1af39e1 commit bf18120

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

extensions/cocostudio/action/CCActionNode.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ ccs.ActionNode = ccs.Class.extend(/** @lends ccs.ActionNode# */{
6464
initWithDictionary: function (dic, root) {
6565
this.setActionTag(dic["ActionTag"]);
6666
var actionFrameList = dic["actionframelist"];
67+
68+
var node = ccui.helper.seekWidgetByName(root, dic["name"]);
69+
var positionOffset = node instanceof ccui.Widget && !(node instanceof ccui.Layout);
70+
6771
for (var i = 0; i < actionFrameList.length; i++) {
6872
var actionFrameDic = actionFrameList[i];
6973
var frameIndex = actionFrameDic["frameid"];
@@ -82,6 +86,11 @@ ccs.ActionNode = ccs.Class.extend(/** @lends ccs.ActionNode# */{
8286
if (actionFrameDic["positionx"] !== undefined) {
8387
var positionX = actionFrameDic["positionx"];
8488
var positionY = actionFrameDic["positiony"];
89+
if(positionOffset && node.parent){
90+
var AnchorPointIn = node.parent.getAnchorPointInPoints();
91+
positionX += AnchorPointIn.x;
92+
positionY += AnchorPointIn.y;
93+
}
8594
actionFrame = new ccs.ActionMoveFrame();
8695
actionFrame.frameIndex = frameIndex;
8796
actionFrame.setEasingType(frameTweenType);

0 commit comments

Comments
 (0)