Skip to content

Commit

Permalink
Add live update of OverlayTrack transparency.
Browse files Browse the repository at this point in the history
  • Loading branch information
turner committed Oct 18, 2023
1 parent 1627883 commit cef7486
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
6 changes: 3 additions & 3 deletions dev/multi-select/multi-select.html
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,15 @@ <h1>Multiple Track Selection</h1>

};

const MergedTracksConfig =
const overyTrackConfig =
{
genome: "hg19",
locus: "chr1:155,138,124-155,153,715",
tracks:
[
{
name: "Merged - configuration",
height: 50,
height: 256,
type: "merged",
tracks: [
{
Expand Down Expand Up @@ -291,7 +291,7 @@ <h1>Multiple Track Selection</h1>
]
}

igv.createBrowser(document.getElementById("igvDiv"), BigWigConfig)
igv.createBrowser(document.getElementById("igvDiv"), overyTrackConfig)
.then(function (browser) {
console.log("Created IGV browser");
})
Expand Down
6 changes: 4 additions & 2 deletions js/browser.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import $ from "./vendor/jquery-3.3.1.slim.js"
import html2canvas from '../node_modules/html2canvas/dist/html2canvas.esm.js'
import {InputDialog, GenericColorPicker} from '../node_modules/igv-ui/dist/igv-ui.js'
import {BGZip, FileUtils, igvxhr, StringUtils, URIUtils} from "../node_modules/igv-utils/src/index.js"
import {DOMUtils, Icon} from "../node_modules/igv-ui/dist/igv-ui.js"
import {DOMUtils, Icon, SliderDialog, InputDialog, GenericColorPicker} from "../node_modules/igv-ui/dist/igv-ui.js"
import Alert from './ui/alert.js'
import * as TrackUtils from './util/trackUtils.js'
import TrackView, {igv_axis_column_width} from "./trackView.js"
Expand Down Expand Up @@ -306,6 +305,9 @@ class Browser {
this.$navigation.hide()
}

this.sliderDialog = new SliderDialog(this.root)
this.sliderDialog.container.id = `igv-slider-dialog-${DOMUtils.guid()}`

this.inputDialog = new InputDialog(this.root)
this.inputDialog.container.id = `igv-input-dialog-${DOMUtils.guid()}`

Expand Down
9 changes: 6 additions & 3 deletions js/ui/menuUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,19 +137,22 @@ function overlayTrackAlphaAdjustmentMenuItem() {
container.innerText = 'Set transparency'

function dialogPresentationHandler (e) {
const callback = value => {
this.alpha = parseFloat(value)
const callback = alpha => {
this.alpha = Math.max(0.001, alpha)
this.updateViews()
}

const config =
{
label: 'Transparency',
value: this.alpha,
min: 0.0,
max: 1.0,
scaleFactor: 1000,
callback
}

this.browser.inputDialog.present(config, e)
this.browser.sliderDialog.present(config, e)
}

return { object: $(container), dialog:dialogPresentationHandler }
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.2",
"igv-ui": "github:igvteam/igv-ui#v1.5.2",
"igv-ui": "github:igvteam/igv-ui#dat_slider_dialog",
"igv-utils": "github:igvteam/igv-utils#v1.4.8",
"mocha": "^10.2.0",
"rollup": "^2.66.0",
Expand Down

0 comments on commit cef7486

Please sign in to comment.