Skip to content

Commit

Permalink
Make cursor height preview dashed
Browse files Browse the repository at this point in the history
  • Loading branch information
Rampastring committed Oct 6, 2024
1 parent 5ac531f commit 87b17b8
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/TSMapEditor/Rendering/MapView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1287,10 +1287,21 @@ private void DrawTileCursor(MapTile tileUnderCursor)

int zoomedHeight = (int)(height * Camera.ZoomLevel);

Color heightBarColor = Color.Black * 0.25f;
Renderer.FillRectangle(new Rectangle((int)cellLeftPoint.X, (int)cellLeftPoint.Y, 1, zoomedHeight), heightBarColor);
Renderer.FillRectangle(new Rectangle((int)cellBottomPoint.X, (int)cellBottomPoint.Y, 1, zoomedHeight), heightBarColor);
Renderer.FillRectangle(new Rectangle((int)cellRightPoint.X, (int)cellRightPoint.Y, 1, zoomedHeight), heightBarColor);
Color heightBarColor = new Color(16, 16, 16, (int)byte.MaxValue) * 0.75f;
const int baseHeightLineSpaceAtBeginningOfStep = 6;
int heightLineSpaceAtBeginningOfStep = Camera.ScaleIntWithZoom(baseHeightLineSpaceAtBeginningOfStep);
int heightBarStep = Camera.ScaleIntWithZoom(Constants.CellHeight - baseHeightLineSpaceAtBeginningOfStep);
const int heightBarWidth = 2;

int y = 0;
while (y < zoomedHeight - heightBarStep)
{
y += heightLineSpaceAtBeginningOfStep;
Renderer.FillRectangle(new Rectangle((int)cellLeftPoint.X - 1, (int)cellLeftPoint.Y + y, heightBarWidth, heightBarStep), heightBarColor);
Renderer.FillRectangle(new Rectangle((int)cellBottomPoint.X - 1, (int)cellBottomPoint.Y + y, heightBarWidth, heightBarStep), heightBarColor);
Renderer.FillRectangle(new Rectangle((int)cellRightPoint.X - 1, (int)cellRightPoint.Y + y, heightBarWidth, heightBarStep), heightBarColor);
y += heightBarStep;
}
}

private void DrawImpassableHighlight(MapTile cell)
Expand Down

0 comments on commit 87b17b8

Please sign in to comment.