client/posts: override resize mode in home view
This commit is contained in:
parent
85cb3d4702
commit
69421464f6
|
@ -5,18 +5,23 @@ const views = require('../util/views.js');
|
||||||
const optimizedResize = require('../util/optimized_resize.js');
|
const optimizedResize = require('../util/optimized_resize.js');
|
||||||
|
|
||||||
class PostContentControl {
|
class PostContentControl {
|
||||||
constructor(hostNode, post, viewportSizeCalculator) {
|
constructor(hostNode, post, viewportSizeCalculator, fitFunctionOverride) {
|
||||||
this._post = post;
|
this._post = post;
|
||||||
this._viewportSizeCalculator = viewportSizeCalculator;
|
this._viewportSizeCalculator = viewportSizeCalculator;
|
||||||
this._hostNode = hostNode;
|
this._hostNode = hostNode;
|
||||||
this._template = views.getTemplate('post-content');
|
this._template = views.getTemplate('post-content');
|
||||||
|
|
||||||
|
let fitMode = settings.get().fitMode;
|
||||||
|
if (typeof fitFunctionOverride !== 'undefined') {
|
||||||
|
fitMode = fitFunctionOverride;
|
||||||
|
}
|
||||||
|
|
||||||
this._currentFitFunction = {
|
this._currentFitFunction = {
|
||||||
'fit-both': this.fitBoth,
|
'fit-both': this.fitBoth,
|
||||||
'fit-original': this.fitOriginal,
|
'fit-original': this.fitOriginal,
|
||||||
'fit-width': this.fitWidth,
|
'fit-width': this.fitWidth,
|
||||||
'fit-height': this.fitHeight,
|
'fit-height': this.fitHeight,
|
||||||
}[settings.get().fitMode] || this.fitBoth;
|
}[fitMode] || this.fitBoth;
|
||||||
|
|
||||||
this._install();
|
this._install();
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,8 @@ class HomeView {
|
||||||
window.innerWidth * 0.8,
|
window.innerWidth * 0.8,
|
||||||
window.innerHeight * 0.7,
|
window.innerHeight * 0.7,
|
||||||
];
|
];
|
||||||
});
|
},
|
||||||
|
'fit-both');
|
||||||
|
|
||||||
this._postNotesOverlay = new PostNotesOverlayControl(
|
this._postNotesOverlay = new PostNotesOverlayControl(
|
||||||
this._postContainerNode.querySelector('.post-overlay'),
|
this._postContainerNode.querySelector('.post-overlay'),
|
||||||
|
|
Loading…
Reference in New Issue