Skip to content

Commit

Permalink
p/excluder: Push type conversion to the end
Browse files Browse the repository at this point in the history
  • Loading branch information
rockstorm101 authored and kliment committed Jan 29, 2023
1 parent 7cafeb5 commit 2e2adc6
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions printrun/excluder.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,20 @@ def mouse(self, event):
event.Skip()

def _line_scaler(self, orig):
# Arguments:
# orig: coordinates of two corners of a rectangle (x0, y0, x1, y1)
# Returns:
# rectangle coordinates as (x, y, width, height)
x0, y0 = self.gcode_to_real(orig[0], orig[1])
x0 = int(self.p.scale[0] * x0 + self.p.translate[0])
y0 = int(self.p.scale[1] * y0 + self.p.translate[1])
x0 = self.p.scale[0] * x0 + self.p.translate[0]
y0 = self.p.scale[1] * y0 + self.p.translate[1]
x1, y1 = self.gcode_to_real(orig[2], orig[3])
x1 = int(self.p.scale[0] * x1 + self.p.translate[0])
y1 = int(self.p.scale[1] * y1 + self.p.translate[1])
x1 = self.p.scale[0] * x1 + self.p.translate[0]
y1 = self.p.scale[1] * y1 + self.p.translate[1]
width = max(x0, x1) - min(x0, x1) + 1
height = max(y0, y1) - min(y0, y1) + 1
return (min(x0, x1), min(y0, y1), width, height,)
rectangle = (min(x0, x1), min(y0, y1), width, height)
return tuple(map(int, rectangle))

def paint_selection(self, dc):
dc = wx.GCDC(dc)
Expand Down

0 comments on commit 2e2adc6

Please sign in to comment.