Merge pull request #1197 from DevDennis/clip-ground-items-overlay

Clip overlays on the above scene layer to the viewport
This commit is contained in:
Adam
2018-04-01 20:53:14 -04:00
committed by GitHub
4 changed files with 25 additions and 7 deletions

View File

@@ -78,6 +78,10 @@ public interface Client extends GameEngine
int getViewportWidth();
int getViewportXOffset();
int getViewportYOffset();
int getScale();
Point getMouseCanvasPosition();

View File

@@ -508,8 +508,8 @@ public class Perspective
int minY = Math.min(Math.min(a.getY(), b.getY()), c.getY());
// For some reason, this calculation is always 4 pixels short of the actual in-client one
int maxX = Math.max(Math.max(a.getX(), b.getX()), c.getX()) + 4;
int maxY = Math.max(Math.max(a.getY(), b.getY()), c.getY()) + 4;
int maxX = Math.max(Math.max(a.getX(), b.getX()), c.getX()) + client.getViewportXOffset();
int maxY = Math.max(Math.max(a.getY(), b.getY()), c.getY()) + client.getViewportYOffset();
// ...and the rectangles in the fixed client are shifted 4 pixels right and down
if (!client.isResized())