Fixed "original width" fit on Webkit

This commit is contained in:
rr- 2015-07-29 19:39:10 +02:00
parent b4db90bcdc
commit 5a537ba168

View file

@ -55,24 +55,26 @@ App.Presenters.PostContentPresenter = function(
height = originalHeight; height = originalHeight;
} }
} }
$wrapper.css({maxWidth: width + 'px', width: ''}); $wrapper.css({maxWidth: width + 'px'});
}, },
'fit-height': function(allowUpscale) { 'fit-height': function(allowUpscale) {
var width = containerHeight * ratio; var width = containerHeight * ratio;
if (width > originalWidth && !allowUpscale) { if (width > originalWidth && !allowUpscale) {
width = originalWidth; width = originalWidth;
} }
$wrapper.css({maxWidth: width + 'px', width: ''}); $wrapper.css({maxWidth: width + 'px'});
}, },
'fit-width': function(allowUpscale) { 'fit-width': function(allowUpscale) {
if (allowUpscale) { if (allowUpscale) {
$wrapper.css({maxWidth: containerWidth + 'px', width: ''}); $wrapper.css({maxWidth: containerWidth + 'px'});
} else { } else {
$wrapper.css({maxWidth: originalWidth + 'px', width: ''}); $wrapper.css({maxWidth: originalWidth + 'px'});
} }
}, },
'original': function(allowUpscale) { 'original': function(allowUpscale) {
$wrapper.css({maxWidth: '', width: originalWidth + 'px'}); $wrapper.css({
minWidth: originalWidth + 'px',
width: originalWidth + 'px'});
} }
}; };
} }
@ -83,6 +85,11 @@ App.Presenters.PostContentPresenter = function(
function changeFitMode(fitMode) { function changeFitMode(fitMode) {
$wrapper.data('fit-mode', fitMode); $wrapper.data('fit-mode', fitMode);
$wrapper.css({
width: '', height: '',
minWidth: '', minHeight: '',
maxWidth: '', maxHeight: '',
});
getFitters()[fitMode.style](fitMode.upscale); getFitters()[fitMode.style](fitMode.upscale);
updatePostNotesSize(); updatePostNotesSize();
} }