From b3f739f2c4f75cbdb2613e1fe9cb7fff9b880143 Mon Sep 17 00:00:00 2001 From: whitequark Date: Fri, 12 Jul 2019 11:09:19 +0000 Subject: [PATCH] Improve layout for reference axes with very vertically small windows. --- src/drawentity.cpp | 5 +++++ src/toolbar.cpp | 1 + test/harness.cpp | 1 + 3 files changed, 7 insertions(+) diff --git a/src/drawentity.cpp b/src/drawentity.cpp index 93033e53..094b2438 100644 --- a/src/drawentity.cpp +++ b/src/drawentity.cpp @@ -587,6 +587,11 @@ void Entity::Draw(DrawAs how, Canvas *canvas) { double s = camera.scale; double h = 60 - camera.height / 2.0; double w = 60 - camera.width / 2.0; + // Shift the axis to the right if they would overlap with the toolbar. + if(SS.showToolbar) { + if(h + 30 > -(34*16 + 3*16 + 8) / 2) + w += 60; + } tail = camera.projRight.ScaledBy(w/s).Plus( camera.projUp. ScaledBy(h/s)).Minus(camera.offset); } else { diff --git a/src/toolbar.cpp b/src/toolbar.cpp index 4ca478c2..8e489648 100644 --- a/src/toolbar.cpp +++ b/src/toolbar.cpp @@ -151,6 +151,7 @@ bool GraphicsWindow::ToolbarDrawOrHitTest(int mx, int my, UiCanvas *canvas, int x = 17, y = (int)(height - 52); + // When changing these values, also change the asReference drawing code in drawentity.cpp. int fudge = 8; int h = 34*16 + 3*16 + fudge; int aleft = 0, aright = 66, atop = y+16+fudge/2, abot = y+16-h; diff --git a/test/harness.cpp b/test/harness.cpp index ced5d6ae..1927ca2a 100644 --- a/test/harness.cpp +++ b/test/harness.cpp @@ -363,6 +363,7 @@ int main(int argc, char **argv) { } SS.Init(); + SS.showToolbar = false; SS.checkClosedContour = false; Test::Helper helper = {};