Skip to content

Commit

Permalink
Rename ondraw
Browse files Browse the repository at this point in the history
Change ondraw handlers to update methods
  • Loading branch information
dmaccarthy committed Mar 18, 2023
1 parent 8b06aa0 commit 4e0776a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sc8pr/gui/slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def __init__(self, size, colors=None):
except: imgs = [Image(size, colors)]
super().__init__(imgs)

def ondraw(self, ev=None):
def update(self, ev=None):
hov = self is self.sketch.evMgr.hover
self.costumeNumber = 1 if hov else 0 # or self.canvas.focussed

Expand Down
6 changes: 4 additions & 2 deletions sc8pr/gui/textinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def _scrollCalc(self, a):
else: pix = 0
return pix, True

def scroll(self, pix=None, rel=True):
def _scroll(self, pix=None, rel=True):
# Calculate scroll when not specified
a = self.angle
if pix is None: pix = self.focussed and a in (0, 90)
Expand All @@ -317,7 +317,9 @@ def scroll(self, pix=None, rel=True):
else: self.pos = sigma(self.pos, vec2d(pix, a))
return self

def ondraw(self, ev=None): return self.scroll()
def update(self, ev):
self._scroll()
if hasattr(self, "ondraw"): self.ondraw(ev)


class TextInputCanvas(Canvas):
Expand Down

0 comments on commit 4e0776a

Please sign in to comment.