stop using 100% width; closes #12

This commit is contained in:
James Campos 2011-04-24 23:31:49 -07:00
parent 51bf762681
commit e4b5e89673
2 changed files with 7 additions and 5 deletions

View File

@ -1936,8 +1936,9 @@
case 'full':
return img.removeAttribute('style');
case 'fit width':
if (iw > cw) {
img.style.width = '100%';
ratio = cw / iw;
if (ratio < 1) {
img.style.width = Math.floor(ratio * iw);
return img.style.margin = '0px';
}
break;

View File

@ -1472,13 +1472,14 @@ imgExpand =
when 'full'
img.removeAttribute 'style'
when 'fit width'
if iw > cw
img.style.width = '100%'
ratio = cw/iw
if ratio < 1
# y'know, this width is constant between resizes
img.style.width = Math.floor ratio * iw
img.style.margin = '0px'
when 'fit screen'
ratio = Math.min cw/iw, ch/ih
if ratio < 1
#XXX maybe needs + 'px' ?
img.style.width = Math.floor ratio * iw
img.style.margin = '0px'