From 1531407c449672567291e5b1e14fd10197daf33d Mon Sep 17 00:00:00 2001 From: turner Date: Thu, 16 Nov 2023 16:30:30 -0500 Subject: [PATCH] Save Image dropdown implementation --- js/ui/saveImageControl.js | 11 ++++++++--- package.json | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/js/ui/saveImageControl.js b/js/ui/saveImageControl.js index a7f8ab082..4a5b46e5a 100644 --- a/js/ui/saveImageControl.js +++ b/js/ui/saveImageControl.js @@ -49,7 +49,7 @@ class SaveImageControl extends NavbarButton { this.setState(false) }) - this.dropdown = new Dropdown(this.button.parentNode, { top:20, left:64 }) + this.dropdown = new Dropdown(this.button.parentNode, { top:24, left:-33 }) const items = [ @@ -73,15 +73,20 @@ class SaveImageControl extends NavbarButton { this.button.addEventListener('click', e => { + let takeAction if (e.target === this.button) { - this.dropdown.present(e) + takeAction = true } else if (e.target.closest('svg')) { const parentDiv = e.target.closest('div') if (parentDiv === this.button) { - this.dropdown.present(e) + takeAction = true } } + if (true === takeAction) { + 'none' === this.dropdown.popover.style.display ? this.dropdown.present(e) : this.dropdown.dismiss() + } + }) this.setVisibility(browser.config.showSVGButton) diff --git a/package.json b/package.json index a58285252..9fbc996c7 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "circular-view": "github:igvteam/circular-view#v0.2.4", "eslint": "^6.4.0", "hdf5-indexed-reader": "github:jrobinso/hdf5-indexed-reader#v0.5.5", - "igv-ui": "github:igvteam/igv-ui#v1.5.3", + "igv-ui": "github:igvteam/igv-ui#dat_dropdown", "igv-utils": "github:igvteam/igv-utils#v1.4.8", "mocha": "^10.2.0", "rollup": "^2.66.0",