Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ROI Set name to the ROI menu #1875

Merged
merged 4 commits into from
Aug 16, 2024
Merged

Conversation

milandomazet
Copy link
Contributor

Hello, this is a small PR related to the ROI Set name being displayed in the ROI menu. It seemed like it might be valuable displaying it since it is already in the table and it can be defined by the user when providing ROIs through config.

Just ROI Set defined
Screenshot 2024-08-14 at 13 56 59

Both ROI Set and Description/Name defined
Screenshot 2024-08-14 at 13 59 10

Only Description/Name defined
Screenshot 2024-08-14 at 14 02 11

@turner turner self-requested a review August 14, 2024 13:23
@turner turner self-assigned this Aug 14, 2024
@jrobinso
Copy link
Contributor

@milandomazet @turner Thanks for the PR. I agree with the intent but I don't think we need to add the 'roiSet' to every feature feature object in the set. Could we try just passing the roiSet itself as a parameter to the ROIMenu.present function?

            this.roiMenu.present(feature, isUserDefined, event, this, columnContainer, regionElement)

The paremeter "isUserDefined" is itself just a property of ROISet, so it can be replaced as we are now using 2 properties

this.roiMenu.present(feature, roiSet, event, this, columnContainer, regionElement)

This can in turn get passed on to menuItems in ROIMenu and used to get the roiSet name (and "isUserDefined")

    menuItems(feature, roiSet, event, roiManager, columnContainer, regionElement) {

@turner turner removed their assignment Aug 14, 2024
@turner turner removed their request for review August 14, 2024 14:21
@milandomazet
Copy link
Contributor Author

Thanks a lot on your feedback @jrobinso it makes a lot of sense to do it that way. I just added another commit with that approach.

@turner
Copy link
Contributor

turner commented Aug 14, 2024

@milandomazet can you test with long strings? We might need to tweak the css.

@milandomazet
Copy link
Contributor Author

@turner long strings don't get wrapped I've noticed that. Maybe I could add a div and styles to it?

@turner
Copy link
Contributor

turner commented Aug 14, 2024

@turner long strings don't get wrapped I've noticed that. Maybe I could add a div and styles to it?

Take a look at _roi.scss where I define all ROI related styling. All you should need to do is add text-overflow: ellipsis; for child divs of the parent to the divs you are adding.

@milandomazet
Copy link
Contributor Author

@turner the problem is that the styling in ROIMenu is not used at all as the menuPopup class is being called to display the popup this.browser.menuPopup.presentTrackContextMenu(event, menuItems) we would have to change that class, enable passing of the container somehow or duplicate its functions in ROIMenu to change this specific popup.

On the other hand we could change the menuPopup styling and that is what I've done in the last commit. Currently the text is wrapped (to be honest it looks better to me this way) but we can do ellipsis as well, both screenshots are attached.

If we decide to go this route maybe we should delete container part code of the ROIMenu as well.

Screenshot 2024-08-15 at 11 37 35
Screenshot 2024-08-15 at 11 38 34

@jrobinso jrobinso requested a review from turner August 15, 2024 23:40
Copy link
Contributor

@turner turner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you in addition add the ellipsis? Thx.

@turner
Copy link
Contributor

turner commented Aug 16, 2024

Can you in addition add the ellipsis? Thx.

Actually, we can forget the ellipsis. I thinkt this is fine.

@milandomazet
Copy link
Contributor Author

Thanks @turner! Should I remove the component creation part of the ROIMenu as it is not used at the moment from this class or should I leave it for any future work on it? The code in question is in the constructor:

    // container
    this.container = DOMUtils.div({class: 'igv-roi-menu'})
    parent.appendChild(this.container)

    // header
    const header = DOMUtils.div()
    this.container.appendChild(header)

    UIUtils.attachDialogCloseHandlerWithParent(header, () => this.container.style.display = 'none')

    // body
    this.body = DOMUtils.div()
    this.container.appendChild(this.body)

    this.container.style.display = 'none'

@turner
Copy link
Contributor

turner commented Aug 16, 2024

Thanks @turner! Should I remove the component creation part of the ROIMenu as it is not used at the moment from this class or should I leave it for any future work on it? The code in question is in the constructor:

    // container
    this.container = DOMUtils.div({class: 'igv-roi-menu'})
    parent.appendChild(this.container)

    // header
    const header = DOMUtils.div()
    this.container.appendChild(header)

    UIUtils.attachDialogCloseHandlerWithParent(header, () => this.container.style.display = 'none')

    // body
    this.body = DOMUtils.div()
    this.container.appendChild(this.body)

    this.container.style.display = 'none'

Leave this as is for now. That is part of a refactor we will get to at some point in the future.

@turner turner merged commit b3460f0 into igvteam:master Aug 16, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants