diff --git a/js/feature/mergedTrack.js b/js/feature/mergedTrack.js index ca4f180d8..0402611b1 100644 --- a/js/feature/mergedTrack.js +++ b/js/feature/mergedTrack.js @@ -40,6 +40,8 @@ class MergedTrack extends TrackBase { this.featureType = 'numeric' this.paintAxis = paintAxis this.graphType = config.graphType + + this._alpha = this.config.alpha || 0.5 } init(config) { @@ -49,7 +51,6 @@ class MergedTrack extends TrackBase { super.init(config) } - async postInit() { this.tracks = [] @@ -69,7 +70,6 @@ class MergedTrack extends TrackBase { } } - this.alpha = this.config.alpha || 0.5 this.flipAxis = this.config.flipAxis ? this.config.flipAxis : false this.logScale = this.config.logScale ? this.config.logScale : false this.autoscale = this.config.autoscale || this.config.max === undefined @@ -91,6 +91,14 @@ class MergedTrack extends TrackBase { return Promise.all(p) } + set alpha(alpha) { + this._alpha = alpha + } + + get alpha() { + return this._alpha + } + get height() { return this._height } diff --git a/js/ui/menuUtils.js b/js/ui/menuUtils.js index a0aa5b302..521f09dcc 100644 --- a/js/ui/menuUtils.js +++ b/js/ui/menuUtils.js @@ -132,17 +132,29 @@ function isVisibilityWindowType(track) { return hasVizWindow || vizWindowTypes.has(track.type) } - function overlayTrackAlphaAdjustmentMenuItem() { const container = DOMUtils.div() container.innerText = 'Adjust Alpha' - - function click(e) { - console.log(`The Overlay track has ${ this.config.tracks.length } layers`) + + function dialogPresentationHandler (e) { + + const callback = value => { + this.alpha = parseFloat(value) + this.updateViews() + } + + const config = + { + label: 'Adjust Alpha', + value: 0.5, + callback + } + + this.browser.inputDialog.present(config, e) } - return { object: $(container), click } + return { object: $(container), dialog:dialogPresentationHandler } } function trackSeparationMenuItem() {