hyper-vis 1.0.0.lap27 → 1.0.0.lap28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/hyperloop/vis/version.rb +1 -1
- data/lib/vis/utilities.rb +21 -21
- data/spec/vis_network_spec.rb +16 -1
- 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: 7bea13d14dc540c492236959cd126c99ed1698f6a42e1260cb293445b4837e56
|
4
|
+
data.tar.gz: '0409e01c7632eeef3d17220eab96c8c6252e132694d4bafe3a1990fa06c76b1e'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27cc2b94166c5cbf633ebf40612b53df09f979ba022ec8dbd5ed6b4b616d9abf49174744202aaf28d4069b97f79e98b507638a8cf64cd804133a7bc8aeb2b42c
|
7
|
+
data.tar.gz: 764a0aaefcf31684fee9b1599a12ec007b7e4e857d45f5908247d5de0526a685c9cd780b028feed695ff921d4d607ff5e15646d33119e1794e6bc365ab2e8e43
|
data/lib/vis/utilities.rb
CHANGED
@@ -171,33 +171,33 @@ module Vis
|
|
171
171
|
end
|
172
172
|
end
|
173
173
|
end
|
174
|
-
end
|
175
174
|
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
175
|
+
def _rubyfy_nodes_options(options)
|
176
|
+
if options[:nodes].has_key?(:chosen)
|
177
|
+
chosen = options[:nodes][:chosen]
|
178
|
+
[:node, :label].each do |key|
|
179
|
+
if chosen.has_key?(key)
|
180
|
+
block = chosen[key]
|
181
|
+
if `typeof block === "function"`
|
182
|
+
options[:nodes][:chosen][key] = %x{
|
183
|
+
function(values, id, selected, hovering) {
|
184
|
+
return #{block.call(`Opal.Hash.$new(values)`, `id`, `selected`, `hovering`)};
|
185
|
+
}
|
186
186
|
}
|
187
|
-
|
187
|
+
end
|
188
188
|
end
|
189
189
|
end
|
190
190
|
end
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
191
|
+
if options[:nodes].has_key?(:scaling)
|
192
|
+
if options[:nodes][:scaling].has_key?(:custom_scaling_function)
|
193
|
+
block = options[:nodes][:scaling][:custom_scaling_function]
|
194
|
+
if `typeof block === "function"`
|
195
|
+
options[:nodes][:scaling][:custom_scaling_function] = %x{
|
196
|
+
function(min, max, total, value) {
|
197
|
+
return #{block.call(`min`, `max`, `total`, `value`)};
|
198
|
+
}
|
199
199
|
}
|
200
|
-
|
200
|
+
end
|
201
201
|
end
|
202
202
|
end
|
203
203
|
end
|
data/spec/vis_network_spec.rb
CHANGED
@@ -45,7 +45,22 @@ describe 'Vis::Network', js: true do
|
|
45
45
|
created = dom_node.JS[:children].JS[:length]
|
46
46
|
error = false
|
47
47
|
begin
|
48
|
-
net.set_options(
|
48
|
+
net.set_options({
|
49
|
+
:autoResize => true,
|
50
|
+
:locale => 'en',
|
51
|
+
:nodes => {
|
52
|
+
:scaling => {
|
53
|
+
:min => 16,
|
54
|
+
:max => 32
|
55
|
+
},
|
56
|
+
:shadow => true
|
57
|
+
},
|
58
|
+
:edges => {
|
59
|
+
:color => "#ff0000",
|
60
|
+
:smooth => false,
|
61
|
+
:shadow => true
|
62
|
+
}
|
63
|
+
})
|
49
64
|
rescue
|
50
65
|
error = true
|
51
66
|
end
|