ijprest / keyboard-layout-editor

Web application to enable the design & editing of keyboard layouts
http://www.keyboard-layout-editor.com/
Other
1.3k stars 241 forks source link

[ISSUE 271] Move/Size step min size and default stepping size change. #273

Open ellisgl opened 4 years ago

ellisgl commented 4 years ago

https://github.com/ijprest/keyboard-layout-editor/issues/271

MarkJeronimus commented 4 years ago

It probably doesn't need to be 0.0001. It can probably be 0.0005 without loss of functionality, because useful steps are usually repeatedly divisions by 2:

0.5 0.25 0.125 0.0625 ← possible with 0.0005 resolution (or even 0.0025) 0.03125 ←not possible with 0.0001 resolution

Btw, does changing the parameters of just the spinner boxes also prevent rounding the coordinates down the line? Is this tested?

ellisgl commented 4 years ago

I looked for reference to those two inputs and couldn't find anything about rounding. I'll double check that. I can change it to 0.0005 - I was just selecting something as the at highest res available for 4 decimal places.

0.03125 would not be possible with 0.0005 either.

ellisgl commented 4 years ago

@MarkJeronimus I tested and just fixed a couple rounding issues. Floating point addition in JS is silly.

MarkJeronimus commented 4 years ago

Best way is to adopt the strategy used by monetary calculations. Use integer fixed-point precision (i.e. cents or hundreds of cents) and only convert to floating point when presenting values to the user.

I just realized the most common steps also includes the binary divisions of 0.75". Thats: 0.75 0.375 0.1875 0.09375 0.046875

You could use integer units which are 1/64th of an inch (0.015625") which would accommodate all those and the divisions of 0.5".

ellisgl commented 4 years ago

I was using 19.05 mm as 1 U. So in my setup in KiCAD, I use a 1.190625 mm grid, which is 1/16th (0.0625) of 1 U based on 19.05. But from what I can tell, this is all based on U, not in or mm, so you could go down to 0.0005 U, if you wanted to.

iandoug commented 3 years ago

FWIW, back in the day I set move step to 0.1, but IJP pushed it back to 0.5. Same with sizes and rotate.