mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
client/general: refactor control flow
- Controller lifetime is bound to route lifetime - View lifetime is bound to controller lifetime - Control lifetime is bound to view lifetime - Enhanced event dispatching - Enhanced responsiveness in some places - Views communicate user input to controllers via new event system
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const settings = require('../settings.js');
|
||||
const settings = require('../models/settings.js');
|
||||
const views = require('../util/views.js');
|
||||
const optimizedResize = require('../util/optimized_resize.js');
|
||||
|
||||
@ -21,7 +21,7 @@ class PostContentControl {
|
||||
this._currentFitFunction = this.fitWidth;
|
||||
const mul = this._post.canvasHeight / this._post.canvasWidth;
|
||||
let width = this._viewportWidth;
|
||||
if (!settings.getSettings().upscaleSmallPosts) {
|
||||
if (!settings.get().upscaleSmallPosts) {
|
||||
width = Math.min(this._post.canvasWidth, width);
|
||||
}
|
||||
this._resize(width, width * mul);
|
||||
@ -31,7 +31,7 @@ class PostContentControl {
|
||||
this._currentFitFunction = this.fitHeight;
|
||||
const mul = this._post.canvasWidth / this._post.canvasHeight;
|
||||
let height = this._viewportHeight;
|
||||
if (!settings.getSettings().upscaleSmallPosts) {
|
||||
if (!settings.get().upscaleSmallPosts) {
|
||||
height = Math.min(this._post.canvasHeight, height);
|
||||
}
|
||||
this._resize(height * mul, height);
|
||||
@ -42,13 +42,13 @@ class PostContentControl {
|
||||
let mul = this._post.canvasHeight / this._post.canvasWidth;
|
||||
if (this._viewportWidth * mul < this._viewportHeight) {
|
||||
let width = this._viewportWidth;
|
||||
if (!settings.getSettings().upscaleSmallPosts) {
|
||||
if (!settings.get().upscaleSmallPosts) {
|
||||
width = Math.min(this._post.canvasWidth, width);
|
||||
}
|
||||
this._resize(width, width * mul);
|
||||
} else {
|
||||
let height = this._viewportHeight;
|
||||
if (!settings.getSettings().upscaleSmallPosts) {
|
||||
if (!settings.get().upscaleSmallPosts) {
|
||||
height = Math.min(this._post.canvasHeight, height);
|
||||
}
|
||||
this._resize(height / mul, height);
|
||||
@ -83,7 +83,7 @@ class PostContentControl {
|
||||
const postContentNode = this._template({
|
||||
post: this._post,
|
||||
});
|
||||
if (settings.getSettings().transparencyGrid) {
|
||||
if (settings.get().transparencyGrid) {
|
||||
postContentNode.classList.add('transparency-grid');
|
||||
}
|
||||
this._containerNode.appendChild(postContentNode);
|
||||
|
Reference in New Issue
Block a user