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

Fix clicking behaviour #72

Merged
merged 3 commits into from
Jan 29, 2025
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
44 changes: 27 additions & 17 deletions graph.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// vim set sw=4:
var elements = [];
var cy;
var cy_layout;
Expand Down Expand Up @@ -174,24 +175,34 @@ function highlightEdge(edge) {
}

function highlightElement(event) {
if (event.target.group() === "nodes") {
const node = event.target;
if (event.type === "tap") {
highlightNode(node);
if (event.target === cy) {
// Only unhilight node if double tapped on background
// Single tap is too error prone
if (event.type === "dbltap") {
unhighlightNode(null);
}
else if (event.type === "dbltap") {
showNodeDetails(node);
else {
console.log("No-op: single tap on background");
}
} else if (event.target.group() === "edges") {
const edge = event.target;
if (event.type === "tap") {
// do nothing special
}
else if (event.type === "dbltap") {
highlightEdge(edge);
}
else {
if (event.target.group() === "nodes") {
const node = event.target;
if (event.type === "dbltap") {
highlightNode(node);
}
else if (event.type === "select") {
showNodeDetails(node);
}
} else if (event.target.group() === "edges") {
const edge = event.target;
if (event.type === "select") {
// do nothing special
}
else if (event.type === "dbltap") {
highlightEdge(edge);
}
}
} else if (event.target === cy) {
unhighlightNode();
}
}

Expand Down Expand Up @@ -300,8 +311,7 @@ function create_cy_elements(data, style) {
// store the meta_node, since we need to remove it when highlighting nodes
meta_node = cy.$("#simulators");
meta_node_edges = meta_node.connectedEdges();
cy.on("select tap dbltap", "*", highlightElement);
cy.on("unselect", "*", unhighlightNode);
cy.on("select tap dbltap", highlightElement);
cy.$("#simulators").select();
selectionChanged();
}
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// vim set sw=4:
const REPO_URL = "https://github.com/ocns/simselect";
const GIT_BRANCH = "graph";
const DATA_FOLDER = "simtools";
Expand Down
1 change: 1 addition & 0 deletions table.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// vim set sw=4:
var criteria = []; // selected criteria

const bio_levels = ["Population Model", "Single-Compartment (Simple) Model",
Expand Down