Skip to content

Commit

Permalink
fix some menu redundancy and confusion around "alt color"
Browse files Browse the repository at this point in the history
  • Loading branch information
jrobinso committed Sep 11, 2022
1 parent 40f4199 commit 4e6cdc5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
24 changes: 11 additions & 13 deletions js/feature/interactionTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,16 @@ class InteractionTrack extends TrackBase {
// Reset transient property drawState. An undefined value => feature has not been drawn.
feature.drawState = undefined

let color = this.color || feature.color || DEFAULT_ARC_COLOR
if (color && this.config.useScore) {
color = getAlphaColor(color, scoreShade(feature.score))
let color
if(typeof this.color === 'function') {
color = this.color(feature)
} else {
color = this.color || feature.color || DEFAULT_ARC_COLOR
if (color && this.config.useScore) {
color = getAlphaColor(color, scoreShade(feature.score))
}
}

ctx.lineWidth = feature.thickness || this.thickness || 1

if (feature.chr1 === feature.chr2 || feature.chr === 'all') {
Expand Down Expand Up @@ -457,18 +463,10 @@ class InteractionTrack extends TrackBase {

menuItemList() {

let items = [

{
name: "Set track color",
click: () => {
this.trackView.presentColorPicker()
}
},
'<hr/>'
]
let items = []

if (this.hasValue) {
items.push("<hr/>")
const lut =
{
"nested": "Nested",
Expand Down
2 changes: 2 additions & 0 deletions js/feature/wigTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ class WigTrack extends TrackBase {

menuItemList() {
let items = []

if (this.flipAxis !== undefined) {
items.push('<hr>')
items.push({
label: "Flip y-axis",
click: () => {
Expand Down
4 changes: 3 additions & 1 deletion js/ui/menuUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ const MenuUtils = {
menuItems.push('<hr/>')
menuItems.push(colorPickerMenuItem({trackView, label: "Set track color", option: "color"}))
menuItems.push(unsetColorMenuItem({trackView, label: "Unset track color"}))
menuItems.push(colorPickerMenuItem({trackView, label: "Set alt color", option: "altColor"}))
if(trackView.track.config.type === 'wig' || trackView.track.config.type === 'annotation') {
menuItems.push(colorPickerMenuItem({trackView, label: "Set alt color", option: "altColor"}))
}
}

if (trackView.track.menuItemList) {
Expand Down

0 comments on commit 4e6cdc5

Please sign in to comment.