Commit 40e26480 authored by unknown's avatar unknown

cytocanvas context menu now disappears when the mouse clicks somewhere else

parent 770619ee
import { Graph2d } from "./2d-graphosaurus/graph";
import IdSet from "../misc/customTypes/IdSet";
export class Graph2D {
......@@ -85,7 +84,6 @@ export class Graph2D {
this.filterByDate([document.getElementById('filter-date-start'), document.getElementById('filter-date-end')].map(this.toIso));
this.applyFilterToGraph();
this.cy.on('tapstart', (e) => { this.hideContextMenu(e); this.hideGraphMenu(e); });
this.cy.on('cxttap', this.displayGraphMenu);
this.cy.on('cxttap', 'node', this.displayContextMenu);
......@@ -176,6 +174,7 @@ export class Graph2D {
this.hideContextMenu();
this.graph2d.getRelated([id], nodeType, relationType)(this.displayNewElements);
this.graph2d.mutate().then(() => {
this.filterByDate([document.getElementById('filter-date-start'), document.getElementById('filter-date-end')].map(this.toIso));
this.applyFilterToGraph();
});
}
......@@ -216,7 +215,7 @@ export class Graph2D {
}
displayContextMenu = (e) => {
this.hideGraphMenu();
$("#cytoRightClickOverlay").show();
let d = document.getElementById("contextMenu");
d.style.position = "absolute";
......@@ -243,11 +242,13 @@ export class Graph2D {
hideGraphMenu = () => {
let d = document.getElementById("graph2DMenu");
d.style.display = 'none';
$("#cytoRightClickOverlay").hide();
}
displayGraphMenu = (e) => {
if (this.showClearMenu) {
this.hideContextMenu();
$("#cytoRightClickOverlay").show();
let d = document.getElementById("graph2DMenu");
d.style.position = "absolute";
......@@ -261,6 +262,8 @@ export class Graph2D {
hideContextMenu = () => {
let d = document.getElementById("contextMenu");
d.style.display = 'none';
$("#cytoRightClickOverlay").hide();
}
addNodeIds = (nodeIds) => {
......
......@@ -370,14 +370,14 @@ intergraph .tooltip-arrow {
border: 1px solid black;
background-color: white;
display: none;
z-index: 2;
z-index: 3;
}
#graph2DMenu {
border: 1px solid black;
background-color: white;
display: none;
z-index: 2;
z-index: 3;
}
#nodeId {
......@@ -408,4 +408,14 @@ intergraph .tooltip-arrow {
justify-content: center;
z-index: 3;
background-color: rgba(127, 127, 127, 0.5);
}
#cytoRightClickOverlay {
display: none;
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
z-index: 2;
}
\ No newline at end of file
......@@ -241,6 +241,12 @@ function start(settings, login, password) {
$('#graphselector #cytocanvas').trigger("click"); // To set cytocanvas as default canvas
$('#cytoRightClickOverlay').click(() => {
$('#contextMenu').hide();
$('#graph2DMenu').hide();
$('#cytoRightClickOverlay').hide();
});
$( "#queryButton" ).click(query);
$( "#keyword" ).keypress(function(e) {
if(e.which == 13) {
......
......@@ -152,6 +152,7 @@
</div>
</div>
</div>
<div id="cytoRightClickOverlay" oncontextmenu="return false"></div>
<div class="hidden" style="display: none;">
<span id="info" style="display: none"></span>
<span id="type" style="display: none"></span>
......
module.exports = { version: '184' }
module.exports = { version: '185' }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment