atome 0.5.5.8.1 → 0.5.5.8.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -1
  3. data/exe/atome +4 -4
  4. data/lib/atome/atome.rb +1 -1
  5. data/lib/atome/extensions/atome.rb +171 -34
  6. data/lib/atome/genesis/generators/atome.rb +10 -1
  7. data/lib/atome/genesis/generators/communication.rb +4 -0
  8. data/lib/atome/genesis/generators/event.rb +4 -3
  9. data/lib/atome/genesis/generators/geometry.rb +31 -4
  10. data/lib/atome/genesis/generators/identity.rb +3 -0
  11. data/lib/atome/genesis/generators/material.rb +1 -0
  12. data/lib/atome/genesis/generators/property.rb +75 -1
  13. data/lib/atome/genesis/generators/spatial.rb +2 -0
  14. data/lib/atome/genesis/generators/utility.rb +26 -12
  15. data/lib/atome/helpers/essentials.rb +3 -2
  16. data/lib/atome/version.rb +1 -1
  17. data/lib/renderers/html/atome.rb +0 -1
  18. data/lib/renderers/html/geometry.rb +11 -5
  19. data/lib/renderers/html/html.rb +374 -19
  20. data/lib/renderers/html/identity.rb +8 -0
  21. data/lib/renderers/html/material.rb +14 -0
  22. data/lib/renderers/html/property.rb +21 -0
  23. data/lib/renderers/html/spatial.rb +5 -1
  24. data/lib/renderers/html/utility.rb +25 -1
  25. data/vendor/assets/application/examples/atomizer.rb +86 -0
  26. data/vendor/assets/application/examples/center.rb +8 -0
  27. data/vendor/assets/application/examples/compute.rb +16 -0
  28. data/vendor/assets/application/examples/dig.rb +13 -0
  29. data/vendor/assets/application/examples/fit.rb +26 -0
  30. data/vendor/assets/application/examples/infos.rb +10 -0
  31. data/vendor/assets/application/examples/shortcut.rb +2 -2
  32. data/vendor/assets/application/examples/size.rb +17 -0
  33. data/vendor/assets/application/examples/table.rb +76 -0
  34. data/vendor/assets/application/examples/text.rb +1 -1
  35. data/vendor/assets/src/index.html +15 -15
  36. data/vendor/assets/src/index_wasm.html +47 -0
  37. data/vendor/assets/src/js/atome/atome_helpers/communication.js +5 -4
  38. metadata +11 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dca916be3525186dfd79400fc93edeffbe278488c372a9ce67be16ae595d01a5
4
- data.tar.gz: a332d054df5551d18058ef0e692e87eb362cb498962bcbc4f6717d2dc31d45b9
3
+ metadata.gz: 4aa832acc6d311b046d0d0efeee475a0f1ec11774eb392218ab8fe8d8d2f3c52
4
+ data.tar.gz: 8e6c9a171461da40f3d88f2466a50d72e3a4d16bd80db228b53ea9e69d6d58be
5
5
  SHA512:
6
- metadata.gz: 99f23cb4a77974b91c1169727740c4c20afd3c9b06c91b3de1d20fbaa4cd95e75806bc3f2775b659d4467be7618290ed14bd2045e04b0df0cdac1572f1b795ad
7
- data.tar.gz: afdd19c60b61262fa4cd5abc89edc5a01692adf2aac3878741d1f508980c4cb48ea2d332468c649835f933742084082c13d3481673462ccda86bb9dd17611580
6
+ metadata.gz: 07b0fadc4e1818654614b1a47acde2bca31654f74782069a5f6b01a545740dfcf1a6676b960d50000ffa87ad66c6e50f6626e9997ada0ecaeaa772d5f910b4c9
7
+ data.tar.gz: f96b61891e6b0f359085f1412bd6bc5ed368be0dd8ee23df2dcdc087cfa31d4146482478129622113aef1fec9a4d15634b844db1eb329285fe3ea02c7fc4df35
data/Rakefile CHANGED
@@ -77,7 +77,7 @@ task :test_wasm do
77
77
 
78
78
  host_mode = 'pure_wasm'
79
79
 
80
- file_path = "./tmp/#{project_name}/src/index.html"
80
+ file_path = "./tmp/#{project_name}/src/index_wasm.html"
81
81
 
82
82
  case RbConfig::CONFIG['host_os']
83
83
  when /darwin|mac os/
data/exe/atome CHANGED
@@ -482,7 +482,7 @@ if ARGV.include?('update')
482
482
  # first we delete everything but application
483
483
 
484
484
  files_to_treat = %w[server src-tauri src-wasm Guardfile Rakefile src/css src/js/atome src/js/third_parties src/medias
485
- src/favicon.ico src/index.html src/index_opal.html src/index_server.html src/index_server_wasm.html]
485
+ src/favicon.ico src/index_wasm.html src/index_opal.html src/index_server.html src/index_server_wasm.html]
486
486
  files_to_treat.each do |item|
487
487
  item_path = File.join(destination, item)
488
488
  if File.directory?(item_path)
@@ -647,13 +647,13 @@ else
647
647
 
648
648
  if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
649
649
  # code to exec for Windows
650
- `start "" "#{destination}\\#{project_name}\\src\\index.html"`
650
+ `start "" "#{destination}\\#{project_name}\\src\\index_wasm.html"`
651
651
  elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
652
652
  # code to exec for MacOS
653
- `open #{destination}/#{project_name}/src/index.html`
653
+ `open #{destination}/#{project_name}/src/index_wasm.html`
654
654
  else
655
655
  # code to exec for Unix/Linux
656
- `open #{destination}/#{project_name}/src/index.html`
656
+ `open #{destination}/#{project_name}/src/index_wasm.html`
657
657
  end
658
658
 
659
659
  end
data/lib/atome/atome.rb CHANGED
@@ -26,7 +26,7 @@ class Atome
26
26
  # now we store the proc in a an atome's property called :bloc
27
27
  new_atome[:code] = atomes_proc if atomes_proc
28
28
  # we reorder the hash
29
- ordered_keys = %i[renderers id type]
29
+ ordered_keys = %i[renderers id alien type]
30
30
  ordered_part = ordered_keys.map { |k| [k, new_atome[k]] }.to_h
31
31
  other_part = new_atome.reject { |k, _| ordered_keys.include?(k) }
32
32
  # merge the parts to obtain an re-ordered hash
@@ -101,7 +101,7 @@ class Object
101
101
  @repeat ||= []
102
102
  @repeat << proc
103
103
  repeat_id = @repeat.length - 1
104
- intervalId = JS.eval(<<~JS)
104
+ JS.eval(<<~JS)
105
105
  function repeat(action, interval, repetitions) {
106
106
  let count = 0;
107
107
  let intervalId = null;
@@ -128,7 +128,6 @@ class Object
128
128
 
129
129
  return intervalId;
130
130
  JS
131
- intervalId
132
131
 
133
132
  end
134
133
 
@@ -165,6 +164,7 @@ class Object
165
164
  end
166
165
  atome_get
167
166
  end
167
+
168
168
  # shortcut
169
169
 
170
170
  # we initialise $current_hovered_element
@@ -175,7 +175,7 @@ class Object
175
175
 
176
176
  element_ids.each do |element_id|
177
177
  element = JS.global[:document].querySelector("##{element_id}")
178
- if element
178
+ unless element_id.to_sym == :all
179
179
  element.addEventListener("mouseenter") { $current_hovered_element = element_id }
180
180
  element.addEventListener("mouseleave") { $current_hovered_element = nil }
181
181
  end
@@ -183,10 +183,10 @@ class Object
183
183
 
184
184
  JS.global[:document].addEventListener("keydown") do |native_event|
185
185
  event = Native(native_event)
186
- key_pressed = event[:key].downcase
187
- ctrl_pressed = event[:ctrlKey]
188
- alt_pressed = event[:altKey]
189
- meta_pressed = event[:metaKey]
186
+ key_pressed = event[:key].to_s.downcase
187
+ ctrl_pressed = event[:ctrlKey].to_s
188
+ alt_pressed = event[:altKey].to_s
189
+ meta_pressed = event[:metaKey].to_s
190
190
 
191
191
  modifier_matched = case option
192
192
  when :ctrl then ctrl_pressed
@@ -197,9 +197,7 @@ class Object
197
197
 
198
198
  affect_condition = affect == :all || Array(affect).include?($current_hovered_element)
199
199
  exclude_condition = !Array(exclude).include?($current_hovered_element)
200
- if $current_hovered_element.nil?
201
- $current_hovered_element=:view
202
- end
200
+ $current_hovered_element = :view if $current_hovered_element.nil?
203
201
  if key_pressed == key.to_s.downcase && modifier_matched && affect_condition && exclude_condition
204
202
  block.call(key_pressed, $current_hovered_element)
205
203
  end
@@ -208,9 +206,9 @@ class Object
208
206
 
209
207
  def console(debug)
210
208
  if debug
211
- console=box({id: :console, width: :auto, height:225, bottom: 0,top: :auto, left: 0,right: 0,depth: 30, color: {alpha: 0, red: 0.1, green: 0.3 , blue:0.3}})
212
- console_back=console.box({id: :console_back,blur: { value: 10, affect: :back}, overflow: :auto, width: :auto, height: :auto, top: 25, bottom: 0,left: 0,right: 0, depth: 30, color: {alpha: 0.3, red: 1, green: 1 , blue: 1}})
213
- console_top=console.box({id: :console_top,overflow: :auto, width: :auto, height:25, top: 0, bottom: 0,left: 0,right: 0, depth: 30, color: {alpha: 1, red: 0.3, green: 0.3 , blue: 0.3}})
209
+ console = box({ id: :console, width: :auto, height: 225, bottom: 0, top: :auto, left: 0, right: 0, depth: 30, color: { alpha: 0, red: 0, green: 0, blue: 0 } })
210
+ console_back = console.box({ id: :console_back, blur: { value: 5, affect: :back }, overflow: :auto, width: :auto, height: :auto, top: 25, bottom: 0, left: 0, right: 0, depth: 30, color: { alpha: 0.5, red: 0, green: 0, blue: 0 } })
211
+ console_top = console.box({ id: :console_top, overflow: :auto, width: :auto, height: 25, top: 0, bottom: 0, left: 0, right: 0, depth: 30, color: { alpha: 1, red: 0.3, green: 0.3, blue: 0.3 } })
214
212
 
215
213
  console_top.touch(:double) do
216
214
  console.height(25)
@@ -226,27 +224,27 @@ class Object
226
224
  })
227
225
  console.drag(:locked) do |event|
228
226
  dy = event[:dy]
229
- y = console.to_px(:top)+dy.to_f
227
+ y = console.to_px(:top) + dy.to_f
230
228
  console.top(y)
231
229
  console.height(:auto)
232
- total_height=grab(:view).to_px(:height)
230
+ total_height = grab(:view).to_px(:height)
233
231
  # console_back.height(total_height-console.top)
234
232
  end
235
- console_output=console_back.text({data: '', id: :console_output, component: {size: 12}})
233
+ console_output = console_back.text({ data: '', id: :console_output, component: { size: 12 } })
236
234
  JS.eval <<~JS
237
- (function() {
238
- var oldLog = console.log;
239
- var consoleDiv = document.getElementById("console_output");
240
- console.log = function(message) {
241
- if (consoleDiv) {
242
- consoleDiv.innerHTML += '<p>' + message + '</p>';
243
- }
244
- oldLog.apply(console, arguments);
245
- };
246
- }());
247
- JS
248
-
249
- console_clear=console_top.circle({id: :console_clear, color: :red, top: 3, left: 3, width: 19, height:19})
235
+ (function() {
236
+ var oldLog = console.log;
237
+ var consoleDiv = document.getElementById("console_output");
238
+ console.log = function(message) {
239
+ if (consoleDiv) {
240
+ consoleDiv.innerHTML += '<p>' + message + '</p>';
241
+ }
242
+ oldLog.apply(console, arguments);
243
+ };
244
+ }());
245
+ JS
246
+
247
+ console_clear = console_top.circle({ id: :console_clear, color: :red, top: 3, left: 3, width: 19, height: 19 })
250
248
  console_clear.touch(true) do
251
249
  console_output.data("")
252
250
  end
@@ -332,18 +330,157 @@ class Object
332
330
  event = Native(native_event)
333
331
  event.preventDefault
334
332
  event.stopPropagation
335
-
336
- puts 'Fichier déposé hors de la zone spéciale'
333
+ # puts 'File drop out of the special zonne'
337
334
  end
338
335
  end
339
336
  end
340
337
 
341
- def importer(target=:all,&proc)
342
- if target== :all
338
+ def importer(target = :all, &proc)
339
+ if target == :all
343
340
  importer_all(&proc)
344
341
  else
345
- exception_import(target,&proc)
342
+ exception_import(target, &proc)
343
+ end
344
+ end
345
+
346
+ def infos
347
+ particle_list = Universe.particle_list.dup
348
+ particle_list.delete(:password)
349
+ particle_list.delete(:selection)
350
+ infos = {}
351
+ particle_list.each do |particle_found|
352
+ infos[particle_found[0]] = send(particle_found[0]) unless send(particle_found[0]).nil?
353
+ end
354
+ infos
355
+ end
356
+
357
+ def dig
358
+ ids = []
359
+ dig_recursive = lambda do |atome|
360
+ ids << atome.id
361
+ atome.attached.each { |attached_atome| dig_recursive.call(grab(attached_atome)) }
362
+ end
363
+ dig_recursive.call(self)
364
+ ids
365
+ end
366
+
367
+ def fit(params)
368
+ unless params.instance_of?(Hash)
369
+ params = { value: params }
370
+ end
371
+ target_size = params[:value]
372
+ axis = params[:axis]
373
+ objet_atome = self
374
+ atomes_found = objet_atome.dig
375
+ total_width = found_area_used(atomes_found)[:max][:x] - found_area_used(atomes_found)[:min][:x]
376
+ total_height = found_area_used(atomes_found)[:max][:y] - found_area_used(atomes_found)[:min][:y]
377
+ if axis == :x
378
+ ratio = target_size / total_width
379
+ # now we resize and re-position all atomes
380
+ atomes_found.each do |atome_id|
381
+ current_atome = grab(atome_id)
382
+ current_atome.left(current_atome.left * ratio)
383
+ current_atome.top(current_atome.top * ratio)
384
+ new_width = current_atome.to_px(:width) * ratio
385
+ new_height = current_atome.to_px(:height) * ratio
386
+ current_atome.width(new_width)
387
+ current_atome.height(new_height)
388
+ end
389
+ else
390
+ ratio = target_size / total_height
391
+ # now we resize and re-position all atomes
392
+ atomes_found.each do |atome_id|
393
+ current_atome = grab(atome_id)
394
+ current_atome.left(current_atome.left * ratio)
395
+ current_atome.top(current_atome.top * ratio)
396
+ current_atome.width(current_atome.to_px(:width) * ratio)
397
+ current_atome.height(current_atome.to_px(:height) * ratio)
398
+ end
399
+ end
400
+ # total_size, max_other_axis_size = calculate_total_size(objet_atome, axis)
401
+ # scale_factor = target_size.to_f / total_size
402
+ # resize_and_reposition(objet_atome, scale_factor, axis, max_other_axis_size)
403
+ end
404
+
405
+ def found_area_used(ids)
406
+
407
+ min_x, min_y = Float::INFINITY, Float::INFINITY
408
+ max_x, max_y = 0, 0
409
+
410
+ ids.each do |id|
411
+ atome = grab(id)
412
+
413
+ x = atome.compute({ particle: :left })[:value]
414
+ y = atome.compute({ particle: :top })[:value]
415
+ width = atome.to_px(:width)
416
+ height = atome.to_px(:height)
417
+ min_x = [min_x, x].min
418
+ min_y = [min_y, y].min
419
+ max_x = [max_x, x + width].max
420
+ max_y = [max_y, y + height].max
421
+ end
422
+
423
+ { min: { x: min_x, y: min_y }, max: { x: max_x, y: max_y } }
424
+
425
+ end
426
+
427
+ def calculate_total_size(objet_atome, axis)
428
+ total_size = (axis == :x) ? objet_atome.to_px(:width) : objet_atome.to_px(:height)
429
+ max_other_axis_size = (axis == :x) ? objet_atome.to_px(:height) : objet_atome.to_px(:width)
430
+
431
+ objet_atome.attached.each do |child_id|
432
+ child = grab(child_id)
433
+ child_size = (axis == :x) ? child.to_px(:width) : child.to_px(:height)
434
+ other_axis_size = (axis == :x) ? child.to_px(:height) : child.to_px(:width)
435
+
436
+ total_size += child_size
437
+ max_other_axis_size = [max_other_axis_size, other_axis_size].max
438
+ end
439
+
440
+ [total_size, max_other_axis_size]
441
+ end
442
+
443
+ def resize_and_reposition(objet_atome, scale_factor, axis, max_other_axis_size)
444
+ current_position = 0
445
+ resize_object(objet_atome, scale_factor, axis, max_other_axis_size)
446
+ current_position += (axis == :x) ? objet_atome.to_px(:width) : objet_atome.to_px(:height)
447
+ objet_atome.attached.each do |child_id|
448
+ child = grab(child_id)
449
+ resize_object(child, scale_factor, axis, max_other_axis_size)
450
+ child.top(child.top * scale_factor)
451
+ child.left(child.left * scale_factor)
452
+ current_position += child.to_px(:height)
453
+ end
454
+ end
455
+
456
+ def resize_object(objet, scale_factor, axis, max_other_axis_size)
457
+ if axis == :x
458
+ new_width = objet.width * scale_factor
459
+ new_height = new_width / (objet.width.to_f / objet.height)
460
+ objet.width(new_width)
461
+ objet.height([new_height, max_other_axis_size].min)
462
+ else
463
+ new_height = objet.height * scale_factor
464
+ new_width = new_height / (objet.height.to_f / objet.width)
465
+ objet.height(new_height)
466
+ objet.width([new_width, max_other_axis_size].min)
467
+ end
468
+ end
469
+
470
+ def atomizer(params)
471
+ unless params.instance_of? Hash
472
+ params = { target: params }
473
+ end
474
+ id = params[:id]
475
+ if id
476
+ id_wanted = { id: id }
477
+ else
478
+ id_wanted = {}
346
479
  end
480
+ basis = { alien: params[:target],renderers: [:html], type: :atomized }.merge(id_wanted)
481
+ a = Atome.new(basis)
482
+ return a
483
+ # convert any foreign object (think HTML) to a pseudo atome objet , that embed foreign objet
347
484
  end
348
485
 
349
486
  end
@@ -18,12 +18,17 @@ new({ sanitizer: :image }) do |params|
18
18
  # TODO : we have to convert all image to png or maintain a database with extension
19
19
  # FIXME : temporary patch that add .png to the string if no extension is found
20
20
  params = "#{params}.png" if params.to_s.split('.').length == 1
21
-
22
21
  params = { path: "./medias/images/#{params}" }
23
22
  end
24
23
  # TODO : the line below should get the value from default params Essentials
25
24
  params
26
25
  end
26
+ new({ post: :image }) do
27
+ # we have find the size od the image to set it in the atome
28
+ instance_variable_set("@width", compute({ particle: :width })[:value])
29
+ instance_variable_set("@height", compute({ particle: :height })[:value])
30
+ end
31
+
27
32
  new({ atome: :video })
28
33
  new({ sanitizer: :video }) do |params|
29
34
  unless params.instance_of? Hash
@@ -87,4 +92,8 @@ new({ atome: :machine })
87
92
  new({ atome: :paint })
88
93
  new({ atome: :vector })
89
94
 
95
+ new({ atome: :matrix })
96
+ new({ atome: :atomized, type: :hash })
97
+
98
+
90
99
 
@@ -13,3 +13,7 @@ new({ particle: :message }) do |params, bloc|
13
13
 
14
14
  html.send_message(params, &bloc)
15
15
  end
16
+
17
+ new({ particle: :controller }) do |msg|
18
+ Atome.controller_sender(msg)
19
+ end
@@ -229,9 +229,10 @@ new({ sanitizer: :over }) do |params, user_bloc|
229
229
  params
230
230
 
231
231
  end
232
- new({ particle: :sort }) do |_value, sort_proc|
233
- @sort_proc = sort_proc
234
- end
232
+ # new({ particle: :sort }) do |_value, sort_proc|
233
+ # @sort_proc = sort_proc
234
+ # end
235
+
235
236
  new({ particle: :targets })
236
237
  new({ particle: :start })
237
238
  new({ pre: :start }) do |_value, user_proc|
