atome 0.5.6.4.2 → 0.5.6.4.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35961446f6b4a9138da14f96d5cba19b9b2ebd01c4ca9423eabb9150f2309ae4
4
- data.tar.gz: 3bd19bdfde305d0e3b8c2d75f262edd901041ba1a940317c6a9a35867206cb55
3
+ metadata.gz: dc73dbaea0b164408d4656f53afb29c6f207d7a3a9238d7e0f017fee5d99c76a
4
+ data.tar.gz: 97860122c2abfec80d74880bd80e24d3c4fb2bab39661aaf3d97e7d6bc1528b3
5
5
  SHA512:
6
- metadata.gz: f465c190d30eb202a38af8e00957899b8aa912a0e4ff864e6ab45ae42bf6f44fac8c24a820cbbc2d9661adaf9e2593fbd24092b59bdece0883f29f7d0c5fe259
7
- data.tar.gz: fa33709f899aa5e50611ce840fc56b8ffc9f4fc0f34342387e202fd1def7c5c45e9ef8bec2df728feadcfa2b717344683e7dfad22bc6cd116b0ee12e5ff44ce7
6
+ metadata.gz: bd5524c4909dd4c276c9af722af86b5eaa1505f82ff6503737a5cd6e50e62009bb8be7e7cd82db7e482e7f18e7beb7e1339c2728fbb211f96060b60143f3e136
7
+ data.tar.gz: b485ea4522218c293c36f92e79caeb22fb9233e6146cbeb7271d9b328e2be809a86268871338bc49b4ba105352878f3d4ea99361cb7d41b122b46e37e2bb4fac
data/Rakefile CHANGED
@@ -183,17 +183,17 @@ task :test_server_wasm do
183
183
  threads << Thread.new do
184
184
 
185
185
  sleep 1
186
+ timestamp=Time.now.strftime("%Y%m%d%H%M%S")
186
187
  if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
187
188
  # code to exec for Windows
188
- `start http://localhost:9292`
189
+ `start http://localhost:9292?date=#{timestamp}`
189
190
  # `start #{destination}\\#{project_name}\\src\\index_server.html`
190
-
191
191
  elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
192
192
  # code to exec for MacOS
193
- `open http://localhost:9292`
193
+ `open http://localhost:9292?date=#{timestamp}`
194
194
  else
195
195
  # code to exec for Unix/Linux
196
- `open http://localhost:9292`
196
+ `open http://localhost:9292?date=#{timestamp}`
197
197
  end
198
198
 
199
199
  end
@@ -225,17 +225,19 @@ task :test_server do
225
225
  threads << Thread.new do
226
226
 
227
227
  sleep 1
228
+ timestamp=Time.now.strftime("%Y%m%d%H%M%S")
229
+
228
230
  if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
229
231
  # code to exec for Windows
230
- `start http://localhost:9292`
232
+ `start http://localhost:9292?date=#{timestamp}`
231
233
  # `start #{destination}\\#{project_name}\\src\\index_server.html`
232
234
 
233
235
  elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
234
236
  # code to exec for MacOS
235
- `open http://localhost:9292`
237
+ `open http://localhost:9292?date=#{timestamp}`
236
238
  else
237
239
  # code to exec for Unix/Linux
238
- `open http://localhost:9292`
240
+ `open http://localhost:9292?date=#{timestamp}`
239
241
  end
240
242
 
241
243
  end
@@ -268,17 +270,18 @@ task :opal_server_rebuild do
268
270
  threads << Thread.new do
269
271
 
270
272
  sleep 1
273
+ timestamp=Time.now.strftime("%Y%m%d%H%M%S")
271
274
  if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
272
275
  # code to exec for Windows
273
- `start http://localhost:9292`
276
+ `start http://localhost:9292?date=#{timestamp}`
274
277
  # `start #{destination}\\#{project_name}\\src\\index_server.html`
275
278
 
276
279
  elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
277
280
  # code to exec for MacOS
278
- `open http://localhost:9292`
281
+ `open http://localhost:9292?date=#{timestamp}`
279
282
  else
280
283
  # code to exec for Unix/Linux
281
- `open http://localhost:9292`
284
+ `open http://localhost:9292?date=#{timestamp}`
282
285
  end
283
286
 
284
287
  end
@@ -372,6 +375,10 @@ end
372
375
 
373
376
  def gem_builder
374
377
  # building the gem
378
+ dossier = './pkg'
379
+
380
+ # we cleanup pkg folder content
381
+ FileUtils.rm_rf(Dir.glob("#{dossier}/*"))
375
382
  `rake build` # run build_app thru ARGV in exe atome
376
383
  # installing the gem
377
384
  if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
data/exe/atome CHANGED
@@ -826,16 +826,18 @@ else
826
826
  if ARGV.include?('server_refresh')
827
827
  puts 're building Server'
828
828
  build_opal_application(nil, destination, project_name)
829
+ timestamp=Time.now.strftime("%Y%m%d%H%M%S")
830
+
829
831
  if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
830
832
  # code to exec with Windows
831
833
  # `start #{destination}\\#{project_name}\\src\\index_server.html`
832
- `start http://localhost:9292`
834
+ `start http://localhost:9292?date=#{timestamp}`
833
835
  elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
834
836
  # code to exec with MacOS
835
- `open http://localhost:9292`
837
+ `open http://localhost:9292?date=#{timestamp}`
836
838
  else
837
839
  # code to exec with Unix/Linux
838
- `open http://localhost:9292`
840
+ `open http://localhost:9292?date=#{timestamp}`
839
841
  end
840
842
  end
841
843
 
data/lib/atome/atome.rb CHANGED
@@ -29,7 +29,8 @@ class Atome
29
29
  @tag = {}
30
30
  @selected = false
31
31
  #@metrics = {}
32
- @unit = {}
32
+ @unit = {}
33
+ @apply = []
33
34
  @collect = {}
34
35
  @collect = {}
35
36
  @int8= {}
@@ -111,8 +111,8 @@ class Object
111
111
  ordered_part = ordered_keys.map { |k| [k, hash_to_reorder[k]] }.to_h
112
112
  other_part = hash_to_reorder.reject { |k, _| ordered_keys.include?(k) }
113
113
  # merge the parts to obtain an re-ordered hash
114
- reordered_hash = ordered_part.merge(other_part)
115
- reordered_hash
114
+ ordered_part.merge(other_part)
115
+ # reordered_hash
116
116
  end
117
117
 
118
118
  def delete (atomes)
@@ -120,8 +120,7 @@ class Object
120
120
  end
121
121
 
122
122
  def identity_generator
123
-
124
- "#{Universe.app_identity}_#{Universe.counter}".to_sym
123
+ "a_#{Universe.app_identity}_#{Universe.counter}".to_sym
125
124
  end
126
125
 
127
126
  def hook(a_id)
@@ -69,10 +69,23 @@ new({ sanitizer: :video }) do |params|
69
69
  end
70
70
  new({ atome: :www })
71
71
  new({ atome: :shadow }) do |params|
72
+ # if params
73
+ # if params.delete(:affect)
74
+ # attach_value = params.delete(:affect)
75
+ # else
76
+ # attach_value=id
77
+ # end
78
+ #
79
+ # params[:affect] = attach_value
80
+ # alert "=> params : #{params}"
81
+ #
82
+ # end
83
+
72
84
  if params
73
85
  attach_value = params.delete(:affect)
74
86
  params[:affect] = attach_value
75
87
  end
88
+ # alert "=> params : #{params}"
76
89
  params
77
90
  end
78
91
  new({ atome: :raw })
@@ -100,7 +100,7 @@ class Genesis
100
100
 
101
101
  # we historicize all write action below
102
102
  # we add the changes to the stack that must be synchronised
103
- Universe.historicize(@id, :write, element, params)
103
+ Universe.historicize(@aid, :write, element, params)
104
104
  computed_params
105
105
  elsif params || params == false
106
106
  "send a valid password to write #{element} value"
@@ -152,14 +152,17 @@ class Genesis
152
152
  # then add condition same things fo code in presets/atome atome_common
153
153
  if %i[color shadow paint].include?(element)
154
154
  # we do the same for apply to be able to retrieve 'color' and other atome that apply instead of being attached
155
- apply.each do |attached_atome|
155
+ @apply.each do |attached_atome|
156
156
  collected_atomes << attached_atome if grab(attached_atome).type.to_sym == element.to_sym
157
157
  end
158
158
  else
159
159
  # collected_atomes = attached
