don't use ScrollDirection.Set when it's not needed
This commit is contained in:
@@ -56,17 +56,12 @@ namespace OpenRA.Graphics
|
|||||||
|
|
||||||
public ScrollDirection GetBlockedDirections()
|
public ScrollDirection GetBlockedDirections()
|
||||||
{
|
{
|
||||||
ScrollDirection blockedDirections = ScrollDirection.None;
|
var ret = ScrollDirection.None;
|
||||||
if(scrollPosition.Y <= adjustedMapBounds.Top)
|
if(scrollPosition.Y <= adjustedMapBounds.Top) ret |= ScrollDirection.Up;
|
||||||
blockedDirections = blockedDirections.Set(ScrollDirection.Up, true);
|
if(scrollPosition.X <= adjustedMapBounds.Left) ret |= ScrollDirection.Left;
|
||||||
if(scrollPosition.X <= adjustedMapBounds.Left)
|
if(scrollPosition.Y >= adjustedMapBounds.Bottom) ret |= ScrollDirection.Down;
|
||||||
blockedDirections = blockedDirections.Set(ScrollDirection.Left, true);
|
if(scrollPosition.X >= adjustedMapBounds.Right) ret |= ScrollDirection.Right;
|
||||||
if(scrollPosition.Y >= adjustedMapBounds.Bottom)
|
return ret;
|
||||||
blockedDirections = blockedDirections.Set(ScrollDirection.Down, true);
|
|
||||||
if(scrollPosition.X >= adjustedMapBounds.Right)
|
|
||||||
blockedDirections = blockedDirections.Set(ScrollDirection.Right, true);
|
|
||||||
|
|
||||||
return blockedDirections;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Viewport(int2 screenSize, Rectangle mapBounds, Renderer renderer)
|
public Viewport(int2 screenSize, Rectangle mapBounds, Renderer renderer)
|
||||||
|
|||||||
Reference in New Issue
Block a user