@@ -93,6 +93,11 @@ require(['jquery', 'bootstrap.modal', 'svg-pan-zoom', 'hammerjs', 'jquery.svg'],
93
93
instance . zoom ( initialScale * ev . scale )
94
94
} ) ;
95
95
96
+ // Handle double click
97
+ this . hammer . on ( 'doubletap' , function ( e ) {
98
+ goToSubworkflow ( e . target . closest ( ".node" ) ) ;
99
+ } ) ;
100
+
96
101
// Prevent moving the page on some devices when panning over SVG
97
102
options . svgElement . addEventListener ( 'touchmove' , function ( e ) {
98
103
e . preventDefault ( ) ;
@@ -165,86 +170,7 @@ require(['jquery', 'bootstrap.modal', 'svg-pan-zoom', 'hammerjs', 'jquery.svg'],
165
170
} , 100 ) ;
166
171
} ) ;
167
172
}
168
- } ) ;
169
-
170
- /**
171
- * Handle the dot graph modal and related features
172
- */
173
- require ( [ 'jquery' , 'bootstrap.modal' ] ,
174
- function ( $ , modal ) {
175
- /**
176
- * DOT graph modal textarea automatically focuses when opened
177
- */
178
- $ ( '#dotGraph' ) . on ( 'shown.bs.modal' , function ( ) {
179
- $ ( '#dot' ) . focus ( ) ;
180
- } ) ;
181
-
182
- /**
183
- * DOT graph textarea focus selects all
184
- */
185
- $ ( "#dot" ) . focus ( function ( ) {
186
- $ ( this ) . select ( ) ;
187
- } ) ;
188
-
189
- /**
190
- * Downloading of the DOT graph as a .gv file
191
- */
192
- $ ( '#download-dot' ) . click ( function ( event ) {
193
- // Generate download link src
194
- var dotGraph = $ ( "#dot" ) . val ( ) ;
195
- var src = "data:text/vnd.graphviz;charset=utf-8," + encodeURIComponent ( dotGraph ) ;
196
-
197
- // Set hidden download link href to contents and click it
198
- var downloadLink = $ ( "#download-link-dot" ) ;
199
- downloadLink . attr ( "href" , src ) ;
200
- downloadLink [ 0 ] . click ( ) ;
201
-
202
- // Stop default button action
203
- event . preventDefault ( ) ;
204
- } ) ;
205
- } ) ;
206
-
207
- /**
208
- * Code for including the link to the Research Object Bundle download
209
- * without refresh once generated
210
- */
211
- require ( [ 'jquery' ] ,
212
- function ( $ ) {
213
- /**
214
- * AJAX function to add download link to page if generated
215
- */
216
- function getDownloadLink ( ) {
217
- $ . ajax ( {
218
- type : 'HEAD' ,
219
- url : $ ( '#download' ) . attr ( 'href' ) ,
220
- dataType : "json" ,
221
- success : function ( ) {
222
- // Hide generating, show link
223
- $ ( "#generating" ) . addClass ( "hide" ) ;
224
- $ ( "#generated" ) . removeClass ( "hide" ) ;
225
- } ,
226
- error : function ( ) {
227
- // Show generating, hide link
228
- $ ( "#generated" ) . addClass ( "hide" ) ;
229
- $ ( "#generating" ) . removeClass ( "hide" ) ;
230
-
231
- // Retry in 5 seconds if still not generated
232
- setTimeout ( function ( ) {
233
- getDownloadLink ( ) ;
234
- } , 5000 )
235
- }
236
- } ) ;
237
- }
238
173
239
- getDownloadLink ( ) ;
240
- } ) ;
241
-
242
- /**
243
- * Highlighting step in graph when table row is
244
- * hovered over or vice-versa
245
- */
246
- require ( [ 'jquery' , 'jquery.svg' , 'jquery.svgdom' ] ,
247
- function ( $ ) {
248
174
/**
249
175
* endsWith function to check suffix
250
176
*/
@@ -319,6 +245,18 @@ require(['jquery', 'jquery.svg', 'jquery.svgdom'],
319
245
}
320
246
} , "#graph" ) ;
321
247
248
+ /**
249
+ * Follow the link to a subworkflow if one exists
250
+ * @param node The node of the visualisation
251
+ */
252
+ function goToSubworkflow ( node ) {
253
+ var matchingTableRow = getTableRow ( node ) ;
254
+ var subworkflowLink = $ ( matchingTableRow ) . find ( "a.subworkflow" ) ;
255
+ if ( subworkflowLink . length > 0 ) {
256
+ location . href = subworkflowLink . attr ( "href" ) ;
257
+ }
258
+ }
259
+
322
260
/**
323
261
* When a graph box is hovered over/clicked, highlight
324
262
*/
@@ -337,11 +275,7 @@ require(['jquery', 'jquery.svg', 'jquery.svgdom'],
337
275
} ,
338
276
dblclick : function ( ) {
339
277
// Follow link to subworkflow if possible
340
- var matchingTableRow = getTableRow ( this ) ;
341
- var subworkflowLink = $ ( matchingTableRow ) . find ( "a.subworkflow" ) ;
342
- if ( subworkflowLink . length > 0 ) {
343
- location . href = subworkflowLink . attr ( "href" ) ;
344
- }
278
+ goToSubworkflow ( this ) ;
345
279
} ,
346
280
mouseenter : function ( ) {
347
281
getTableRow ( this ) . addClass ( "hover" ) ;
@@ -420,7 +354,78 @@ require(['jquery', 'jquery.svg', 'jquery.svgdom'],
420
354
expandSelection ( $ ( this ) . parent ( ) , "inList" ) ;
421
355
} ) ;
422
356
} ) ;
357
+ } ) ;
358
+
359
+ /**
360
+ * Handle the dot graph modal and related features
361
+ */
362
+ require ( [ 'jquery' , 'bootstrap.modal' ] ,
363
+ function ( $ , modal ) {
364
+ /**
365
+ * DOT graph modal textarea automatically focuses when opened
366
+ */
367
+ $ ( '#dotGraph' ) . on ( 'shown.bs.modal' , function ( ) {
368
+ $ ( '#dot' ) . focus ( ) ;
369
+ } ) ;
370
+
371
+ /**
372
+ * DOT graph textarea focus selects all
373
+ */
374
+ $ ( "#dot" ) . focus ( function ( ) {
375
+ $ ( this ) . select ( ) ;
376
+ } ) ;
377
+
378
+ /**
379
+ * Downloading of the DOT graph as a .gv file
380
+ */
381
+ $ ( '#download-dot' ) . click ( function ( event ) {
382
+ // Generate download link src
383
+ var dotGraph = $ ( "#dot" ) . val ( ) ;
384
+ var src = "data:text/vnd.graphviz;charset=utf-8," + encodeURIComponent ( dotGraph ) ;
385
+
386
+ // Set hidden download link href to contents and click it
387
+ var downloadLink = $ ( "#download-link-dot" ) ;
388
+ downloadLink . attr ( "href" , src ) ;
389
+ downloadLink [ 0 ] . click ( ) ;
423
390
391
+ // Stop default button action
392
+ event . preventDefault ( ) ;
393
+ } ) ;
394
+ } ) ;
395
+
396
+ /**
397
+ * Code for including the link to the Research Object Bundle download
398
+ * without refresh once generated
399
+ */
400
+ require ( [ 'jquery' ] ,
401
+ function ( $ ) {
402
+ /**
403
+ * AJAX function to add download link to page if generated
404
+ */
405
+ function getDownloadLink ( ) {
406
+ $ . ajax ( {
407
+ type : 'HEAD' ,
408
+ url : $ ( '#download' ) . attr ( 'href' ) ,
409
+ dataType : "json" ,
410
+ success : function ( ) {
411
+ // Hide generating, show link
412
+ $ ( "#generating" ) . addClass ( "hide" ) ;
413
+ $ ( "#generated" ) . removeClass ( "hide" ) ;
414
+ } ,
415
+ error : function ( ) {
416
+ // Show generating, hide link
417
+ $ ( "#generated" ) . addClass ( "hide" ) ;
418
+ $ ( "#generating" ) . removeClass ( "hide" ) ;
419
+
420
+ // Retry in 5 seconds if still not generated
421
+ setTimeout ( function ( ) {
422
+ getDownloadLink ( ) ;
423
+ } , 5000 )
424
+ }
425
+ } ) ;
426
+ }
427
+
428
+ getDownloadLink ( ) ;
424
429
} ) ;
425
430
426
431
/**
0 commit comments