Allow vertical centering of smaller ascii's with 'V'

This commit is contained in:
Iam Naughton Phier 2015-03-25 17:18:06 +02:00
parent adf666baaf
commit baa8a45ea8
7 changed files with 18 additions and 17 deletions

View file

@ -39,3 +39,4 @@ x 2015-03-25 remove the SAUCE lines at bottom, return ANSI object for render @SA
x 2015-03-25 help on top of panel mode (always top)
x 2015-03-25 info page
x 2015-03-25 center panel mode vertically
x 2015-03-25 center ascii if smaller than 1 page (ansi too?)

View file

@ -41,6 +41,7 @@
<li><span class="key">Up</span><span class="key">Down</span><span class="key">Pageup</span><span class="key">Pagedown</span> Move about by line/page</li>
<li><span class="key">Home</span><span class="key">End</span> Move to top/bottom (no zoom reset)</li>
<li><span class="key">I</span> SAUCE or Partymeister info</li>
<li><span class="key">V</span> Center Small Ascii Vertically</li>
<li><span class="key">H</span> This help (: <span class="key">Esc</span> Cancel fullscreen</li>
<li class='nodot'><b>Tab also works for "info" but browsers hate it, so use 'I'</b></li>
</ul>

View file

@ -7,7 +7,7 @@
},
"filedata": [
{
"file": "spaceflight.asc",
"file": "az0!-revi510n.txt",
"name": "Spaceflight",
"amiga": true,
"filetype": "plain",

View file

@ -64,6 +64,9 @@ class @Sahli
pdiv.prepend buf.clone()
pdiv.append ptxt
pdiv.append buf
# this is still needed for some Amiga stuff done on Amiga.
# probably should allow other overrides for UTF-8 and so on.
req.overrideMimeType 'text/plain; charset=ISO-8859-1'
req.onreadystatechange = ->
if req.readyState == req.DONE
if req.status == 200 or req.status == 0
@ -143,7 +146,6 @@ class @Sahli
$('body').stop()
@loadinfopanel i
@togglefullscreen = ->
docElm = document.documentElement
if @fullscreen
@ -217,7 +219,7 @@ class @Sahli
# - save width upon draw
# - toggle zoom out to full width / normal
# - with a number, change width by that much
# if scrolling, where are we in the doc? zoom to THAT area.
# if scrolling, where are we in the doc? zoom to THAT area. - not implemented
@zoom = (amt) ->
zoomee = $('div.scrolly')
if amt?
@ -225,7 +227,6 @@ class @Sahli
newwidth = @origwidth
else
newwidth = zoomee.width() + amt
console.log "#{zoomee.width()} #{newwidth}"
zoomee.width newwidth
$('canvas').width newwidth
else
@ -324,6 +325,8 @@ class @Sahli
@panelmode(1)
when @keycode 'i'
$('div.infobox').toggle()
when @keycode 'v'
$('h6').height( (window.innerHeight - $('.scrolly').height()) / 2 )
when @keycode '1'
@changespeed 1
when @keycode '2'

View file

@ -32,17 +32,8 @@ body {
}
h6 {
position: fixed;
top: 1ex;
left: 1ex;
border: 1px green ridge;
padding: .125em 1em;
color: black;
background-color: green;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
display: none;
color: transparent;
background-color: transparent;
}
.help {
@ -131,6 +122,10 @@ p.infobox {
margin: .25ex;
}
.ty50 {
transform: translateY(-50%);
}
.bigtext {
background-color: lightsteelblue;
border: 1px outset steelblue;

View file

@ -71,6 +71,7 @@ l__________/__________|___|______l__________j_____j
pdiv.prepend(buf.clone());
pdiv.append(ptxt);
pdiv.append(buf);
req.overrideMimeType('text/plain; charset=ISO-8859-1');
req.onreadystatechange = function() {
if (req.readyState === req.DONE) {
if (req.status === 200 || req.status === 0) {
@ -266,7 +267,6 @@ l__________/__________|___|______l__________j_____j
} else {
newwidth = zoomee.width() + amt;
}
console.log((zoomee.width()) + " " + newwidth);
zoomee.width(newwidth);
return $('canvas').width(newwidth);
} else {
@ -377,6 +377,8 @@ l__________/__________|___|______l__________j_____j
return _this.panelmode(1);
case _this.keycode('i'):
return $('div.infobox').toggle();
case _this.keycode('v'):
return $('h6').height((window.innerHeight - $('.scrolly').height()) / 2);
case _this.keycode('1'):
return _this.changespeed(1);
case _this.keycode('2'):

View file

@ -7,4 +7,3 @@
(C) SAHLI ansi & ascii for load page
(C) redo load page (not popup, info)
(B) Preload
(A) center ascii if smaller than 1 page (ansi too?)