From 69421464f69d3ed63c329c548b4758eb16d3fd98 Mon Sep 17 00:00:00 2001 From: Michael Serajnik Date: Fri, 15 Dec 2017 19:53:52 +0100 Subject: [PATCH] client/posts: override resize mode in home view --- client/js/controls/post_content_control.js | 9 +++++++-- client/js/views/home_view.js | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/client/js/controls/post_content_control.js b/client/js/controls/post_content_control.js index ca2fca8..856fb77 100644 --- a/client/js/controls/post_content_control.js +++ b/client/js/controls/post_content_control.js @@ -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(); diff --git a/client/js/views/home_view.js b/client/js/views/home_view.js index 7965e3d..c926705 100644 --- a/client/js/views/home_view.js +++ b/client/js/views/home_view.js @@ -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'),