working for MY screen. Not working well in responsive view
- or Nameless' browser, which is larger.
This commit is contained in:
parent
96781e8413
commit
6987e1fd57
3 changed files with 34 additions and 39 deletions
|
|
@ -40,8 +40,9 @@
|
|||
<li><span class="key">C</span> "panel" view toggle</li>
|
||||
<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">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 'U'</b></li>
|
||||
<li class='nodot'><b>Tab also works for "info" but browsers hate it, so use 'I'</b></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
28
sahli.coffee
28
sahli.coffee
|
|
@ -249,25 +249,22 @@ class @Sahli
|
|||
ww = window.innerWidth
|
||||
wh = window.innerHeight
|
||||
numpanels = canvs.length
|
||||
fullpicheight = 0
|
||||
fullpicheight = (fullpicheight + i.height) for i in canvs
|
||||
screenratio = ww/wh
|
||||
panelratio = canvs[0].height/canvs[0].width
|
||||
|
||||
stripe_width = ww/Math.ceil(fullpicheight/ww)
|
||||
num_strips = Math.sqrt (ww/stripe_width)*(fullpicheight/wh)
|
||||
x = Math.sqrt numpanels/screenratio
|
||||
numcols = Math.round(screenratio*x)
|
||||
picdpercol = Math.round(numpanels/numcols)
|
||||
|
||||
numcols = Math.floor num_strips-1
|
||||
newwidth = ww/numcols
|
||||
|
||||
scaling_factor = num_strips * (wh / fullpicheight)
|
||||
|
||||
# newheight = canvs[0].height * scaling_factor
|
||||
# $(canvs[0]).height newheight
|
||||
newwidth = scaling_factor * canvs.height()
|
||||
canvs.width newwidth
|
||||
newheight = $(canvs[0]).height()
|
||||
|
||||
colwidth = ww/numcols
|
||||
|
||||
outer = $('<div>')
|
||||
outer.append @createpanel(i,colwidth - 6) for i in [1..numcols]
|
||||
outer.append @createpanel(i,colwidth - 6) for i in [1..numcols-1]
|
||||
outer.addClass 'nosb'
|
||||
$('#panel').append outer
|
||||
$('#outbox').toggle()
|
||||
|
|
@ -276,11 +273,14 @@ class @Sahli
|
|||
drawcol = 1
|
||||
for pic in canvs
|
||||
$("#column#{drawcol}").append pic
|
||||
level = level + newheight
|
||||
if level+(newheight/2) > wh
|
||||
level += 1
|
||||
if level > picdpercol
|
||||
level = 0
|
||||
drawcol = drawcol + 1
|
||||
|
||||
console.log "ww: #{ww} wh: #{wh} numpanels: #{numpanels} x: #{x}"
|
||||
console.log "numcols: #{numcols} picdpercol: #{picdpercol}"
|
||||
|
||||
else
|
||||
$('.scrolly').width @origwidth
|
||||
$('#outbox').show()
|
||||
|
|
@ -322,7 +322,7 @@ class @Sahli
|
|||
when @keycode 'x'
|
||||
@changescrolldirection 1
|
||||
when @keycode 'c'
|
||||
@panelmode()
|
||||
@panelmode(1)
|
||||
when @keycode '1'
|
||||
@changespeed 1
|
||||
when @keycode '2'
|
||||
|
|
|
|||
42
sahli.js
42
sahli.js
|
|
@ -281,7 +281,7 @@ l__________/__________|___|______l__________j_____j
|
|||
};
|
||||
|
||||
Sahli.panelmode = function() {
|
||||
var canvs, colwidth, drawcol, fullpicheight, i, level, newheight, newwidth, num_strips, numcols, numpanels, outer, pic, scaling_factor, stripe_width, wh, ww, _i, _j, _k, _l, _len, _len1, _len2, _results;
|
||||
var canvs, colwidth, drawcol, i, level, newheight, newwidth, numcols, numpanels, outer, panelratio, pic, picdpercol, screenratio, wh, ww, x, _i, _j, _k, _len, _len1, _ref;
|
||||
$('#panel').toggle();
|
||||
canvs = $('canvas');
|
||||
if ($('.scrolly').width() === this.origwidth) {
|
||||
|
|
@ -290,21 +290,17 @@ l__________/__________|___|______l__________j_____j
|
|||
ww = window.innerWidth;
|
||||
wh = window.innerHeight;
|
||||
numpanels = canvs.length;
|
||||
fullpicheight = 0;
|
||||
for (_i = 0, _len = canvs.length; _i < _len; _i++) {
|
||||
i = canvs[_i];
|
||||
fullpicheight = fullpicheight + i.height;
|
||||
}
|
||||
stripe_width = ww / Math.ceil(fullpicheight / ww);
|
||||
num_strips = Math.sqrt((ww / stripe_width) * (fullpicheight / wh));
|
||||
numcols = Math.floor(num_strips - 1);
|
||||
scaling_factor = num_strips * (wh / fullpicheight);
|
||||
newwidth = scaling_factor * canvs.height();
|
||||
screenratio = ww / wh;
|
||||
panelratio = canvs[0].height / canvs[0].width;
|
||||
x = Math.sqrt(numpanels / screenratio);
|
||||
numcols = Math.round(screenratio * x);
|
||||
picdpercol = Math.round(numpanels / numcols);
|
||||
newwidth = ww / numcols;
|
||||
canvs.width(newwidth);
|
||||
newheight = $(canvs[0]).height();
|
||||
colwidth = ww / numcols;
|
||||
outer = $('<div>');
|
||||
for (i = _j = 1; 1 <= numcols ? _j <= numcols : _j >= numcols; i = 1 <= numcols ? ++_j : --_j) {
|
||||
for (i = _i = 1, _ref = numcols - 1; 1 <= _ref ? _i <= _ref : _i >= _ref; i = 1 <= _ref ? ++_i : --_i) {
|
||||
outer.append(this.createpanel(i, colwidth - 6));
|
||||
}
|
||||
outer.addClass('nosb');
|
||||
|
|
@ -312,24 +308,22 @@ l__________/__________|___|______l__________j_____j
|
|||
$('#outbox').toggle();
|
||||
level = 0;
|
||||
drawcol = 1;
|
||||
_results = [];
|
||||
for (_k = 0, _len1 = canvs.length; _k < _len1; _k++) {
|
||||
pic = canvs[_k];
|
||||
for (_j = 0, _len = canvs.length; _j < _len; _j++) {
|
||||
pic = canvs[_j];
|
||||
$("#column" + drawcol).append(pic);
|
||||
level = level + newheight;
|
||||
if (level + (newheight / 2) > wh) {
|
||||
level += 1;
|
||||
if (level > picdpercol) {
|
||||
level = 0;
|
||||
_results.push(drawcol = drawcol + 1);
|
||||
} else {
|
||||
_results.push(void 0);
|
||||
drawcol = drawcol + 1;
|
||||
}
|
||||
}
|
||||
return _results;
|
||||
console.log("ww: " + ww + " wh: " + wh + " numpanels: " + numpanels + " x: " + x);
|
||||
return console.log("numcols: " + numcols + " picdpercol: " + picdpercol);
|
||||
} else {
|
||||
$('.scrolly').width(this.origwidth);
|
||||
$('#outbox').show();
|
||||
for (_l = 0, _len2 = canvs.length; _l < _len2; _l++) {
|
||||
pic = canvs[_l];
|
||||
for (_k = 0, _len1 = canvs.length; _k < _len1; _k++) {
|
||||
pic = canvs[_k];
|
||||
$('.scrolly').append(pic);
|
||||
}
|
||||
canvs.width(this.origwidth);
|
||||
|
|
@ -373,7 +367,7 @@ l__________/__________|___|______l__________j_____j
|
|||
case _this.keycode('x'):
|
||||
return _this.changescrolldirection(1);
|
||||
case _this.keycode('c'):
|
||||
return _this.panelmode();
|
||||
return _this.panelmode(1);
|
||||
case _this.keycode('1'):
|
||||
return _this.changespeed(1);
|
||||
case _this.keycode('2'):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue