Skip to content

Commit afe0b10

Browse files
Add showHidden parameter to resetStyle: resolve #464. Also fix a broken no-use-before-define lint.
1 parent a6b2fd6 commit afe0b10

3 files changed

Lines changed: 12 additions & 10 deletions

File tree

js/browser/graph.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,14 @@ export class Graph {
8888
}
8989

9090
/** Removes all highlighting (except selection) and shows all hidden nodes. */
91-
resetStyle(): void {
91+
resetStyle(showHidden?: boolean): void {
9292
this.starMode = false;
9393
this.cy.startBatch();
9494
this.cy.elements().removeClass("highlighted");
9595
this.cy.elements().removeClass("starmode");
96-
//this.cy.elements().removeClass("hidden"); // temporarily comment this out as a workaround for https://github.com/snikproject/graph/issues/464
96+
if (showHidden) {
97+
this.cy.elements().removeClass("hidden");
98+
}
9799
// keep "rdf:type"-edges hidden
98100
Graph.setVisible(this.cy.edges("[p='http://www.w3.org/1999/02/22-rdf-syntax-ns#type']"), false);
99101
/*

js/browser/menu.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ export class Menu {
294294
only: "snik",
295295
},
296296
{ action: subOntologyConnectivity, i18n: "subontology-connectivity", only: "snik" },
297-
{ action: View.mainView.state.graph.resetStyle, i18n: "reset-view", hotkey: "ctrl+alt+r" },
297+
{ action: () => View.mainView.state.graph.resetStyle(true), i18n: "reset-view", hotkey: "ctrl+alt+r" },
298298
{
299299
action: () => {
300300
View.activeView().setTitle(prompt("Rename: " + View.activeView().config.title) || View.activeView().config.title);

js/browser/util.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ export function deleteTriple(edge: EdgeSingular) {
102102
);
103103
}
104104

105+
/** Creates a human readable string of the triple that an link represents.
106+
* @param edge - the edge, whose label is determined
107+
* @returns a human readable string of the triple that an edge represents. */
108+
export function edgeLabel(edge: EdgeSingular): string {
109+
return rdf.short(edge.data(EDGE.SOURCE)) + " " + rdf.short(edge.data(EDGE.PROPERTY)) + " " + rdf.short(edge.data(EDGE.TARGET));
110+
}
111+
105112
/**
106113
* Prompts creation of an issue on GitHub to confirm the given LIMES link.
107114
* @param link The edge of the link which is to be confirmed
@@ -139,13 +146,6 @@ export function createGitHubBugReportIssue() {
139146
createGitHubTemplateIssue(config.git.repo.application, "", "bugreport", config.git.issueLabels.bug, Object.entries({ version, logs }));
140147
}
141148

142-
/** Creates a human readable string of the triple that an link represents.
143-
* @param edge - the edge, whose label is determined
144-
* @returns a human readable string of the triple that an edge represents. */
145-
export function edgeLabel(edge: EdgeSingular): string {
146-
return rdf.short(edge.data(EDGE.SOURCE)) + " " + rdf.short(edge.data(EDGE.PROPERTY)) + " " + rdf.short(edge.data(EDGE.TARGET));
147-
}
148-
149149
export const checkboxKeydownListener = (box) => (e) => {
150150
switch (e.key) {
151151
case " ":

0 commit comments

Comments
 (0)