Keyboard: fix alignment in atreus21 and keypad

This commit is contained in:
Guillaume Collic 2021-02-14 13:44:56 +01:00 committed by Florian Festi
parent 0d4d4f308b
commit 0c89ad2b17
2 changed files with 7 additions and 6 deletions

View File

@ -110,10 +110,11 @@ class Atreus21(Boxes, Keyboard):
# get case sizes
def _case_x_y(self):
x = len(self.row_offsets) * self.STANDARD_KEY_SPACING - 4
margin = self.STANDARD_KEY_SPACING - self.btn_size
x = len(self.row_offsets) * self.STANDARD_KEY_SPACING - margin
y = sum([
max(self.row_keys) * self.STANDARD_KEY_SPACING, # total button sizes
max(self.row_offsets), # offset of highest row
-4,
-margin,
])
return x, y

View File

@ -73,11 +73,11 @@ class Keyboard:
# draw clock wise to work with burn correction
straight_edge = Keyboard.SWITCH_CASE_SIZE - 2 * radius
polyline = [straight_edge, (-90, radius)] * 4
self.moveTo(0, radius, 90)
self.moveTo(self.burn, radius, 90)
self.polyline(*polyline)
self.moveTo(0, 0, 270)
self.moveTo(0, -radius)
self.moveTo(0)
self.moveTo(-self.burn)
if centered:
self.moveTo(half_size, half_size)
@ -96,10 +96,10 @@ class Keyboard:
btn_full_side = [*btn_half_side, 0, *btn_half_side[::-1]]
btn = [*btn_full_side, -90] * 4
self.moveTo(0.81, 0.81, 90)
self.moveTo(self.burn+0.81, 0.81, 90)
self.polyline(*btn)
self.moveTo(0, 0, 270)
self.moveTo(-0.81, -0.81)
self.moveTo(-self.burn-0.81, -0.81)
if centered:
self.moveTo(half_size, half_size)