160
- attached.each do |attached_atome|
161
- collected_atomes << attached_atome if grab(attached_atome).type.to_sym == element.to_sym
162
- end
160
+ # if @attached
161
+ attached.each do |attached_atome|
162
+ collected_atomes << attached_atome if grab(attached_atome).type.to_sym == element.to_sym
163
+ end
164
+ # end
165
+
163
166
  end
164
167
  # TODO/ FIXME : potential problem with group here"
165
168
  # group({ collect: collected_atomes })
@@ -82,18 +82,14 @@ end
82
82
  new({ particle: :affect, category: :hierarchy, type: :string, render: false }) do |children_ids, &user_proc|
83
83
  children_ids = [children_ids] unless children_ids.instance_of? Array
84
84
  children_ids.each do |child_id|
85
- # params[:affect].each do |affected|
86
- # end
87
-
88
85
  child_found = grab(child_id)
89
- # alert "must exist : #{child_found.id}"
90
- # puts "correct condition below #{id}"
91
- #FIXME : found why it crash when removing the conditon below
86
+ #FIXME : found why it crash when removing the condition below
92
87
  unless child_found.id == :black_matter
93
88
  child_found.remove({all: :paint})
94
89
  end
95
- child_found&.apply([id], &user_proc)
90
+ child_found.apply([id], &user_proc)
96
91
  end
92
+
97
93
  children_ids
98
94
  end
99
95
 
@@ -26,8 +26,52 @@ new ({ sanitizer: :password }) do |params|
26
26
  end
27
27
 
28
28
  new({ read: :password }) do |params|
29
- params = Black_matter.password if params.nil?
30
- params[:read][:atome] = Black_matter.password[:read][:atome] unless @authorisations[:write][:atome]
31
- params[:write][:atome] = Black_matter.password[:write][:atome] unless @authorisations[:write][:atome]
29
+ # TODO : check if we have to reactive the lines below
30
+ # params = Black_matter.password if params.nil?
31
+ # params[:read][:atome] = Black_matter.password[:read][:atome] unless @authorisations[:write][:atome]
32
+ # params[:write][:atome] = Black_matter.password[:write][:atome] unless @authorisations[:write][:atome]
33
+
32
34
  params
33
35
  end
36
+
37
+ # def get_all_local_storage_items
38
+ # Création d'un hash pour stocker les paires clé/valeur de localStorage
39
+ storage_items = {}
40
+
41
+ # Obtention du nombre d'éléments dans le localStorage
42
+ # storage= JS.global[:localStorage]
43
+ # # storage=storage.to_s
44
+ # storage_array= storage.to_a
45
+ # # alert storage_array.length
46
+ # storage_items={}
47
+ # storage_array.each_with_index do |_i, index|
48
+ # key = JS.global[:localStorage].key(index)
49
+ # #
50
+ # # # Récupération de la valeur associée à cette clé
51
+ # value = JS.global[:localStorage].getItem(key)
52
+ # #
53
+ # # # Stockage de la paire clé/valeur dans le hash
54
+ # storage_items[key] = value
55
+ # end
56
+ # puts storage_items
57
+
58
+ # alert Native(storage_length).class
59
+ # Itération sur tous les éléments de localStorage
60
+ # (0...storage_length).each do |i|
61
+ # # Récupération de la clé pour l'élément actuel
62
+ # key = JS.global[:localStorage].key(i)
63
+ #
64
+ # # Récupération de la valeur associée à cette clé
65
+ # value = JS.global[:localStorage].getItem(key)
66
+ #
67
+ # # Stockage de la paire clé/valeur dans le hash
68
+ # storage_items[key] = value
69
+ # end
70
+ #
71
+ # # Retour du hash contenant toutes les paires clé/valeur de localStorage
72
+ # storage_items
73
+ # end
74
+ #
75
+ # # Appel de la fonction pour récupérer et afficher le contenu de localStorage
76
+ # all_items = get_all_local_storage_items
77
+ # puts all_items
@@ -3,7 +3,6 @@
3
3
  # now let's get the default render engine
4
4
 
5
5
  # Lets create the U.I.
6
-
7
6
  default_render = Essentials.default_params[:render_engines]
