Added option to show/hide grid coordinates
This commit is contained in:
parent
8cc1486234
commit
8f0ca434d6
3 changed files with 6 additions and 4 deletions
|
|
@ -51,7 +51,7 @@ void GridModifyTool::gui_toolbox() {
|
|||
t.gui.input_scalar_field<uint32_t>("Subdivisions", "Subdivisions", &sDiv, 1, 10);
|
||||
g.set_subdivisions(sDiv);
|
||||
bool divOut = g.removeDivisionsOutwards;
|
||||
t.gui.checkbox_field("Subdivide outwards", "Subdivide outwards", &divOut);
|
||||
t.gui.checkbox_field("Subdivide outwards", "Subdivide when zooming out", &divOut);
|
||||
g.set_remove_divisions_outwards(divOut);
|
||||
t.gui.left_to_right_line_layout([&]() {
|
||||
CLAY({.layout = {.sizing = {.width = CLAY_SIZING_FIXED(40), .height = CLAY_SIZING_FIXED(40)}}}) {
|
||||
|
|
@ -71,6 +71,7 @@ void GridModifyTool::gui_toolbox() {
|
|||
}
|
||||
else if(!bounded && prevBoundedValue)
|
||||
g.bounds = std::nullopt;
|
||||
t.gui.checkbox_field("Show Coordinates", "Show Coordinates (visible\nwhen canvas isn't rotated)", &g.showCoordinates);
|
||||
}
|
||||
t.gui.pop_id();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -319,7 +319,7 @@ void WorldGrid::draw(GridManager& gMan, SkCanvas* canvas, const DrawData& drawDa
|
|||
canvas->rotate(-drawData.cam.c.rotation * 180.0 / std::numbers::pi);
|
||||
canvas->drawPaint(linePaint);
|
||||
canvas->restore();
|
||||
if(drawData.cam.c.rotation == 0.0 && !drawData.main->takingScreenshot) {
|
||||
if(showCoordinates && drawData.cam.c.rotation == 0.0 && !drawData.main->takingScreenshot) {
|
||||
coordinatesWillBeDrawn = true;
|
||||
WorldVec worldWindowEndPos = drawData.cam.c.pos + drawData.cam.c.dir_from_space(drawData.cam.viewingArea);
|
||||
coordinatesAxisOnBounds = bounds.has_value() && !bounds.value().fully_contains_aabb(SCollision::AABB<WorldScalar>(drawData.cam.c.pos, worldWindowEndPos));
|
||||
|
|
@ -387,7 +387,7 @@ void WorldGrid::draw_coordinates(SkCanvas* canvas, const DrawData& drawData, Vec
|
|||
|
||||
float yAxisMaxXLength = 0.0f;
|
||||
|
||||
for(int maxRepeats = 0; maxRepeats < 3; maxRepeats++) {
|
||||
for(int maxRepeats = 0; maxRepeats < 10; maxRepeats++) {
|
||||
xAxisLabels.clear();
|
||||
exponentExistsInXAxis = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ class GridManager;
|
|||
class WorldGrid {
|
||||
public:
|
||||
template <class Archive> void serialize(Archive& a) {
|
||||
a(name, gridType, size, visible, offset, bounds, color, removeDivisionsOutwards, subdivisions);
|
||||
a(name, gridType, size, visible, offset, bounds, color, removeDivisionsOutwards, subdivisions, showCoordinates);
|
||||
}
|
||||
|
||||
void draw(GridManager& gMan, SkCanvas* canvas, const DrawData& drawData);
|
||||
|
|
@ -29,6 +29,7 @@ class WorldGrid {
|
|||
Vector4f color{1.0f, 1.0f, 1.0f, 1.0f};
|
||||
bool removeDivisionsOutwards = false;
|
||||
uint32_t subdivisions = 1;
|
||||
bool showCoordinates = false;
|
||||
|
||||
std::string get_display_name();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue