zooming works, put the big file third for debug test speedup.
This commit is contained in:
parent
a164beedbe
commit
b1051c748f
2 changed files with 51 additions and 34 deletions
50
list.sahli
50
list.sahli
|
|
@ -30,30 +30,6 @@
|
||||||
"line2": "Test for plain files",
|
"line2": "Test for plain files",
|
||||||
"text": ""
|
"text": ""
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"file": "Blocktronics-WTF4_Megajoint.ans",
|
|
||||||
"name": "WTF4",
|
|
||||||
"amiga": false,
|
|
||||||
"filetype": "ansi",
|
|
||||||
"width": "80",
|
|
||||||
"author": "Blocktronics",
|
|
||||||
"font": "Propaz",
|
|
||||||
"color": [
|
|
||||||
0,
|
|
||||||
46,
|
|
||||||
247,
|
|
||||||
255
|
|
||||||
],
|
|
||||||
"bg": [
|
|
||||||
160,
|
|
||||||
160,
|
|
||||||
224,
|
|
||||||
255
|
|
||||||
],
|
|
||||||
"line1": "",
|
|
||||||
"line2": "",
|
|
||||||
"text": ""
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"file": "h7-supergroupies.ans",
|
"file": "h7-supergroupies.ans",
|
||||||
"name": "SuperGroupies",
|
"name": "SuperGroupies",
|
||||||
|
|
@ -78,6 +54,30 @@
|
||||||
"line2": "Ansi",
|
"line2": "Ansi",
|
||||||
"text": "Test file #1"
|
"text": "Test file #1"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"file": "Blocktronics-WTF4_Megajoint.ans",
|
||||||
|
"name": "WTF4",
|
||||||
|
"amiga": false,
|
||||||
|
"filetype": "ansi",
|
||||||
|
"width": "80",
|
||||||
|
"author": "Blocktronics",
|
||||||
|
"font": "Propaz",
|
||||||
|
"color": [
|
||||||
|
0,
|
||||||
|
46,
|
||||||
|
247,
|
||||||
|
255
|
||||||
|
],
|
||||||
|
"bg": [
|
||||||
|
160,
|
||||||
|
160,
|
||||||
|
224,
|
||||||
|
255
|
||||||
|
],
|
||||||
|
"line1": "",
|
||||||
|
"line2": "",
|
||||||
|
"text": ""
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"file": "51_DRGN.XB",
|
"file": "51_DRGN.XB",
|
||||||
"name": "Dragon",
|
"name": "Dragon",
|
||||||
|
|
@ -199,4 +199,4 @@
|
||||||
"text": ""
|
"text": ""
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
35
sahli.coffee
35
sahli.coffee
|
|
@ -48,7 +48,6 @@ class @Sahli
|
||||||
fname = @location + '/' + picdata.file
|
fname = @location + '/' + picdata.file
|
||||||
buf = $('<span>')
|
buf = $('<span>')
|
||||||
buf.css {'margin':'0 auto'}
|
buf.css {'margin':'0 auto'}
|
||||||
buf.text ' '
|
|
||||||
ptxt = $('<pre>')
|
ptxt = $('<pre>')
|
||||||
color = @calccolor(picdata.color)
|
color = @calccolor(picdata.color)
|
||||||
bgcolor = @calccolor(picdata.bg)
|
bgcolor = @calccolor(picdata.bg)
|
||||||
|
|
@ -136,8 +135,6 @@ class @Sahli
|
||||||
@nextpic = =>
|
@nextpic = =>
|
||||||
viewbox = $('div#sahliviewer')
|
viewbox = $('div#sahliviewer')
|
||||||
viewbox.children().remove()
|
viewbox.children().remove()
|
||||||
$('body').stop()
|
|
||||||
$('body').scrollTop(0)
|
|
||||||
@scroll_direction = 1
|
@scroll_direction = 1
|
||||||
@scroll_speed = 5
|
@scroll_speed = 5
|
||||||
i = @currentpic
|
i = @currentpic
|
||||||
|
|
@ -148,6 +145,9 @@ class @Sahli
|
||||||
@currentpic += 1
|
@currentpic += 1
|
||||||
if @currentpic > filedata.length - 1
|
if @currentpic > filedata.length - 1
|
||||||
@currentpic = 0
|
@currentpic = 0
|
||||||
|
$('body').stop()
|
||||||
|
$('body').scrollTop(0)
|
||||||
|
|
||||||
|
|
||||||
@togglefullscreen = ->
|
@togglefullscreen = ->
|
||||||
docElm = document.documentElement
|
docElm = document.documentElement
|
||||||
|
|
@ -215,14 +215,24 @@ class @Sahli
|
||||||
# - save width upon draw
|
# - save width upon draw
|
||||||
# - toggle zoom out to full width / normal
|
# - toggle zoom out to full width / normal
|
||||||
# - with a number, change width by that much
|
# - with a number, change width by that much
|
||||||
|
# if scrolling, where are we in the doc? zoom to THAT area.
|
||||||
@zoom = (amt) ->
|
@zoom = (amt) ->
|
||||||
zoomee = $('div.scrolly canvas')
|
zoomee = $('div.scrolly')
|
||||||
if amt > 0
|
if amt?
|
||||||
zoomee.width zoomee.width()+amt
|
if amt == 0
|
||||||
if zoomee.width() != @origwidth
|
newwidth = @origwidth
|
||||||
zoomee.width @origwidth
|
else
|
||||||
|
newwidth = zoomee.width() + amt
|
||||||
|
console.log "#{zoomee.width()} #{newwidth}"
|
||||||
|
zoomee.width newwidth
|
||||||
|
$('canvas').width newwidth
|
||||||
else
|
else
|
||||||
zoomee.width $('body').width()
|
if zoomee.width() != @origwidth
|
||||||
|
zoomee.width @origwidth
|
||||||
|
$('canvas').width '100%'
|
||||||
|
else
|
||||||
|
zoomee.width '100%'
|
||||||
|
$('canvas').width '100%'
|
||||||
|
|
||||||
|
|
||||||
@loadkeys = ->
|
@loadkeys = ->
|
||||||
|
|
@ -236,11 +246,18 @@ class @Sahli
|
||||||
@setscroll()
|
@setscroll()
|
||||||
when @keycode 't'
|
when @keycode 't'
|
||||||
$('body').scrollTop(0)
|
$('body').scrollTop(0)
|
||||||
|
@zoom 0
|
||||||
|
when @keycode 'b'
|
||||||
|
$('body').scrollTop($('body').height())
|
||||||
when @keycode 'a'
|
when @keycode 'a'
|
||||||
$('body').stop()
|
$('body').stop()
|
||||||
@scroll_direction = - @scroll_direction
|
@scroll_direction = - @scroll_direction
|
||||||
when @keycode 'z'
|
when @keycode 'z'
|
||||||
@zoom()
|
@zoom()
|
||||||
|
when @keycode 'e'
|
||||||
|
@zoom 100
|
||||||
|
when @keycode 'r'
|
||||||
|
@zoom -100
|
||||||
when @keycode 'w'
|
when @keycode 'w'
|
||||||
@changescrolldirection -1
|
@changescrolldirection -1
|
||||||
when @keycode 'x'
|
when @keycode 'x'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue