aboutsummaryrefslogtreecommitdiff
path: root/src/map.js
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2020-03-26 17:20:31 +0100
committervincent-peugnet <v.peugnet@free.fr>2020-03-26 17:20:31 +0100
commit01795f56b61ab4e6becd959b7a41aad1276cdfca (patch)
tree0be85f2a811cc0fb7b44985ca3bc09015f706ebd /src/map.js
parentadb3d38893acb75b838fc6ccce5edb4321d08bf9 (diff)
parentd17713051ca2fef29de8025fe876d417838cea7f (diff)
downloadwcms-01795f56b61ab4e6becd959b7a41aad1276cdfca.tar.gz
wcms-01795f56b61ab4e6becd959b7a41aad1276cdfca.zip
Merge branch 'implement-cytoscape.js'
Diffstat (limited to 'src/map.js')
-rw-r--r--src/map.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/map.js b/src/map.js
new file mode 100644
index 0000000..4723318
--- /dev/null
+++ b/src/map.js
@@ -0,0 +1,32 @@
+import cytoscape from 'cytoscape';
+import coseBilkent from 'cytoscape-cose-bilkent';
+
+cytoscape.use(coseBilkent);
+
+let options = {
+ container: document.getElementById('graph'),
+};
+
+Object.assign(options, data);
+
+let cy = cytoscape(options);
+
+cy.on('tap', 'node', function() {
+ try {
+ // your browser may block popups
+ window.open(this.data('id'));
+ } catch (e) {
+ // fall back on url change
+ window.location.href = this.data('id');
+ }
+});
+
+cy.on('cxttap', 'node', function() {
+ try {
+ // your browser may block popups
+ window.open(this.data('edit'));
+ } catch (e) {
+ // fall back on url change
+ window.location.href = this.data('edit');
+ }
+});