在Demo_Drag&Drop中的疑问..

这里的rect.x 的值是在控制器索引0时的位置坐标,  代码运行到此处控制器索引应该是在1, rect的x坐标却是在舞台外面?
 
 Rect rect = bounds.TransformRect(new Rect(0, 0, bounds.width, bounds.height), GRoot.inst);

//---!!Because at this time the container is on the right side of the stage and beginning to move to left(transition), so we need to caculate the final position
rect.x -= obj.parent.x;
 
这里我用

d.dragBounds = new Rect(bounds.x, bounds.y + 70, bounds.width, bounds.height);
也是一样的效果
 
看了坐标系统和拖放组件的教程有点想不明白此处的原理...
已邀请:

谷主

赞同来自: zxt385189027

dragBounds要求的是一个逻辑屏幕坐标,当然,demo里的界面是刚好放置在左上角,所以你的写法也没什么问题。

要回复问题请先登录注册