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

Prevent Matrix/Label menu closing immediately in Safari. See issue #529. #530

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions NGCHM/WebContent/javascript/DetailHeatMapEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@
*********************************************************************************************/
DEV.matrixRightClick = function (e) {
e.preventDefault();
LNK.labelHelpClose("Matrix");
LNK.labelHelpClose("Matrix", e);
LNK.labelHelpOpen("Matrix", e);
let selection = window.getSelection();
selection.removeAllRanges();
Expand Down Expand Up @@ -1368,7 +1368,7 @@
function labelRightClick(e) {
e.preventDefault();
const axis = e.target.dataset.axis;
LNK.labelHelpClose(axis);
LNK.labelHelpClose(axis, e);
LNK.labelHelpOpen(axis, e);
let selection = window.getSelection();
selection.removeAllRanges();
Expand Down
26 changes: 16 additions & 10 deletions NGCHM/WebContent/javascript/Linkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -645,13 +645,19 @@ var linkoutsVersion = "undefined";
}
};

LNK.labelHelpCloseAll = function () {
LNK.labelHelpClose("Matrix");
LNK.labelHelpClose("Column");
LNK.labelHelpClose("Row");
LNK.labelHelpCloseAll = function (ev) {
ev = ev || {};
LNK.labelHelpClose("Matrix", ev);
LNK.labelHelpClose("Column", ev);
LNK.labelHelpClose("Row", ev);
};

LNK.labelHelpClose = function (axis) {
LNK.labelHelpClose = function (axis, ev) {
if (ev.ctrlKey || ev.metaKey) {
// Prevent extra ctrl-click event sent by Safari from closing newly opened label menus.
// See issue #539.
return;
}
var labelMenu =
axis !== "Matrix"
? document.getElementById(axis + "LabelMenu")
Expand All @@ -669,7 +675,7 @@ var linkoutsVersion = "undefined";
LNK.labelHelpOpen = function (axis, e) {
menuOpenCanvas = e.currentTarget;
const heatMap = MMGR.getHeatMap();
LNK.labelHelpCloseAll();
LNK.labelHelpCloseAll(e);
//Get the label item that the user clicked on (by axis) and save that value for use in LNK.selection
var index = e.target.dataset.index;
LNK.selection = "";
Expand Down Expand Up @@ -774,8 +780,8 @@ var linkoutsVersion = "undefined";
);
closeMenu.addEventListener(
"click",
function () {
LNK.labelHelpClose(axis);
function (ev) {
LNK.labelHelpClose(axis, ev);
},
false,
);
Expand All @@ -789,8 +795,8 @@ var linkoutsVersion = "undefined";
labelMenu.appendChild(closeMenu);
var tableBody = table.createTBody();
tableBody.classList.add("labelMenuBody");
var labelHelpCloseAxis = function () {
LNK.labelHelpClose(axis);
var labelHelpCloseAxis = function (ev) {
LNK.labelHelpClose(axis, ev);
};
document.addEventListener("click", labelHelpCloseAxis);
labelMenu.addEventListener(
Expand Down