Skip to content

Commit d0570b0

Browse files
committed
update namespace function declaration
1 parent 744c4f0 commit d0570b0

File tree

1 file changed

+28
-22
lines changed

1 file changed

+28
-22
lines changed

demos/assets/ctxMenuFns.js

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
11
window.dashCytoscapeFunctions = {};
22

3-
window.dashCytoscapeFunctions.add_2_nodes = function (event) {
4-
var pos = event.position || event.cyPosition;
5-
cy.add({
6-
data: {
7-
group: 'nodes',
8-
id: Date.now(),
3+
window.dashCytoscapeFunctions = Object.assign(
4+
{},
5+
window.dashCytoscapeFunctions,
6+
{
7+
add_2_nodes: function (event) {
8+
var pos = event.position || event.cyPosition;
9+
cy.add({
10+
data: {
11+
group: 'nodes',
12+
id: Date.now(),
13+
},
14+
position: {
15+
x: pos.x,
16+
y: pos.y,
17+
},
18+
});
19+
cy.add({
20+
data: {
21+
group: 'nodes',
22+
id: `${Date.now()}_2`,
23+
},
24+
position: {
25+
x: pos.x + 50,
26+
y: pos.y + 50,
27+
},
28+
});
929
},
10-
position: {
11-
x: pos.x,
12-
y: pos.y,
13-
},
14-
});
15-
cy.add({
16-
data: {
17-
group: 'nodes',
18-
id: `${Date.now()}_2`,
19-
},
20-
position: {
21-
x: pos.x + 50,
22-
y: pos.y + 50,
23-
},
24-
});
25-
};
30+
}
31+
);

0 commit comments

Comments
 (0)