Correct toolbar height calculation (#885)

The toolbar height is

`int fudge = 8;`
`int h = 32*18 + 3*16 + fudge;`

It means 18 icons 32 pixels each and 3 separators 16 pixels each.

`32*18 + 3*16 + 8 = 632`
`36*16 + 3*16 + 8 = 632`

See these correct increases of the toolbar height:
bf4de993cb/toolbar.cpp (L97)
fe2ea5d5e1/toolbar.cpp (L103)
ef5db2132e/src/toolbar.cpp (L112)
ca2aad7fea/src/toolbar.cpp (L145)

And then these incorrect ones:
3e3ccdca8d/src/toolbar.cpp (L156)
https://github.com/ruevs/solvespace/blame/master/src/toolbar.cpp#L160

In addition
https://github.com/ruevs/solvespace/blob/master/src/drawentity.cpp#L618
the point at which the XYZ axis are shifted right so that they do not
overlap with the toolbar is corrected.

The original discussion is here: d45e2c4c2e
pull/889/head
ruevs 2021-01-10 17:33:26 +02:00 committed by GitHub
parent 758095adb3
commit bd41485ebe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -615,7 +615,7 @@ void Entity::Draw(DrawAs how, Canvas *canvas) {
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)
if(h + 30 > -(32*18 + 3*16 + 8) / 2)
w += 60;
}
tail = camera.projRight.ScaledBy(w/s).Plus(

View File

@ -157,7 +157,7 @@ bool GraphicsWindow::ToolbarDrawOrHitTest(int mx, int my, UiCanvas *canvas,
// When changing these values, also change the asReference drawing code in drawentity.cpp.
int fudge = 8;
int h = 36*16 + 3*16 + fudge;
int h = 32*18 + 3*16 + fudge;
int aleft = 0, aright = 66, atop = y+16+fudge/2, abot = y+16-h;
bool withinToolbar =