forked from cytoscape/cytoscape.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview.js
108 lines (80 loc) · 1.98 KB
/
view.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
$(function(){
$("#cytoscape").cy(function(e){
var cy = this;
$("#zoom-pan-button").click(function(){
cy.reset();
});
$("#fit-button").click(function(){
cy.fit();
});
$("#fit-selected-button").click(function(){
cy.fit( cy.elements(":selected") );
});
$("#center-selected-button").click(function(){
cy.center( cy.elements(":selected") );
});
$("#enable-panning").click(function(){
cy.panningEnabled(true);
});
$("#disable-panning").click(function(){
cy.panningEnabled(false);
});
$("#enable-user-panning").click(function(){
cy.userPanningEnabled(true);
});
$("#disable-user-panning").click(function(){
cy.userPanningEnabled(false);
});
$("#enable-zooming").click(function(){
cy.zoomingEnabled(true);
});
$("#disable-zooming").click(function(){
cy.zoomingEnabled(false);
});
$("#enable-user-zooming").click(function(){
cy.userZoomingEnabled(true);
});
$("#disable-user-zooming").click(function(){
cy.userZoomingEnabled(false);
});
$("#enable-autolock").click(function(){
cy.autolock(true);
});
$("#disable-autolock").click(function(){
cy.autolock(false);
});
$("#enable-autoungrabify").click(function(){
cy.autoungrabify(true);
});
$("#disable-autoungrabify").click(function(){
cy.autoungrabify(false);
});
$("#enable-autounselectify").click(function(){
cy.autounselectify(true);
});
$("#disable-autounselectify").click(function(){
cy.autounselectify(false);
});
$("#show-bb").click(function(){
var eles = cy.$(':selected');
if( eles.length === 0 ){
eles = cy.elements();
}
eles.showBB();
});
cytoscape('collection', 'showBB', function(){
var bb = this.renderedBoundingBox();
var os = $('#cytoscape').offset();
$('#bb').css({
left: bb.x1 + os.left + 1,
top: bb.y1 + os.top + 1,
width: bb.x2 - bb.x1,
height: bb.y2 - bb.y1
}).show();
return this;
});
$("#hide-bb").click(function(){
$('#bb').hide();
});
});
});