stop using 100% width; closes #12
This commit is contained in:
parent
51bf762681
commit
e4b5e89673
@ -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;
|
||||
|
||||
@ -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'
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user