From beeb1b0b4d1599e014b15eeba290144839ba5270 Mon Sep 17 00:00:00 2001 From: Simon Brent Date: Fri, 11 Mar 2022 13:57:50 +0000 Subject: [PATCH 1/3] Ensure that plugins are always loaded in the same order - affects consistency of button placement in control panel --- src/js/Genoverse.js | 23 +++++++++++++---------- src/js/plugins/focusRegion.js | 14 +++++++------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/js/Genoverse.js b/src/js/Genoverse.js index f57b6ddb..cf54f7b8 100644 --- a/src/js/Genoverse.js +++ b/src/js/Genoverse.js @@ -146,17 +146,20 @@ const Genoverse = Base.extend({ this.loadedPlugins[plugin.name] = true; }; - const pluginImports = Object.keys(pluginsByName).map(pluginName => import(`./plugins/${pluginName}`).then( - (imported) => { - initializePlugin({ - name : pluginName, - conf : pluginsByName[pluginName].conf, - exports : imported.default, - }); - } - )); + const pluginImports = Object.keys(pluginsByName).reduce( + (ready, pluginName) => ready.then( + () => import(`./plugins/${pluginName}`).then( + imported => initializePlugin({ + name : pluginName, + conf : pluginsByName[pluginName].conf, + exports : imported.default, + }) + ) + ), + this.jQuery.Deferred().resolve() + ); - return this.jQuery.when(...pluginImports); + return this.jQuery.when(pluginImports); }, init: function () { diff --git a/src/js/plugins/focusRegion.js b/src/js/plugins/focusRegion.js index 16af5812..b61308d2 100644 --- a/src/js/plugins/focusRegion.js +++ b/src/js/plugins/focusRegion.js @@ -1,13 +1,13 @@ -import './controlPanel'; +import controlPanel from './controlPanel'; const plugin = function () { this.controls.push({ - icon : '', - 'class' : 'gv-button-large', - name : `Reset focus to ${this.focusRegion && this.focusRegion.name ? this.focusRegion.name : `${this.chr}:${this.start}-${this.end}`}`, - action : (browser) => { browser.moveTo(browser.focusRegion.chr, browser.focusRegion.start, browser.focusRegion.end, true); }, - init : (browser) => { browser.focusRegion = browser.focusRegion || { chr: browser.chr, start: browser.start, end: browser.end }; }, + icon : '', + class : 'gv-button-large', + name : `Reset focus to ${this.focusRegion && this.focusRegion.name ? this.focusRegion.name : `${this.chr}:${this.start}-${this.end}`}`, + action : (browser) => { browser.moveTo(browser.focusRegion.chr, browser.focusRegion.start, browser.focusRegion.end, true); }, + init : (browser) => { browser.focusRegion = browser.focusRegion || { chr: browser.chr, start: browser.start, end: browser.end }; }, }); }; -export default { focusRegion: plugin }; +export default { focusRegion: plugin, requires: controlPanel }; From 6c2e7f33abe238481a00b195cb8b4c431d6f2d88 Mon Sep 17 00:00:00 2001 From: Simon Brent Date: Wed, 16 Mar 2022 13:05:28 +0000 Subject: [PATCH 2/3] Fixed an error caused by losing a race between creating a track an calling genoverse.onTracks --- src/js/Genoverse.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/Genoverse.js b/src/js/Genoverse.js index cf54f7b8..c3f1922c 100644 --- a/src/js/Genoverse.js +++ b/src/js/Genoverse.js @@ -546,7 +546,7 @@ const Genoverse = Base.extend({ onTracks: function (func, ...args) { this.tracks.forEach( (track) => { - if (track.disabled) { + if (track.disabled || !track._interface) { // if track._interface is undefined, the track has not been fully initialized yet return; } From 9c345210ad6bbec0e8b94f2933ecc520969308ab Mon Sep 17 00:00:00 2001 From: Simon Brent Date: Thu, 17 Mar 2022 08:49:06 +0000 Subject: [PATCH 3/3] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index acb85d2a..130935af 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "genoverse", - "version": "4.0.2", + "version": "4.0.3", "description": "Genoverse is a portable, customizable, back-end independent JavaScript and HTML5 based genome browser which allows the user to explore data in a dynamic and interactive manner.", "main": "src/js/Genoverse.js", "directories": {