Advertisement
PaleoCrafter

Untitled

Jun 8th, 2014
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.44 KB | None | 0 0
  1. reactions += {
  2.     case e: MouseEvent.Drag if enabled =>
  3.       if (e.lastButton == MouseButton.Left && clicked) {
  4.         scrollerPos = clamp(e.pos)
  5.       }
  6.     case e: MouseEvent.Click if enabled => clicked = scrollerBounds.contains(local(e.pos))
  7.       if (!clicked && hovered(e.pos))
  8.         scrollerPos = clamp(e.pos)
  9.     case e: MouseEvent.Scroll if enabled =>
  10.       if (hovered(e.pos)) {
  11.         scroll(e.direction)
  12.       }
  13.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement