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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7eb5eff15f82054481375b935135d9fa43680a9996385f54e53db7ad848bebf7
4
- data.tar.gz: fae2fc15de0c8a4dc534c7243924e07fb68368ce07392a7c8911ddf7c970133e
3
+ metadata.gz: fb401bccbb9431f12af363d72266e579c316cb1b0c962604c81100d712c3793e
4
+ data.tar.gz: 530d4a7c7d21fac9cd687aeb2c3f8b116fee90688b2a704971832f7ec9dcbacd
5
5
  SHA512:
6
- metadata.gz: 7a8db12d96b62a3076369336cd7c93ff650152aa8c7999b0aadfd406c71d2335be8d27adb2736a5fbfe7eb5adf6103453e4ef769946e6d78a5b3ea5a5829eb56
7
- data.tar.gz: 13db992240ec099353a6e7879e2ee14e67921c78e4bab206f6e67b93253a793f89aa7ed8fd27eb795d61fb31c9051f6e5c02517e1d80503d47226ba33028bffd
6
+ metadata.gz: 7b81ce1718943cbbc5017d1de452fe0a99e534945341da8f8a33335d58545405510587374614039e42453e608a0b77dd6b88373e46bb61fb9ea6ee2c4c3886de
7
+ data.tar.gz: 716eea038fba08da0dbacea1f4b92f6bed0d557d848f423a65a870d4dd2c06291fd5e7d1dab03dde6c3432d9ddb4e0ff0b0d9a4116b033e8890d4c2a45808d4e
@@ -1,5 +1,5 @@
1
1
  module Hyperloop
2
2
  module Vis
3
- VERSION = '1.0.0.lap30'
3
+ VERSION = '1.0.0.lap31'
4
4
  end
5
- end
5
+ end
@@ -43,15 +43,17 @@ module Vis
43
43
 
44
44
  def options_to_native(options)
45
45
  return unless options
46
- _rubyfy_configure_options(options) if options.has_key?(:configure)
47
- _rubyfy_edges_options(options) if options.has_key?(:edges)
48
- _rubyfy_manipulation_options(options) if options.has_key?(:manipulation)
49
- _rubyfy_nodes_options(options) if options.has_key?(:nodes)
50
-
51
- if options.has_key?(:join_condition)
52
- block = options[:join_condition]
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
- options[:join_condition] = %x{
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 options.has_key?(:process_properties)
67
- block = options[:process_properties]
68
+ if new_opts.has_key?(:process_properties)
69
+ block = new_opts[:process_properties]
68
70
  if `typeof block === "function"`
69
- options[:process_properties] = %x{
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 options.has_key?(:filter)
79
- block = options[:filter]
80
+ if new_opts.has_key?(:filter)
81
+ block = new_opts[:filter]
80
82
  if `typeof block === "function"`
81
- options[:filter] = %x{
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(options).to_n
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
- if options[:manipulation].has_key?(key)
150
- block = options[:manipulation][key]
151
- if `typeof block === "function"`
152
- options[:manipulation][key] = %x{
153
- function(nodeData, callback) {
154
- var wrapped_callback = #{ proc { |new_node_data| `callback(new_node_data.$to_n())` }}
155
- return block.$call(Opal.Hash.$new(nodeData), wrapped_callback);
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
- end
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
- if options[:manipulation].has_key?(key)
164
- block = options[:manipulation][key]
165
- if `typeof block === "function"`
166
- options[:manipulation][key] = %x{
167
- function(nodeData, callback) {
168
- var wrapped_callback = #{ proc { |new_node_data| `callback(new_node_data.$to_n())` }}
169
- return block.$call(Opal.Hash.$new(nodeData), wrapped_callback);
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
- end
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.lap30
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-02-28 00:00:00.000000000 Z
11
+ date: 2018-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal