hyper-vis 1.0.0.lap24 → 1.0.0.lap25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/lib/hyperloop/vis/mixin.rb +4 -0
- data/lib/hyperloop/vis/version.rb +1 -1
- data/lib/vis/network.rb +15 -11
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 749aaea83b655118b902175e75dee3dc7d6be3b4ad94f6f99ddd59382518d257
|
4
|
+
data.tar.gz: 7b59a5aa4e67be9c9da57be137949d59bf228cd977ced44d78ef16af2face9fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cf89533e6e15d81f85fe3a9dbb744d24612d4262af39323937004935504cb29fb69766d606e249d3ebc39d38819e38d5040809a670ea1f6dd1c0ccabd759ec4
|
7
|
+
data.tar.gz: 8befb906b571f215eb6b884d953000acb468907fdd88c0120cdecdd4755187ab8e5b8d3f200070892d37ccb93ada3f5e8d51c2afbb981f3287e3f1a231ea5f74
|
data/README.md
CHANGED
data/lib/hyperloop/vis/mixin.rb
CHANGED
data/lib/vis/network.rb
CHANGED
@@ -52,27 +52,31 @@ module Vis
|
|
52
52
|
`self["native"].off(event, handler)`
|
53
53
|
@event_handlers[event].delete(event_handler_id)
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
def on(event, &block)
|
57
57
|
event = lower_camelize(event)
|
58
58
|
@event_handlers[event] = {} unless @event_handlers[event]
|
59
59
|
event_handler_id = `Math.random().toString(36).substring(6)`
|
60
|
-
handler = %
|
61
|
-
function(
|
62
|
-
|
63
|
-
}
|
64
|
-
|
60
|
+
handler = if %i[afterDrawing beforeDrawing blurEdge blurNode hoverEdge hoverNode showPopup].include?(event)
|
61
|
+
`function(param) { #{block.call(`param`)}; }`
|
62
|
+
elsif %i[hidePopup startStabilizing stabilizationIterationsDone initRedraw].include?(event)
|
63
|
+
`function() { #{block.call}; }`
|
64
|
+
else
|
65
|
+
`function(event_info) { #{block.call(`Opal.Hash.$new(event_info)`)}; }`
|
66
|
+
end
|
65
67
|
@event_handlers[event][event_handler_id] = handler
|
66
68
|
`self["native"].on(event, handler);`
|
67
69
|
event_handler_id
|
68
70
|
end
|
69
71
|
|
70
72
|
def once(event, &block)
|
71
|
-
handler = %
|
72
|
-
function(
|
73
|
-
|
74
|
-
}
|
75
|
-
|
73
|
+
handler = if %i[afterDrawing beforeDrawing blurEdge blurNode hoverEdge hoverNode showPopup].include?(event)
|
74
|
+
`function(param) { #{block.call(`param`)}; }`
|
75
|
+
elsif %i[hidePopup startStabilizing stabilizationIterationsDone initRedraw].include?(event)
|
76
|
+
`function() { #{block.call}; }`
|
77
|
+
else
|
78
|
+
`function(event_info) { #{block.call(`Opal.Hash.$new(event_info)`)}; }`
|
79
|
+
end
|
76
80
|
`self["native"].once(event, handler);`
|
77
81
|
end
|
78
82
|
|