From: Scott Worley Date: Fri, 28 Feb 2014 08:54:52 +0000 (-0800) Subject: change_exposure(): Pull exposure logic together X-Git-Url: http://git.scottworley.com/picsort/commitdiff_plain/138122d7c4afa09a94f38d1cf6e640d1db953ab2 change_exposure(): Pull exposure logic together --- diff --git a/picsorter.js b/picsorter.js index d721ac4..808855b 100644 --- a/picsorter.js +++ b/picsorter.js @@ -23,11 +23,6 @@ function say(message) { setTimeout(function() { $("#message").addClass("fade"); }, 1); } -function say_exposure() { - var e = (exposure / 4) - 3.5; - say((e >= 0 ? "+" : "") + e); -} - function toggle_zoom() { if (zoom) { zoom = ""; @@ -57,6 +52,13 @@ function mark_not_deleted() { say("Undeleted"); } +function change_exposure(amount) { + exposure += amount; + setpic(); + var display_exposure = (exposure / 4) - 3.5; + say((display_exposure >= 0 ? "+" : "") + display_exposure); +} + $(function() { move_to_nondeleted(1); }); @@ -67,7 +69,7 @@ Mousetrap.bind('n', function() { move_to_nondeleted(1); }); Mousetrap.bind('p', function() { move_to_nondeleted(-1); }); Mousetrap.bind('N', function() { input_index ++; say(input_index); setpic(); }); Mousetrap.bind('P', function() { input_index --; say(input_index); setpic(); }); -Mousetrap.bind('b', function() { exposure ++; say_exposure(); setpic(); }); -Mousetrap.bind('d', function() { exposure --; say_exposure(); setpic(); }); +Mousetrap.bind('b', function() { change_exposure(1); }); +Mousetrap.bind('d', function() { change_exposure(-1); }); Mousetrap.bind('x', mark_deleted); Mousetrap.bind('X', mark_not_deleted);