Skip to content

Commit

Permalink
Keyboard: fix alignment in atreus21 and keypad
Browse files Browse the repository at this point in the history
  • Loading branch information
gcollic authored and florianfesti committed Feb 27, 2021
1 parent 0d4d4f3 commit 0c89ad2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions boxes/generators/atreus21.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,11 @@ def key(self):

# 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
8 changes: 4 additions & 4 deletions boxes/generators/keyboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ def outer_hole(self, radius=2, centered=True):
# 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)
Expand All @@ -96,10 +96,10 @@ def castle_shaped_plate_cutout(self, centered=True):
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)

0 comments on commit 0c89ad2

Please sign in to comment.