Skip to content

Commit

Permalink
Delay opening context menu to support windows again (#5756)
Browse files Browse the repository at this point in the history
* delay opening context menu
* add changelog entry
* change delay to 0 milliseconds
* Merge branch 'master' into fix-context-menu-windows
  • Loading branch information
MichaelBuessemeyer authored Oct 6, 2021
1 parent edd5e3b commit 2f751a7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
-

### Fixed
-
- Fixed a bug that windows user could not open the context menu as it instantly closed after opening. [#5756](https://github.com/scalableminds/webknossos/pull/5756).

### Removed
-
Expand Down
20 changes: 14 additions & 6 deletions frontend/javascripts/oxalis/view/layouting/tracing_layout_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,20 @@ class TracingLayoutView extends React.PureComponent<PropsWithRouter, State> {
globalPosition: Vector3,
viewport: OrthoView,
) => {
this.setState({
contextMenuPosition: [xPos, yPos],
clickedNodeId: nodeId,
contextMenuGlobalPosition: globalPosition,
contextMenuViewport: viewport,
});
// On Windows the right click to open the context menu is also triggered for the overlay
// of the context menu. This causes the context menu to instantly close after opening.
// Therefore delay the state update to delay that the context menu is rendered.
// Thus the context overlay does not get the right click as an event and therefore does not close.
setTimeout(
() =>
this.setState({
contextMenuPosition: [xPos, yPos],
clickedNodeId: nodeId,
contextMenuGlobalPosition: globalPosition,
contextMenuViewport: viewport,
}),
0,
);
};

hideContextMenu = () => {
Expand Down

0 comments on commit 2f751a7

Please sign in to comment.