From c64fe8389bc75516472d41bc936a6a373bc8a355 Mon Sep 17 00:00:00 2001 From: _Lighty_ Date: Sun, 26 Jul 2020 11:05:19 +0200 Subject: [PATCH] BIV v1.3.8 fix zoom snapping --- .../BetterImageViewer/BetterImageViewer.plugin.js | 12 +++--------- Plugins/BetterImageViewer/CHANGELOG.md | 3 +++ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Plugins/BetterImageViewer/BetterImageViewer.plugin.js b/Plugins/BetterImageViewer/BetterImageViewer.plugin.js index abd7b14..93efa71 100644 --- a/Plugins/BetterImageViewer/BetterImageViewer.plugin.js +++ b/Plugins/BetterImageViewer/BetterImageViewer.plugin.js @@ -37,7 +37,7 @@ module.exports = (() => { twitter_username: '' } ], - version: '1.3.7', + version: '1.3.8', description: 'Move between images in the entire channel with arrow keys, image zoom enabled by clicking and holding, scroll wheel to zoom in and out, hold shift to change lens size. Image previews will look sharper no matter what scaling you have, and will take up as much space as possible.', github: 'https://github.com/1Lighty', github_raw: 'https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/BetterImageViewer/BetterImageViewer.plugin.js' @@ -46,12 +46,7 @@ module.exports = (() => { { title: 'fixed', type: 'fixed', - items: ['Fixed text being hard to read in light mode.', 'Fixed plugin causing client crash.', 'Fixed plugin *not* expecting a crash.', 'Fixed an anomaly bug if you clicked on a non hit image in search results, and now instead goes thru all images in search results.', 'Fixed using incorrect modals.', 'Fixed load warning because of Zeres nonsensical changes of trying to force to use module.exports'] - }, - { - title: 'changed', - type: 'added', - items: ['Using ImageGallery alongside BetterImageViewer is no longer supported, due to the author likely intentionally causing bugs, and that the plugin is fully superseded in terms of features anyways. If you continue to use ImageGallery, any bugs that occur because of it are not my problem.'] + items: ['Fixed zoom snapping sometimes. (Thx Murmurs for reporting this)'] } ], defaultConfig: [ @@ -313,8 +308,6 @@ module.exports = (() => { window.addEventListener('mousemove', this.handleMouseMove); window.addEventListener('mousewheel', this.handleMouseWheel); this.getRawImage(); - if (!this._ref) return Logger.warn('this._ref is null!'); - this._bcr = this._ref.getBoundingClientRect(); } componentWillUnmount() { if (super.componentWillUnmount) super.componentWillUnmount(); @@ -369,6 +362,7 @@ module.exports = (() => { this.setState({ zooming: false }); } handleMouseMove(cx, cy, start) { + if (!this._bcr) this._bcr = this._ref.getBoundingClientRect(); if (!this.props.__BIV_settings.outOfBounds) { cx = Math.min(this._bcr.left + this._bcr.width, Math.max(this._bcr.left, cx)); cy = Math.min(this._bcr.top + this._bcr.height, Math.max(this._bcr.top, cy)); diff --git a/Plugins/BetterImageViewer/CHANGELOG.md b/Plugins/BetterImageViewer/CHANGELOG.md index f3fbc2d..c22b8ca 100644 --- a/Plugins/BetterImageViewer/CHANGELOG.md +++ b/Plugins/BetterImageViewer/CHANGELOG.md @@ -1,4 +1,7 @@ # [BetterImageViewer](https://1lighty.github.io/BetterDiscordStuff/?plugin=BetterImageViewer "BetterImageViewer") Changelog +### 1.3.8 +- Fixed zoom snapping sometimes. (Thx Murmurs for reporting this) + ### 1.3.5, 1.3.6 && 1.3.7 - Fixed text being hard to read in light mode. - Fixed plugin causing client crash.