8
7
  Atome.new(
9
8
  { renderers: [], id: :eDen, type: :element, tag: { system: true } }
@@ -90,7 +89,8 @@ Atome.new({ renderers: default_render, id: machine_id, type: :machine, password:
90
89
  # user
91
90
  user_password = { global: :star_win, read: { atome: :star_wars }, write: { atome: :star_wars } }
92
91
 
93
- human({ id: :anonymous, login: true, password: user_password, data: { birthday: '10/05/1996' }, selection: [], attach: :user_view })
92
+ # human({ id: :anonymous, login: true, password: user_password, data: { birthday: '10/05/1996' }, selection: [], attach: :user_view })
93
+ human({ id: identity_generator, login: true, password: user_password, data: { birthday: '10/05/1996' }, selection: [], attach: :user_view })
94
94
 
95
95
  Universe.current_machine = machine_id
96
96
  # the constant A is used to access alla atomes methods
@@ -146,7 +146,7 @@ def atome_genesis
146
146
  end
147
147
  end
148
148
 
149
- def init_database # this method is call from JS (atome/communication)
149
+ def init_database # this method is call from JS (atome/communication) at WS connection
150
150
  # we init the db file eDen
151
151
  A.message({ action: :init_db, data: { database: :eDen } }) do |_db_state|
152
152
  end
@@ -184,6 +184,11 @@ def init_database # this method is call from JS (atome/communication)
184
184
  end
185
185
  end
186
186
 
187
+ # now we send localstorage content to the server
188
+ puts "now we send localstorage send_localstorage_content to the server"
189
+ send_localstorage_content
190
+ # A.message({ action: :localstorage, data: get_localstorage_content }) do |_db_state|
191
+ # end
187
192
  end
188
193
 
189
194
  def user_login
@@ -193,6 +198,7 @@ def user_login
193
198
  puts "email received : #{email}"
194
199
  end
195
200
  message({ action: :authorization, data: { password: password } }) do |pass|
196
- puts "password recieved : #{pass}"
201
+ puts "password received : #{pass}"
197
202
  end
198
203
  end
204
+ # Universe.allow_history=true
@@ -6,6 +6,7 @@ require 'json'
6
6
  class Atome
7
7
  class << self
8
8
 
9
+
9
10
  def file_handler(parent, content, bloc)
10
11
  grab(parent).instance_exec(content, &bloc)
11
12
  end
@@ -398,6 +399,56 @@ class Atome
398
399
  # Digest::SHA256.hexdigest(string)
399
400
  # end
400
401
  end
402
+ def get_localstorage_content
403
+ storage= JS.global[:localStorage]
404
+ storage_array= storage.to_a
405
+ storage_items={}
406
+ storage_array.each_with_index do |_i, index|
407
+ key = JS.global[:localStorage].key(index)
408
+ value = JS.global[:localStorage].getItem(key)
409
+ storage_items[key] = value
410
+ end
411
+ storage_items
412
+ end
413
+
414
+ def sanitize_data_for_json(data)
415
+ data=data.gsub('"', '\\"')
416
+ # case data
417
+ # when String
418
+ # data.gsub('"', '\\"')
419
+ # when Hash
420
+ # data.transform_values { |value| sanitize_data(value) }
421
+ # when Array
422
+ # data.map { |value| sanitize_data(value) }
423
+ # else
424
+ # data
425
+ # end
426
+ data
427
+ end
428
+
429
+ def send_localstorage_content
430
+ storage= JS.global[:localStorage]
431
+ storage_array= storage.to_a
432
+ # storage_items={}
433
+ storage_array.each_with_index do |_i, index|
434
+ key = JS.global[:localStorage].key(index)
435
+ value = sanitize_data_for_json(JS.global[:localStorage].getItem(key))
436
+ # storage_items[key] = value
437
+ # puts key
438
+ # puts value
439
+ # A.message({ action: :localstorage, data: {key => value} }) do |_db_state|
440
+ # # puts _db_state
441
+ # end
442
+ end
443
+ # A.message({ action: :end_localstorage, data: '' }) do |_db_state|
444
+ # puts _db_state
445
+ # end
446
+ end
447
+
448
+ def to_sym
449
+ puts "sanitizer temp patch when an atome is passed instead of an id"
450
+ @id
451
+ end
401
452
  end
402
453
 
403
454
 
@@ -11,17 +11,18 @@ class Universe
11
11
  @sanitizers = {}
12
12
  @specificities = {}
13
13
  @messages = {}
14
-
14
+ @increment=0
15
15
  @categories = %w[atome communication effect event geometry hierarchy identity material
16
16
  property security spatial time utility ]
17
17
  @history = {}
18
18
  @users = {}
19
19
  @help = {}
20
20
  @example = {}
21
-
21
+ @allow_history= false
22
+ # @historicize=false
22
23
  class << self
23
24
  attr_reader :atomes,:atomes_ids, :renderer_list, :atome_list, :particle_list, :classes, :counter, :atomes_specificities
24
-
25
+ attr_accessor :allow_history
25
26
  def messages
26
27
  @messages
27
28
  end
@@ -236,7 +237,13 @@ class Universe
236
237
  end
237
238
 
238
239
  def historicize(id, operation, element, params)
239
- @history[@history.length] = { id => { operation => { element => params } }, sync: false, time: Time.now }
240
+ if @allow_history
241
+ operation_timing= Time.now.strftime("%Y%m%d%H%M%S%3N")+@increment.to_s
242
+ @increment+=1
243
+ @increment=@increment%100
244
+ JS.global[:localStorage].setItem(operation_timing,"{ #{id} => { #{operation} => { #{element} => #{params} } }, sync: false }")
245
+ @history[@history.length] = { operation_timing => { id => { operation => { element => params } }, sync: false, time: Time.now } }
246
+ end
240
247
  end
241
248
 
242
249
  def story(filter)
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.6.4.2'
5
+ VERSION = '0.5.6.4.8'
6
6
  end
@@ -21,7 +21,7 @@ new({ renderer: :html, method: :smooth, type: :string }) do |value, _user_proc|
21
21
  end
22
22
 
23
23
  new({ renderer: :html, method: :blur, type: :integer }) do |params, _user_proc|
24
- if params[:affect] == :back
24
+ if params[:affect] == :back || params[:affect] == :back
25
25
  html.backdropFilter(:blur, "#{params[:value]}px")
26
26
  else
27
27
  html.filter(:blur, "#{params[:value]}px")
@@ -93,7 +93,7 @@ new({ renderer: :html, method: :apply, type: :string, specific: :text }) do |par
93
93
  alpha = shadow_found.alpha
94
94
  left = shadow_found.left
95
95
  top = shadow_found.top
96
- blur = shadow_found.blur
96
+ blur = shadow_found.blur[:value] # new correct behavior all atome's value should now be get using :value,here to resolve conflict with blur and back blur
97
97
  inset = :inset if shadow_found.invert
98
98
  if shadow_found.option == :natural
99
99
  shadows_to_apply[:filter] << "drop-shadow(#{left}px #{top}px #{blur}px rgba(#{red}, #{green}, #{blue}, #{alpha}))"
@@ -1450,21 +1450,24 @@ class HTML
1450
1450
  when :all
1451
1451
  case v
1452
1452
  when :paint
1453
- style(:background, 'black')
1453
+ style(:background, 'none')
1454
1454
  # style('box-shadow', 'none')
1455
1455
  # style('text-shadow', 'none')
1456
1456
  when :color
1457
1457
  when :shadow
1458
1458
  style('box-shadow', 'none')
1459
1459
  style('text-shadow', 'none')
1460
+ style("filter", 'none')
1460
1461
  end
1461
1462
  end
1462
1463
  end
1463
1464
  else
1464
1465
  @original_atome.apply.delete(params)
1465
- style(:background, 'black')
1466
+ style(:background, 'none')
1466
1467
  style('box-shadow', 'none')
1467
1468
  style('text-shadow', 'none')
1469
+ style("boxShadow", 'none')
1470
+ style("filter", 'none')
1468
1471
  @original_atome.apply(@original_atome.apply)
1469
1472
  end
1470
1473
  # alert "remove : #{params} , type: #{@original_atome.type}"
@@ -1,6 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ b=circle({left: 333})
4
+ b.blur(6)
3
5
 
6
+ image(:red_planet)
7
+ b2=box({color: {alpha: 0.1, red: 1, green: 0, blue: 0.2}, left: 99, top: 99, width: 99, height: 99})
8
+ b2.drag(true)
9
+ b2.border({ thickness: 0.3, color: :gray, pattern: :solid })
10
+ b2.smooth(12)
11
+ b2.shadow({
12
+ invert: true,
13
+ id: :s4,
14
+ left: 2, top: 2, blur: 9,
15
+ # option: :natural,
16
+ red: 0, green: 0, blue: 0, alpha: 0.3
17
+ })
4
18
 
5
- b=circle
6
- b.blur(20)
19
+ b2.shadow({
20
+ # invert: true,
21
+ id: :s5,
22
+ left: 2, top: 2, blur: 9,
23
+ # option: :natural,
24
+ red: 0, green: 0, blue: 0, alpha: 0.6
25
+ })
26
+ b2.blur({affect: :back, value: 15})
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # see import for drag and drop import
3
4
  b = box({ drag: true })
4
5
  b.import(true) do |content|
5
6
  puts "add code here, content: #{content}"
@@ -36,4 +36,5 @@ the_text.left(333)
36
36
 
37
37
  the_text.paint({ gradient: [col_1.id, col_2.id], direction: :left , id: :painted_love })
38
38
 
39
+ # #TODO : gradient on text!
39
40
 
@@ -0,0 +1,145 @@
1
+ # frozen_string_literal: true
2
+
3
+ @current_matrix = ""
4
+
5
+ def matrix(id, horizontal_nb, vertical_nb, spacing, size)
6
+ view = grab(:view)
7
+ @current_matrix = group({ id: id })
8
+ @current_matrix.data({ spacing: spacing, size: size })
9
+ matrix_cells = []
10
+ total_spacing_x = spacing * (horizontal_nb + 1)
11
+ total_spacing_y = spacing * (vertical_nb + 1)
12
+ size_coefficient = size.end_with?('%') ? (size.to_f / 100) : size.to_f / view.to_px(:width)
13
+
14
+ view_width = view.to_px(:width)
15
+ view_height = view.to_px(:height)
16
+ if view_width > view_height
17
+ available_width = (view_height * size_coefficient) - total_spacing_x
18
+ available_height = (view_height * size_coefficient) - total_spacing_y
19
+ else
20
+ available_width = (view_width * size_coefficient) - total_spacing_x
21
+ available_height = (view_width * size_coefficient) - total_spacing_y
22
+ end
23
+ box_width = available_width / horizontal_nb
24
+ box_height = available_height / vertical_nb
25
+
26
+ vertical_nb.times do |y|
27
+ horizontal_nb.times do |x|
28
+ id_generated = "#{id}_#{x}_#{y}"
29
+ matrix_cells << id_generated
30
+ new_box = box({ id: id_generated })
31
+ new_box.width(box_width)
32
+ new_box.height(box_height)
33
+ new_box.left((box_width + spacing) * x + spacing)
34
+ new_box.top((box_height + spacing) * y + spacing)
35
+ end
36
+ end
37
+ @current_matrix.collect(matrix_cells)
38
+ end
39
+
40
+ matrix(:vie_0, 8, 8, 9, '69%')
41
+
42
+ def resize_matrix(current_matrix, new_width, new_height, spacing, size)
43
+ # matrix_group = grab(matrix_id)
44
+ total_spacing_x = spacing * (current_matrix.collect.length ** (0.5) + 1)
45
+ total_spacing_y = spacing * (current_matrix.collect.length ** (0.5) + 1)
46
+ size_coefficient = size.end_with?('%') ? (size.to_f / 100) : size.to_f / new_width
47
+
48
+ if new_width > new_height
49
+ available_width = (new_height * size_coefficient) - total_spacing_x
50
+ available_height = (new_height * size_coefficient) - total_spacing_y
51
+ else
52
+ available_width = (new_width * size_coefficient) - total_spacing_x
53
+ available_height = (new_width * size_coefficient) - total_spacing_y
54
+ end
55
+
56
+ box_width = available_width / current_matrix.collect.length ** (0.5)
57
+ box_height = available_height / current_matrix.collect.length ** (0.5)
58
+ current_matrix.collect.each_with_index do |box_id, index|
59
+ box = grab(box_id)
60
+ box.width(box_width)
61
+ box.height(box_height)
62
+ box.left((box_width + spacing) * (index % current_matrix.collect.length ** (0.5)) + spacing)
63
+ box.top((box_height + spacing) * (index / current_matrix.collect.length ** (0.5)).floor + spacing)
64
+ end
65
+ end
66
+
67
+ grab(:view).on(:resize) do |event|
68
+ new_event = Native(event)
69
+ new_width = new_event[:width].to_f
70
+ new_height = new_event[:height].to_f
71
+ matrix_spacing = @current_matrix.data[:spacing]
72
+ matrix_size = @current_matrix.data[:size]
73
+ resize_matrix(@current_matrix, new_width, new_height, matrix_spacing, matrix_size)
74
+ end
75
+ # alert grab(:vie_0).data
76
+ # wait 2 do
77
+
78
+ @current_matrix.color(:blue)
79
+ @current_matrix.smooth(6)
80
+ @current_matrix.shadow({
81
+ id: :s1,
82
+ # affect: [:the_circle],
83
+ left: 3, top: 3, blur: 6,
84
+ invert: false,
85
+ red: 0, green: 0, blue: 0, alpha: 0.6
86
+ })
87
+ ###################
88
+ col_1 = color(:yellow)
89
+ col_2 = color({ red: 1, id: :red_col })
90
+
91
+
92
+ # @current_matrix.paint({ gradient: [col_1.id, col_2.id], direction: :left })
93
+ @current_matrix.paint({ gradient: [col_1.id, col_2.id], direction: :top })
94
+
95
+
96
+ ###################
97
+
98
+
99
+ test_cell = grab(:vie_0_2_3)
100
+ wait 1 do
101
+ test_cell.color(:red)
102
+ end
103
+
104
+
105
+ module Molecule
106
+
107
+ def states(val = nil)
108
+ if val
109
+ else
110
+ end
111
+
112
+ end
113
+
114
+
115
+ def alternate(states = nil)
116
+ if states
117
+
118
+ else
119
+ @alternate
120
+ end
121
+
122
+ end
123
+ end
124
+ c= circle({left: 399})
125
+ test_cell.touch(true) do
126
+ test_cell.alternate([{ width: 33, color: :red }, { width: 66, color: :orange }])
127
+ # puts "=> #{Universe.atomes.length}"
128
+ # puts test_cell.color
129
+ # if test_cell.data==true
130
+ # test_cell.data(false)
131
+ # col_1 = color(:black)
132
+
133
+ @current_matrix.paint({ gradient: [col_1.id, col_1.id], direction: :top })
134
+ other_col=test_cell.color(:white)
135
+ c.paint({ gradient: [col_1, col_2], direction: :left })
136
+ test_cell.paint({ gradient: [col_1, other_col], direction: :left })
137
+ # test_cell
138
+ # grab(:red_col).delete(true)
139
+ # test_cell.color(:green)
140
+ # else
141
+ # test_cell.data(true)
142
+ # test_cell.color(:blue)
143
+ # end
144
+
145
+ end
@@ -34,14 +34,17 @@ wait 2 do
34
34
  end
35
35
 
36
36
 
37
- the_text = text({ data: 'hello for al the people in front of their machine', center: true, top: 222, width: 777, component: { size: 66 } })
38
-
37
+ the_text = text({ data: 'text with shadow!', center: true, top: 222, width: 777, component: { size: 66 } })
39
38
 
40
39
 
41
40
  the_text.shadow({
42
- id: :s4,
43
- left: 20, top: 0, blur: 9,
41
+ id: :my_shadow,
42
+ left: 6, top: 6, blur: 6,
44
43
  option: :natural,
45
- red: 0, green: 1, blue: 0, alpha: 1
44
+ red: 0, green: 0, blue: 0, alpha: 1
46
45
  })
47
46
 
47
+ the_text.left(255)
48
+ the_text.top(66)
49
+ the_text.color(:red)
50
+
@@ -78,6 +78,13 @@ class EDen
78
78
  end
79
79
  end
80
80
 
81
+ def localstorage(data, message_id)
82
+ # return test
83
+ # ws.send(return_message.to_json)
84
+ return { return: 'localstorage content received', authorized: true, message_id: message_id }
85
+
86
+ end
87
+
81
88
  def init_db(_data, message_id)
82
89
  unless File.exist?("eden.sqlite3")
83
90
  Sequel.connect("sqlite://eden.sqlite3")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6.4.2
4
+ version: 0.5.6.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean-Eric Godard
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-29 00:00:00.000000000 Z
11
+ date: 2024-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: artoo
@@ -575,6 +575,7 @@ files:
575
575
  - vendor/assets/application/examples/login.rb
576
576
  - vendor/assets/application/examples/markup.rb
577
577
  - vendor/assets/application/examples/match.rb
578
+ - vendor/assets/application/examples/matrix.rb
578
579
  - vendor/assets/application/examples/monitor.rb
579
580
  - vendor/assets/application/examples/on_resize.rb
580
581
  - vendor/assets/application/examples/on_the_fly_ruby_code_loading.rb