Skip to content

Commit

Permalink
Alpha adjustment is now supported for MergeTrack
Browse files Browse the repository at this point in the history
  • Loading branch information
turner committed Oct 17, 2023
1 parent 97e6c34 commit 6fd8c79
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
12 changes: 10 additions & 2 deletions js/feature/mergedTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -49,7 +51,6 @@ class MergedTrack extends TrackBase {
super.init(config)
}


async postInit() {

this.tracks = []
Expand All @@ -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
Expand All @@ -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
}
Expand Down
22 changes: 17 additions & 5 deletions js/ui/menuUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 6fd8c79

Please sign in to comment.