public FNodeFollower(FNode follower,FNode following) { _follower=follower; _following=following; Vector2 globalPos=_following.LocalToGlobal(Vector2.zero); Vector2 localPos=_follower.container.GlobalToLocal(globalPos); _offset=_follower.GetPosition()-localPos; ((IFNodeWatcher)this).Watch(_following); }
public static Vector2 GetGlobalTopLeftRectPoint(Rect rect, FNode node) { if (node.isOnStage) { return(node.LocalToGlobal(new Vector2(rect.xMin, rect.yMax))); } else { return(new Vector2(-1, -1)); } }
public static Vector2 GetGlobalBottomRightRectPoint(Rect rect, FNode node) { if (node.isOnStage) { return(node.LocalToGlobal(new Vector2(rect.xMax, rect.yMin))); } else { return(new Vector2(-1, -1)); } }
public Vector2 OtherToLocal(FNode otherNode, Vector2 otherVector) //takes a point in another node and converts it to a point in this node { return(GlobalToLocal(otherNode.LocalToGlobal(otherVector))); }
//takes a point in another node and converts it to a point in this node public Vector2 OtherToLocal(FNode otherNode, Vector2 otherVector) { return GlobalToLocal(otherNode.LocalToGlobal(otherVector)); }
//returns the position in THIS node of a point in the OTHER node public Vector2 LocalToLocal(FNode otherNode, Vector2 otherVector) { UpdateMatrix(); return GlobalToLocal(otherNode.LocalToGlobal(otherVector)); }
public Vector2 OtherToLocal(FNode otherNode, Vector2 otherVector) //takes a point in another node and converts it to a point in this node { return GlobalToLocal(otherNode.LocalToGlobal(otherVector)); }
public Vector2 LocalToLocal(FNode otherNode, Vector2 otherVector) //returns the position in THIS node of a point in the OTHER node { return(GlobalToLocal(otherNode.LocalToGlobal(otherVector))); }