scrolling, speed, change direction.

- just need zoom and I think we're done, cept for progress bar loading
This commit is contained in:
Iam Naughton Phier 2015-02-18 19:01:11 +02:00
parent 1580eecb26
commit 0d7e957bbe
2 changed files with 33 additions and 3 deletions

View file

@ -133,6 +133,7 @@ class @Sahli
$('body').stop() $('body').stop()
$('body').scrollTop(0) $('body').scrollTop(0)
@scroll_direction = 1 @scroll_direction = 1
@scroll_speed = 5
i = @currentpic i = @currentpic
filedata = @filedata filedata = @filedata
filedata[i].pic = $('<h6>' + filedata[i].file + '</h6>') filedata[i].pic = $('<h6>' + filedata[i].file + '</h6>')
@ -194,6 +195,17 @@ class @Sahli
console.log "#{@scroll_speed} | #{steps}" console.log "#{@scroll_speed} | #{steps}"
scrollbox.animate { scrollTop: scrollto }, @scroll_speed * steps, 'linear' scrollbox.animate { scrollTop: scrollto }, @scroll_speed * steps, 'linear'
@changespeed = (speed) ->
@scroll_speed = speed
$('body').stop()
@scroll_direction = - @scroll_direction
@setscroll()
@changescrolldirection = (direction) ->
@scroll_direction = direction
$('body').stop()
@setscroll()
@loadkeys = -> @loadkeys = ->
$(document).on('keydown', (ev) => $(document).on('keydown', (ev) =>
switch ev.which switch ev.which
@ -205,8 +217,26 @@ class @Sahli
@setscroll() @setscroll()
when @keycode('t') when @keycode('t')
$('body').scrollTop(0) $('body').scrollTop(0)
when 8 # backspace when @keycode('a')
$('body').stop() $('body').stop()
@scroll_direction = - @scroll_direction
when @keycode('w')
@changescrolldirection -1
when @keycode('x')
@changescrolldirection 1
when @keycode('1')
@changespeed 1
when @keycode('2')
@changespeed 2
@scroll_speed = 2
when @keycode('3')
@changespeed 3
@scroll_speed = 3
when @keycode('4')
@changespeed 4
@scroll_speed = 4
when @keycode('5')
@changespeed 5
else else
console.log ev.which console.log ev.which
) )

View file

@ -3,6 +3,7 @@ body {
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
overflow: hidden; overflow: hidden;
border: none;
} }
h1#top { h1#top {
@ -15,7 +16,6 @@ h1#top {
} }
div#sahliviewer { div#sahliviewer {
border: 1px inset grey;
color: green; color: green;
padding: 0px; padding: 0px;
margin: 0px; margin: 0px;