@@ -1,7 +1,34 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- new({particle: :width })
4
- new({particle: :height })
5
- new({particle: :size }) do |params|
6
- params
3
+ new({ particle: :width })
4
+ new({ particle: :height })
5
+ # new({ particle: :size }) do |params|
6
+ # params
7
+ # end
8
+
9
+ new({ particle: :size }) do |params|
10
+ params = { value: params } unless params.instance_of? Hash
11
+ params[:recursive] ||= false
12
+ params[:reference] ||= :x
13
+ params[:target] ||= :self # :all resize atome + attached +distance between to the value
14
+ # self: resize the current atome to current value
15
+ params[:propagate] ||= :raw # proportional atome children will be resize according
16
+ # to its parent , raw apply the raw value to the attached atomes
17
+ if params[:reference] == :x
18
+ original_width = width
19
+ width(params[:value])
20
+ height(height * params[:value] / original_width)
21
+ else
22
+ original_height = height
23
+ height(params[:value])
24
+ width(width * params[:value] / original_height)
25
+ end
26
+
27
+ if params[:recursive]
28
+ attached.each do |atome_id|
29
+ grab(atome_id).size(params)
30
+ end
31
+
32
+ end
33
+
7
34
  end
@@ -59,3 +59,6 @@ new(particle: :selected) do |params|
59
59
  end
60
60
  params
61
61
  end
62
+
63
+ new({ particle: :format })
64
+ new({ particle: :alien }) #special particel that old alien object
@@ -59,3 +59,4 @@ new({ sanitizer: :definition }) do |params|
59
59
  end
60
60
 
61
61
  new({ particle: :gradient })
62
+ new({ particle: :border })
@@ -30,4 +30,78 @@ new({ particle: :diffusion }) do
30
30
  self
31
31
  end
32
32
 
33
- new = new({ particle: :border })
33
+
34
+ new({ particle: :clean }) do |params|
35
+ cell = params[:cell]
36
+ row_nb = cell[0]
37
+ column_nb = cell[1]
38
+ data[row_nb][data[row_nb].keys[column_nb]] = "" # we remove the data from the cell
39
+ params
40
+ end
41
+
42
+ new({ particle: :insert }) do |params|
43
+ # cell
44
+ if params[:cell]
45
+ content = params[:content]
46
+ cell = params[:cell]
47
+ row_nb = cell[0]
48
+ column_nb = cell[1]
49
+ data[row_nb][data[row_nb].keys[column_nb]] = content # we remove the data from the cell
50
+ elsif params[:row]
51
+ position_to_insert = params[:row]
52
+ data.insert(position_to_insert, {})
53
+ elsif params[:column]
54
+ end
55
+
56
+ params
57
+ end
58
+
59
+ new({ particle: :remove }) do |params|
60
+
61
+ if params[:row]
62
+ data.delete_at(params[:row])
63
+
64
+ elsif params[:column]
65
+ column = params[:column]
66
+ data.map do |hash|
67
+ hash.delete(hash.keys[column]) if hash.keys[column]
68
+ hash
69
+ end
70
+ end
71
+ params
72
+ end
73
+
74
+
75
+ new({ particle: :sort }) do |params|
76
+ column = params[:column]
77
+ method = params[:method]
78
+
79
+ if column.nil? || method.nil?
80
+ puts "Column and method parameters are required."
81
+ return
82
+ end
83
+
84
+ @data.sort_by! do |row|
85
+ value = row.values[column - 1]
86
+ if value.instance_of? Atome
87
+ 0
88
+ else
89
+ case method
90
+ when :alphabetic
91
+ value.to_s
92
+ when :numeric
93
+ if value.is_a?(Numeric)
94
+ value
95
+ elsif value.respond_to?(:to_i)
96
+ value.to_i
97
+ else
98
+ 0
99
+ end
100
+ else
101
+ value
102
+ end
103
+ end
104
+ end
105
+
106
+ params
107
+ end
@@ -97,5 +97,7 @@ new({ particle: :layout }) do |params|
97
97
  end
98
98
  params
99
99
  end
100
+ new({particle: :center})
101
+
100
102
 
101
103
 
@@ -64,16 +64,18 @@ new({ particle: :delete, render: false }) do |params|
64
64
  end
65
65
  end
66
66
  new({ particle: :clear })
67
+
68
+
67
69
  new({ post: :clear }) do
68
- attached_found = []
69
- attached.each do |attached_id_found|
70
- attached_found << attached_id_found
71
- end
72
- attached_found.each do |child_id_found|
73
- child_found = grab(child_id_found)
74
- # we exclude system objects
75
- child_found&.delete(true) unless child_found.tag && child_found.tag[:system]
76
- end
70
+ attached_found = []
71
+ attached.each do |attached_id_found|
72
+ attached_found << attached_id_found
73
+ end
74
+ attached_found.each do |child_id_found|
75
+ child_found = grab(child_id_found)
76
+ # we exclude system objects
77
+ child_found&.delete(true) unless child_found.tag && child_found.tag[:system]
78
+ end
77
79
  end
