hyper-vis 1.0.0.lap30 → 1.0.0.lap31
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hyperloop/vis/version.rb +2 -2
- data/lib/vis/utilities.rb +36 -34
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb401bccbb9431f12af363d72266e579c316cb1b0c962604c81100d712c3793e
|
4
|
+
data.tar.gz: 530d4a7c7d21fac9cd687aeb2c3f8b116fee90688b2a704971832f7ec9dcbacd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b81ce1718943cbbc5017d1de452fe0a99e534945341da8f8a33335d58545405510587374614039e42453e608a0b77dd6b88373e46bb61fb9ea6ee2c4c3886de
|
7
|
+
data.tar.gz: 716eea038fba08da0dbacea1f4b92f6bed0d557d848f423a65a870d4dd2c06291fd5e7d1dab03dde6c3432d9ddb4e0ff0b0d9a4116b033e8890d4c2a45808d4e
|
data/lib/vis/utilities.rb
CHANGED
@@ -43,15 +43,17 @@ module Vis
|
|
43
43
|
|
44
44
|
def options_to_native(options)
|
45
45
|
return unless options
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
if
|
52
|
-
|
46
|
+
# options must be duplicated, so callbacks dont get wrapped twice
|
47
|
+
new_opts = options.dup
|
48
|
+
_rubyfy_configure_options(new_opts) if new_opts.has_key?(:configure)
|
49
|
+
_rubyfy_edges_options(new_opts) if new_opts.has_key?(:edges)
|
50
|
+
_rubyfy_manipulation_options(new_opts) if new_opts.has_key?(:manipulation)
|
51
|
+
_rubyfy_nodes_options(new_opts) if new_opts.has_key?(:nodes)
|
52
|
+
|
53
|
+
if new_opts.has_key?(:join_condition)
|
54
|
+
block = new_opts[:join_condition]
|
53
55
|
if `typeof block === "function"`
|
54
|
-
|
56
|
+
new_opts[:join_condition] = %x{
|
55
57
|
function(node_options, child_options) {
|
56
58
|
if (child_options !== undefined && child_options !== null) {
|
57
59
|
return #{block.call(`Opal.Hash.$new(node_options)`, `Opal.Hash.$new(child_options)`)};
|
@@ -63,10 +65,10 @@ module Vis
|
|
63
65
|
end
|
64
66
|
end
|
65
67
|
|
66
|
-
if
|
67
|
-
block =
|
68
|
+
if new_opts.has_key?(:process_properties)
|
69
|
+
block = new_opts[:process_properties]
|
68
70
|
if `typeof block === "function"`
|
69
|
-
|
71
|
+
new_opts[:process_properties] = %x{
|
70
72
|
function(item) {
|
71
73
|
var res = #{block.call(`Opal.Hash.$new(item)`)};
|
72
74
|
return res.$to_n();
|
@@ -75,10 +77,10 @@ module Vis
|
|
75
77
|
end
|
76
78
|
end
|
77
79
|
|
78
|
-
if
|
79
|
-
block =
|
80
|
+
if new_opts.has_key?(:filter)
|
81
|
+
block = new_opts[:filter]
|
80
82
|
if `typeof block === "function"`
|
81
|
-
|
83
|
+
new_opts[:filter] = %x{
|
82
84
|
function(item) {
|
83
85
|
return #{block.call(`Opal.Hash.$new(item)`)};
|
84
86
|
}
|
@@ -86,7 +88,7 @@ module Vis
|
|
86
88
|
end
|
87
89
|
end
|
88
90
|
|
89
|
-
lower_camelize_hash(
|
91
|
+
lower_camelize_hash(new_opts).to_n
|
90
92
|
end
|
91
93
|
|
92
94
|
def _rubyfy_configure_options(options)
|
@@ -146,30 +148,30 @@ module Vis
|
|
146
148
|
|
147
149
|
def _rubyfy_manipulation_options(options)
|
148
150
|
[:add_edge, :add_node, :edit_edge, :edit_node].each do |key|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
}
|
151
|
+
next unless options[:manipulation].has_key?(key)
|
152
|
+
block = options[:manipulation][key]
|
153
|
+
if `typeof block === "function"`
|
154
|
+
options[:manipulation][key] = %x{
|
155
|
+
function(nodeData, callback) {
|
156
|
+
console.log("callback got nodeData 1", nodeData);
|
157
|
+
console.log(key);
|
158
|
+
var wrapped_callback = #{ proc { |new_node_data| `callback(new_node_data.$to_n());` }};
|
159
|
+
block.$call(Opal.Hash.$new(nodeData), wrapped_callback);
|
157
160
|
}
|
158
|
-
|
161
|
+
}
|
159
162
|
end
|
160
163
|
end
|
161
164
|
# for delete the order of args for the callback is not clear
|
162
165
|
[:delete_edge, :delete_node].each do |key|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
}
|
166
|
+
next unless options[:manipulation].has_key?(key)
|
167
|
+
block = options[:manipulation][key]
|
168
|
+
if `typeof block === "function"`
|
169
|
+
options[:manipulation][key] = %x{
|
170
|
+
function(nodeData, callback) {
|
171
|
+
var wrapped_callback = #{ proc { |new_node_data| `callback(new_node_data.$to_n());` }};
|
172
|
+
block.$call(Opal.Hash.$new(nodeData), wrapped_callback);
|
171
173
|
}
|
172
|
-
|
174
|
+
}
|
173
175
|
end
|
174
176
|
end
|
175
177
|
end
|
@@ -204,4 +206,4 @@ module Vis
|
|
204
206
|
end
|
205
207
|
end
|
206
208
|
end
|
207
|
-
end
|
209
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hyper-vis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.lap31
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|