Add Optional Coordinate Labels to the Grid #71
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements the feature that was discussed in this Feedback item: https://github.com/orgs/BattlesnakeOfficial/discussions/231
Now there is a settings toggle that enabled this rows and columns to have a numerical label, to ease finding the correct coordinate, and debugging!
If we have the
showCoordinateLabels
option enabled, make theGrid
insidesmaller, so that we have room for the labels.
The labels are rendered inside
Grid
but OUTSIDE it's SVGs bounding box.We allow the SVG to overflow so that the labels are visible, when the option
is set.
This allowed us to use
-1
for the row/col where the labels went and meanswe didn't need to modify the rest of the grid generation for this PR.
To get the text centered nicely in the cell, we use a
foreignObject
and HTML + CSS. SVGs don't seem to support text styling as well as HTML,
and foreignObject seems supported in all non-IE browsers
Screenshot: