From b7a6285ecf53ad0517719ab01fe1aa3e2c331501 Mon Sep 17 00:00:00 2001 From: Douglass Turner Date: Mon, 18 Oct 2021 18:18:01 -0400 Subject: [PATCH] Git Issue 1400 (#1404) --- js/browser.js | 10 ++++++++++ js/ui/zoomWidget.js | 6 ++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/js/browser.js b/js/browser.js index d22ec490f..d11d0d13d 100755 --- a/js/browser.js +++ b/js/browser.js @@ -1198,6 +1198,16 @@ class Browser { return this.config.minimumBases; } + // Zoom in by a factor of 2, keeping the same center location + zoomIn() { + this.zoomWithScaleFactor(0.5) + }; + + // Zoom out by a factor of 2, keeping the same center location if possible + zoomOut() { + this.zoomWithScaleFactor(2.0) + }; + async zoomWithScaleFactor(scaleFactor, centerBPOrUndefined, referenceFrameOrUndefined) { const viewportWidth = this.calculateViewportWidth(this.referenceFrameList.length) diff --git a/js/ui/zoomWidget.js b/js/ui/zoomWidget.js index 639c3febe..760dabb6f 100644 --- a/js/ui/zoomWidget.js +++ b/js/ui/zoomWidget.js @@ -43,7 +43,8 @@ const ZoomWidget = function (browser, parent) { this.zoomContainer.appendChild(this.zoomOutButton) this.zoomOutButton.appendChild(Icon.createIcon('minus-circle')) this.zoomOutButton.addEventListener('click', () => { - browser.zoomWithScaleFactor(2.0) + // browser.zoomWithScaleFactor(2.0) + browser.zoomOut() }) // Range slider @@ -85,7 +86,8 @@ const ZoomWidget = function (browser, parent) { this.zoomContainer.appendChild(this.zoomInButton) this.zoomInButton.appendChild(Icon.createIcon('plus-circle')) this.zoomInButton.addEventListener('click', () => { - browser.zoomWithScaleFactor(0.5) + // browser.zoomWithScaleFactor(0.5) + browser.zoomIn() }) browser.on('locuschange', (referenceFrameList) => {