阅读背景:

最简单的方法是将Rect移动到封闭Rect的边界,以便移出它

来源:互联网 

I have a Rect A inside an enclosing Rect B. the enclosing Rect B is the area in which the Rect A is allowed to be moved. when trying to move Rect A beyond the borders of enclosing Rect B it should get stuck at a border or corner of enclosing Rect B and move no further. while moving I have the following parameters at hand: properties of enclosing Rect B, properties of Rect A before the move, potential topleft position of Rect A after the move. Note that the move is not necessarily per-pixel, it might just as well be (for example) 20 pixels, in any direction. please tell me how do I go about doing this efficiently but not over-complicated?I have a Rect A inside an enclosing Rect B. the




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: