Improve layout for reference axes with very vertically small windows.

pull/442/head
whitequark 2019-07-12 11:09:19 +00:00
parent b2af9cee6c
commit b3f739f2c4
3 changed files with 7 additions and 0 deletions

View File

@ -587,6 +587,11 @@ void Entity::Draw(DrawAs how, Canvas *canvas) {
double s = camera.scale; double s = camera.scale;
double h = 60 - camera.height / 2.0; double h = 60 - camera.height / 2.0;
double w = 60 - camera.width / 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( tail = camera.projRight.ScaledBy(w/s).Plus(
camera.projUp. ScaledBy(h/s)).Minus(camera.offset); camera.projUp. ScaledBy(h/s)).Minus(camera.offset);
} else { } else {

View File

@ -151,6 +151,7 @@ bool GraphicsWindow::ToolbarDrawOrHitTest(int mx, int my, UiCanvas *canvas,
int x = 17, y = (int)(height - 52); int x = 17, y = (int)(height - 52);
// When changing these values, also change the asReference drawing code in drawentity.cpp.
int fudge = 8; int fudge = 8;
int h = 34*16 + 3*16 + fudge; int h = 34*16 + 3*16 + fudge;
int aleft = 0, aright = 66, atop = y+16+fudge/2, abot = y+16-h; int aleft = 0, aright = 66, atop = y+16+fudge/2, abot = y+16-h;

View File

@ -363,6 +363,7 @@ int main(int argc, char **argv) {
} }
SS.Init(); SS.Init();
SS.showToolbar = false;
SS.checkClosedContour = false; SS.checkClosedContour = false;
Test::Helper helper = {}; Test::Helper helper = {};