client/posts: override resize mode in home view

This commit is contained in:
Michael Serajnik 2017-12-15 19:53:52 +01:00 committed by Marcin Kurczewski
parent 85cb3d4702
commit 69421464f6
2 changed files with 9 additions and 3 deletions

View file

@ -5,18 +5,23 @@ const views = require('../util/views.js');
const optimizedResize = require('../util/optimized_resize.js');
class PostContentControl {
constructor(hostNode, post, viewportSizeCalculator) {
constructor(hostNode, post, viewportSizeCalculator, fitFunctionOverride) {
this._post = post;
this._viewportSizeCalculator = viewportSizeCalculator;
this._hostNode = hostNode;
this._template = views.getTemplate('post-content');
let fitMode = settings.get().fitMode;
if (typeof fitFunctionOverride !== 'undefined') {
fitMode = fitFunctionOverride;
}
this._currentFitFunction = {
'fit-both': this.fitBoth,
'fit-original': this.fitOriginal,
'fit-width': this.fitWidth,
'fit-height': this.fitHeight,
}[settings.get().fitMode] || this.fitBoth;
}[fitMode] || this.fitBoth;
this._install();

View file

@ -62,7 +62,8 @@ class HomeView {
window.innerWidth * 0.8,
window.innerHeight * 0.7,
];
});
},
'fit-both');
this._postNotesOverlay = new PostNotesOverlayControl(
this._postContainerNode.querySelector('.post-overlay'),