stop using 100% width; closes #12
This commit is contained in:
parent
51bf762681
commit
e4b5e89673
@ -1936,8 +1936,9 @@
|
|||||||
case 'full':
|
case 'full':
|
||||||
return img.removeAttribute('style');
|
return img.removeAttribute('style');
|
||||||
case 'fit width':
|
case 'fit width':
|
||||||
if (iw > cw) {
|
ratio = cw / iw;
|
||||||
img.style.width = '100%';
|
if (ratio < 1) {
|
||||||
|
img.style.width = Math.floor(ratio * iw);
|
||||||
return img.style.margin = '0px';
|
return img.style.margin = '0px';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -1472,13 +1472,14 @@ imgExpand =
|
|||||||
when 'full'
|
when 'full'
|
||||||
img.removeAttribute 'style'
|
img.removeAttribute 'style'
|
||||||
when 'fit width'
|
when 'fit width'
|
||||||
if iw > cw
|
ratio = cw/iw
|
||||||
img.style.width = '100%'
|
if ratio < 1
|
||||||
|
# y'know, this width is constant between resizes
|
||||||
|
img.style.width = Math.floor ratio * iw
|
||||||
img.style.margin = '0px'
|
img.style.margin = '0px'
|
||||||
when 'fit screen'
|
when 'fit screen'
|
||||||
ratio = Math.min cw/iw, ch/ih
|
ratio = Math.min cw/iw, ch/ih
|
||||||
if ratio < 1
|
if ratio < 1
|
||||||
#XXX maybe needs + 'px' ?
|
|
||||||
img.style.width = Math.floor ratio * iw
|
img.style.width = Math.floor ratio * iw
|
||||||
img.style.margin = '0px'
|
img.style.margin = '0px'
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user