maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   Kagu scrollwidget snap to edge suggestion (https://talk.maemo.org/showthread.php?t=9556)

tonymaro 2007-09-07 00:12

Kagu scrollwidget snap to edge suggestion
 
Here's a change to the scrollwidget that would make it snap to the edge of an album when left to spin on it's own. If the user clicks down and holds, it will still let you stop it anywhere, but when slowing down using friction, this will cause it to scroll to the next edge of a sprite before stopping:

Code:

  def _apply_friction(self):     
    self.friction_c = self.friction_c + 1
    if self.friction_c >= self.friction:
      self.friction_c = 0
      self.speed = self.speed - cmp(self.speed,0)
     
    if abs(self.speed) < 3: # Special handling to snap to a sprite when we get slow
        if abs(self.offset) > 5:
            # still have a ways to go, so don't slow down yet
            self.speed = self.speed + cmp(self.speed,0)
        else:
            # Just snap to the edge
            self.speed = 0
            self.offset = 0



All times are GMT. The time now is 10:30.

vBulletin® Version 3.8.8