78
80
  new({ particle: :path })
79
81
  new({ particle: :schedule }) do |date, proc|
@@ -192,9 +194,7 @@ new({ after: :duplicate }) do |params|
192
194
  end
193
195
 
194
196
  new({ particle: :copy }) do |items_id|
195
- unless items_id.instance_of? Array
196
- items_id = [items_id]
197
- end
197
+ items_id = [items_id] unless items_id.instance_of? Array
198
198
  grab(:copy).collect << items_id
199
199
  end
200
200
 
@@ -232,3 +232,17 @@ new({ particle: :backup })
232
232
 
233
233
  new({ particle: :import })
234
234
 
235
+ new({ particle: :compute }) do |params|
236
+ params = { particle: params } unless params.instance_of?(Hash)
237
+ params[:unit] ||= :pixel
238
+ params[:reference] ||= :view
239
+ params
240
+ end
241
+
242
+
243
+ new({ particle: :get }) do |params|
244
+ cell = params[:cell]
245
+ row_nb = cell[0]
246
+ column_nb = cell[1]
247
+ data[row_nb][data[row_nb].keys[column_nb]] # we get the content of the cell
248
+ end
@@ -16,7 +16,8 @@ module Essentials
16
16
  @default_params = {
17
17
  # Warning : type must be define first
18
18
  render_engines: [:html],
19
- image: { type: :image },
19
+ image: { type: :image, left: 0, top: 0},
20
+ matrix: { type: :matrix, left: 0, top: 0, option: {}},
20
21
  # FIXME : look at build_atome FIXME to resolve default parent attachment problem
21
22
  video: { type: :video },
22
23
  animation: { type: :animation, attach: :black_matter },
@@ -32,7 +33,7 @@ module Essentials
32
33
  shape: { type: :shape, width: 99, height: 99,
33
34
  apply: [:shape_color],
34
35
  left: 100, top: 100 },
35
- text: { type: :text, component: { size: 18 },
36
+ text: { type: :text, component: { size: 18 },left: 0, top: 0,
36
37
  apply: [:text_color],
37
38
  width: :auto, height: :auto },
38
39
  drm: { type: :drm, attach: :black_matter },
data/lib/atome/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  # return atome version
4
4
  class Atome
5
- VERSION = '0.5.5.8.1'
5
+ VERSION = '0.5.5.8.7'
6
6
  end
@@ -1,3 +1,2 @@
1
1
  # frozen_string_literal: true
2
2
 
3
-
@@ -4,7 +4,7 @@ new({ method: :width, type: :integer, renderer: :html }) do |value, _user_proc|
4
4
  unit_found = unit[:width]
5
5
  if unit_found
6
6
  html.style(:width, "#{value}#{unit_found}")
7
- elsif value.instance_of? Integer
7
+ elsif value.is_a?(Numeric)
8
8
  html.style(:width, "#{value}px")
9
9
  else
10
10
  html.style(:width, value)
@@ -15,16 +15,22 @@ new({ method: :height, renderer: :html, type: :string }) do |value, _user_proc|
15
15
  unit_found = unit[:height]
16
16
  if unit_found
17
17
  html.style(:height, "#{value}#{unit_found}")
18
- elsif value.instance_of? Integer
18
+ elsif value.is_a?(Numeric)
19
19
  html.style(:height, "#{value}px")
20
20
  else
21
21
  html.style(:height, value)
22
22
  end
23
23
  end
24
24
 
25
- new({ method: :size, type: :hash, renderer: :html }) do |value, _user_proc|
26
- # html.style('fontSize',"#{value}px")
27
- end
25
+ # new({ method: :size, type: :hash, renderer: :html }) do |value, _user_proc|
26
+ # # html.style('fontSize',"#{value}px")
27
+ # end
28
+ #
29
+ #
30
+ # new({ method: :size, type: :int, renderer: :html }) do |value, _user_proc|
31
+ # # html.style('fontSize', "#{value}px")
32
+ # end
33
+
28
34
 
29
35
  new({ method: :size, type: :int, renderer: :html, specific: :text }) do |value, _user_proc|
30
36
  html.style('fontSize', "#{value}px")