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

Clicking on label closes and then reopens context menu #1261

Closed
misaugstad opened this issue Jun 19, 2018 · 1 comment · Fixed by #3295
Closed

Clicking on label closes and then reopens context menu #1261

misaugstad opened this issue Jun 19, 2018 · 1 comment · Fixed by #3295

Comments

@misaugstad
Copy link
Member

misaugstad commented Jun 19, 2018

Related to #849.

If a label's context menu is open and you click on the label to close it, the mouse-down closes the context menu, but the mouse-up reopens the menu. So if you click and hold on the label, then drag the SV image until your mouse is off the label, it remains closed.

It should clearly stay closed and not reopen :)

I don't remember the specifics, but I think @r-holland had said that it would be unnecessarily complicated to fix this because of how we trigger actions and the separation of the label's context menu code from the rest of the code (or something like that, memory is very hazy from something that was about a year ago).

@misaugstad
Copy link
Member Author

Looked into the code a bit. In MapService.js, the handlerViewControlLayerMouseUp(e) function causes the context menu to open. The logic looks like this:

if (contextMenuWasOpen) {
    svl.contextMenu.hide();
} else {
    svl.contextMenu.show(selectedLabel);
}

And in ContextMenu.js, there is a _handleMouseDown(e) function that is called on a mouse up that is not on the context menu.

ContextMenu.js's mouse down is called, which closes the context menu, and then MapService.js's mouse up is called, reopening the context menu.

Solutions are to either

  1. Have ContextMenu.js leave the menu open on mouse down if the cursor is on the label as well, or
  2. Have MapService.js leave the menu closed if the last mouse down closed the menu.

I think that we should just do whichever is easiest. My assumption is that option 1 is easier, but not 100% sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants