Commits

Michele Bini committed b332280

scroll-to-pointer: simplify code

  • Participants
  • Parent commits 5da9f3d

Comments (0)

Files changed (1)

viewport-scrolling.jl

   (let ((sw (screen-width))
 	(sh (screen-height)))
     (let ((p (query-pointer t)))
-      (let ((px (- (/ (+ (car p) (- viewport-scrolling--x viewport-scrolling--goalx)) sw) 0.5))
-	    (py (- (/ (+ (cdr p) (- viewport-scrolling--y viewport-scrolling--goaly)) sh) 0.5)))
-	(viewport-scroll-to
-	 (+ (* px sw) viewport-scrolling--goalx)
-	 (+ (* py sh) viewport-scrolling--goaly))))))
+      (viewport-scroll-to
+       (+ (car p) (* sw -0.5) viewport-scrolling--x)
+       (+ (cdr p) (* sh -0.5) viewport-scrolling--y)))))
 
 (provide 'viewport-scrolling)