Skip to content

Commit

Permalink
make sure selection rectangle size is positive
Browse files Browse the repository at this point in the history
  • Loading branch information
ego-lay-atman-bay committed Jul 3, 2024
1 parent 65cd5a1 commit df0a218
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,10 +590,13 @@ def updateSelectionRectangle(self, obj : wmwpy.classes.Object = None):
return

pos = numpy.array(obj.pos)
size = numpy.array(obj.size)
size = numpy.maximum(numpy.array(obj.size), [1,1])
logging.debug(f'object size: {size}')

selectionImage = Image.new('RGBA', tuple(size * obj.scale), 'black')
selectionImageDraw = ImageDraw.Draw(selectionImage)
logging.debug(f'image size: {selectionImage.size}')
logging.debug(f'rectangle size: {(0,0) + tuple(numpy.array(selectionImage.size) - (self.SELECTION_BORDER_WIDTH - 1))}')
selectionImageDraw.rectangle(
(0,0) + tuple(numpy.array(selectionImage.size) - (self.SELECTION_BORDER_WIDTH - 1)),
fill='transparent',
Expand Down

0 comments on commit df0a218

Please sign in to comment.