atome 0.5.7.0.3 → 0.5.7.0.4

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: ee4cbfd38de06ba3640f664d4de45324115580ecd7b9dd03d174cd9b008418ec
4
- data.tar.gz: 0bc8aef35a336616ddfb183608fc364d363abd03cc211eeb1127a0343b1cc1db
3
+ metadata.gz: 43a34334a41145533d60173178c7320ca20fea32690d6e26919f7dfa0553d2b0
4
+ data.tar.gz: 691dc70c3ed9c4849e5d6b597f879207528f1b88f58a948491d162e424e3091f
5
5
  SHA512:
6
- metadata.gz: 1340cb70b0212e385a616828f68c9e1684581874ef18c603f04dd40a800499352e603d404c6e91958f5b6a5933ba0583919ba2bde21d83b7bad68c1110c74a9e
7
- data.tar.gz: 210a6c03ce4d95f613e2d5af338b71dee8037cb6525b483afb2fc9b6080cf76f994dfa6ac6f8ce82ea20bdacbad982e994ea6c6a6a05707fdd22270947b19ce7
6
+ metadata.gz: 72e6d3ad87fc01564331b9c585c6021ab2075b56caf57946e974c3fdebbaa572e92db9edd23b97e014a691d3e000777715bbfc5223f8e8d9ad1230fdb788d6e5
7
+ data.tar.gz: 896f6f73134f274736317b1fd3a97e37aa1e0e89dc1dd26aa612363b7492136295747e379e154a319802d506f67ed17462da6b1bc5c9b8d5aefc4ef0f4207a5f
data/lib/atome/atome.rb CHANGED
@@ -51,14 +51,14 @@ class Atome
51
51
  @aid= new_atome[:aid] || identity_generator
52
52
  @controller_proc=[]
53
53
  @id = new_atome[:id] || @aid
54
- Universe.atomes.each do |_aid,atome_f|
54
+ Universe.atomes.each_value do |atome_f|
55
55
  # we affect the already existing atome to target
56
- if atome_f.id == @id
57
- new_atome[:affect].each do |affected|
58
- grab(affected).apply(@id)
59
- end
60
- return false
61
- end
56
+ next unless atome_f.id == @id
57
+
58
+ new_atome[:affect].each do |affected|
59
+ grab(affected).apply(@id)
60
+ end
61
+ return false
62
62
  end
63
63
  Universe.add_to_atomes(@aid, self)
64
64
  Universe.id_to_aid(@id, @aid)
@@ -160,9 +160,6 @@ class Object
160
160
  end
161
161
 
162
162
  def grab(id_to_get)
163
- if id_to_get.instance_of? Atome
164
- alert id_to_get.id
165
- end
166
163
  id_to_get=id_to_get.to_sym
167
164
  return if id_to_get == false
168
165
  aid_to_get= Universe.atomes_ids[id_to_get]
@@ -152,9 +152,7 @@ class Genesis
152
152
  # attached.each do |attached_atome|
153
153
  # collected_atomes << attached_atome if grab(attached_atome).type.to_sym == element.to_sym
154
154
  # end
155
- # TODO : add category for atome( material/physical vs modifier : color, shadow, .. vs shape, image ..)
156
- # then add condition same things fo code in presets/atome atome_common
157
- if %i[color shadow paint border].include?(element)
155
+ if Universe.applicable_atomes.include?(element)
158
156
  # we do the same for apply to be able to retrieve 'color' and other atome that apply instead of being attached
159
157
  @apply.each do |attached_atome|
160
158
  collected_atomes << attached_atome if grab(attached_atome).type.to_sym == element.to_sym
@@ -3,12 +3,12 @@
3
3
  new({ particle: :smooth, category: :effect, type: :int })
4
4
 
5
5
  new({ particle: :blur, category: :effect, type: :int }) do |params|
6
- if affect.nil?
7
- affect_to = affect
8
- else
9
- affect_to = [:self]
10
- end
11
- val= { value: params, affect: affect_to } unless params.instance_of?(Hash)
6
+ affect_to = if affect.nil?
7
+ affect
8
+ else
9
+ [:self]
10
+ end
11
+ val = { value: params, affect: affect_to } unless params.instance_of?(Hash)
12
12
  val
13
13
  end
14
14
 
@@ -64,14 +64,25 @@ end
64
64
 
65
65
  new(particle: :selected, category: :identity, type: :boolean) do |params|
66
66
  if params == true
67
- border({ thickness: 3, red: 1, green: 1, blue: 1, alpha: 1, pattern: :dotted })
68
- border({ thickness: 10, pattern: :solid, color: :red})
67
+ @selection_style=[]
68
+ select_style= border({ thickness: 3, red: 1, green: 1, blue: 1, alpha: 1, pattern: :dotted })
69
+ @selection_style << select_style.id
69
70
  grab(Universe.current_user).selection << @id
70
71
  elsif params == false
71
- border({alpha: 0, thickness: 0})
72
+ @selection_style.each do |style_f|
73
+ remove(style_f)
74
+ end
75
+ @selection_style=nil
72
76
  grab(Universe.current_user).selection.collect.delete(@id)
73
77
  else
74
- # TODO: for future use
78
+ @selection_style=[]
79
+ params.each do |part_f, val_f|
80
+ select_style= send(part_f,val_f)
81
+ @selection_style << select_style.id
82
+ end
83
+ # border({ thickness: 3, red: 1, green: 0, blue: 1, alpha: 1, pattern: :dotted })
84
+ # border({ thickness: 10, pattern: :solid, color: :red})
85
+ grab(Universe.current_user).selection << @id
75
86
  end
76
87
  params
77
88
  end
@@ -12,6 +12,8 @@ end
12
12
  new({ particle: :hide, category: :material, type: :boolean })
13
13
 
14
14
  new({ particle: :remove, category: :property, type: :hash }) do |params|
15
+
16
+
15
17
  if params.instance_of? Hash
16
18
  if params[:row]
17
19
  data.delete_at(params[:row])
@@ -25,6 +25,7 @@ def delete_recursive(atome_id)
25
25
  end
26
26
 
27
27
  new({ particle: :delete, category: :utility, type: :boolean, render: false }) do |params|
28
+
28
29
  if params == true
29
30
  # We use the tag persistent to exclude color of system object and other default colors
30
31
  unless @tag && (@tag[:persistent] || @tag[:system])
@@ -33,9 +34,19 @@ new({ particle: :delete, category: :utility, type: :boolean, render: false }) do
33
34
  render(:delete, params)
34
35
  # the machine delete the current atome from the universe
35
36
  id_found = @id.to_sym
36
- parent_found = grab(@attach)
37
- parent_found.attached.delete(id_found)
38
- Universe.delete(@aid)
37
+ if @attach
38
+ parent_found = grab(@attach)
39
+ parent_found.attached.delete(id_found)
40
+ end
41
+ if @affect
42
+ @affect.each do |affected_atome|
43
+ affected_found = grab(affected_atome)
44
+ affected_found.apply.delete(id_found)
45
+ affected_found.refresh
46
+ end
47
+ end
48
+
49
+ # Universe.delete(@aid)
39
50
  end
40
51
  elsif params.instance_of? Hash
41
52
 
@@ -64,6 +75,7 @@ new({ particle: :delete, category: :utility, type: :boolean, render: false }) do
64
75
  send(params, 0) unless params == :id
65
76
  end
66
77
  end
78
+
67
79
  new({ particle: :clear, category: :utility, type: :boolean })
68
80
 
69
81
  new({ post: :clear }) do
@@ -255,7 +267,6 @@ end
255
267
  new({ particle: :storage, category: :utility, type: :hash })
256
268
  new({ particle: :state, category: :utility, type: :symbol })
257
269
 
258
-
259
270
  new({ particle: :record, category: :utility, type: :hash })
260
271
  new({ particle: :preview, category: :utility, type: :hash })
261
272
 
@@ -27,12 +27,13 @@ class Universe
27
27
  @allow_tool_operations = false
28
28
  @active_tools = []
29
29
  @atome_preset = []
30
+ @applicable_atomes= %i[color shadow border paint animation]
30
31
  # @historicize=false
31
32
  class << self
32
33
  attr_reader :atomes, :atomes_ids, :renderer_list, :molecule_list, :atome_list, :particle_list, :classes, :counter,
33
34
  :atomes_specificities
34
35
  attr_accessor :connected, :allow_sync, :allow_localstorage, :database_ready, :edit_mode, :tools,
35
- :allow_tool_operations, :active_tools, :atome_preset
36
+ :allow_tool_operations, :active_tools, :atome_preset, :applicable_atomes
36
37
 
37
38
  def messages
38
39
  @messages
@@ -24,9 +24,7 @@ class Atome
24
24
  params = reordered_params.merge(params)
25
25
  params[:id]=params[:id].to_sym
26
26
  # condition to handle color/shadow/paint atomes that shouldn't be attach to view
27
- # TODO : add category for atome( material/physical vs modifier : color, shadow, .. vs shape, image ..)
28
- # then add condition same things fo code in genesis new_atome
29
- if %i[color shadow paint border].include?(atome_preset)
27
+ if Universe.applicable_atomes.include?(atome_preset)
30
28
  unless params[:affect]
31
29
  params[:affect] = if @id == :view
32
30
  [:black_matter]
@@ -113,8 +113,6 @@ class Atome
113
113
  target_vector.data(atome_content)
114
114
  end
115
115
 
116
-
117
-
118
116
  end
119
117
 
120
118
  @initialized = {}
@@ -165,9 +163,11 @@ class Atome
165
163
  end
166
164
 
167
165
  end
166
+
168
167
  def add_text_visual(params)
169
168
  html.add_font_to_css(params)
170
169
  end
170
+
171
171
  def particle_main(element, params, &user_proc)
172
172
  # TODO : optimise below removing all conditions if possible
173
173
  if Atome.instance_variable_get("@main_#{element}").is_a?(Proc) # post is before rendering and broadcasting
@@ -348,23 +348,22 @@ class Atome
348
348
  send("#{element}_callback", return_params)
349
349
  end
350
350
 
351
- def js_callback(id, particle, value,sub=nil )
352
- current_atome= grab(id)
353
- # # alert current_atome.instance_variable_get('@record_code')
354
- proc_found= current_atome.instance_variable_get("@#{particle}_code")[particle.to_sym]
351
+ def js_callback(id, particle, value, sub = nil)
352
+ current_atome = grab(id)
353
+ # # alert current_atome.instance_variable_get('@record_code')
354
+ proc_found = current_atome.instance_variable_get("@#{particle}_code")[particle.to_sym]
355
355
  # proc_found= current_atome.instance_variable_get("@record_code")[:record]
356
- # # alert particle.class
357
- # # alert proc_found.class
356
+ # # alert particle.class
357
+ # # alert proc_found.class
358
358
  # proc_found.call
359
- instance_exec(value, &proc_found) if proc_found.is_a?(Proc)
360
- # # # puts "params to be exec #{id}, #{particle}, #{value}, #{sub}"
361
- # alpha= grab(:the_big_box)
362
- # proc_found= alpha.instance_variable_get("@record_code")[:record]
359
+ instance_exec(value, &proc_found) if proc_found.is_a?(Proc)
360
+ # # # puts "params to be exec #{id}, #{particle}, #{value}, #{sub}"
361
+ # alpha= grab(:the_big_box)
362
+ # proc_found= alpha.instance_variable_get("@record_code")[:record]
363
363
  # proc_found.call
364
364
 
365
365
  end
366
366
 
367
-
368
367
  # def callback(data)
369
368
  # @callback[data.keys[0]] = data[data.keys[0]]
370
369
  # end
@@ -389,8 +388,7 @@ class Atome
389
388
  def particles_to_hash
390
389
  hash = {}
391
390
  instance_variables.each do |var|
392
- next if %i[@html_object @history, @initialized].include?(var)
393
-
391
+ next if %i[@html_object @history @initialized @tick @controller_proc].include?(var)
394
392
  hash[var.to_s.delete('@').to_sym] = instance_variable_get(var)
395
393
  end
396
394
  hash
@@ -400,10 +398,13 @@ class Atome
400
398
  # we get the current color because they will be removed
401
399
  particles_found = particles_to_hash
402
400
  particles_found.each do |particle_found, value_found|
401
+ puts "refresh : #{particle_found}, #{value_found}"
403
402
  send(particle_found, value_found)
404
403
  end
405
- color.each do |col|
406
- apply(col)
404
+ Universe.applicable_atomes.each do |atome_type|
405
+ send(atome_type).each do |col|
406
+ apply(col)
407
+ end
407
408
  end
408
409
  end
409
410
 
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.7.0.3'
5
+ VERSION = '0.5.7.0.4'
6
6
  end
@@ -6,6 +6,12 @@ end
6
6
 
7
7
  new({ method: :gradient, renderer: :html, type: :hash })
8
8
 
9
+ # new({ method: :remove, renderer: :html, type: :hash }) do |params|
10
+ # # alert "===> #{params}"
11
+ # # html.table_remove(params)
12
+ # html.remove(params)
13
+ # end
14
+
9
15
  new({ method: :remove, renderer: :html, type: :string }) do |object_id_to_remove, bloc|
10
16
 
11
17
  if object_id_to_remove.instance_of? Hash
@@ -39,6 +45,12 @@ new({ method: :remove, renderer: :html, type: :string }) do |object_id_to_remove
39
45
  html.style("filter", 'none')
40
46
  @apply.delete(object_id_to_remove)
41
47
  apply(@apply)
48
+ when :border
49
+ # alert :poipoipoipoipo
50
+ html.style("border", 'none')
51
+ # html.style("filter", 'none')
52
+ @apply.delete(object_id_to_remove)
53
+ apply(@apply)
42
54
  when :paint
43
55
  atome_to_remove = grab(object_id_to_remove)
44
56
  atome_to_remove.gradient.each do |color_id|
@@ -31,11 +31,7 @@ new({ method: :insert, renderer: :html, type: :hash }) do |params|
31
31
  html.table_insert(params)
32
32
  end
33
33
 
34
- new({ method: :remove, renderer: :html, type: :hash }) do |params|
35
- # alert "===> #{params}"
36
- # html.table_remove(params)
37
- html.remove(params)
38
- end
34
+
39
35
 
40
36
  new({ method: :sort, renderer: :html, type: :hash }) do |params|
41
37
  html.refresh_table(params)
@@ -3,12 +3,18 @@
3
3
 
4
4
 
5
5
 
6
-
7
-
8
-
9
6
  b=box({id: :my_b_box, left: 150, top: 150})
10
- b.border({ thickness: 15, red: 1, green: 1, blue: 0, alpha: 1, pattern: :solid ,id: :jjjj, inside: true})
11
-
7
+ b.shadow({
8
+ id: :s1,
9
+ # affect: [:the_circle],
10
+ left: 9, top: 3, blur: 9,
11
+ invert: false,
12
+ red: 0, green: 0, blue: 0, alpha: 1
13
+ })
14
+ border1= b.border({ thickness: 15, red: 1, green: 1, blue: 0, alpha: 1, pattern: :solid ,id: :border_1, inside: true})
15
+ wait 2 do
16
+ b.remove(:border_1)
17
+ end
12
18
  wait 1.5 do
13
19
  border({ thickness: 30, red: 1, green: 1, blue: 0, alpha: 1, pattern: :solid ,id: :poil, inside: true})
14
20
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # add new font face
4
- A.add_text_visual({ path: 'Roboto', name: 'Roboto-Thin' })
4
+ A.add_text_visual({ path: 'Roboto', name: 'Roboto-Black' })
5
5
  A.add_text_visual({ path: 'Roboto', name: 'Roboto-Thin' })
6
6
  A.add_text_visual({ path: 'Roboto', name: 'Roboto-LightItalic' })
7
7
 
@@ -9,6 +9,7 @@ b.instance_variable_set("@path", './medias/images/red_planet.png' )
9
9
 
10
10
  b.instance_variable_set("@smooth", 30)
11
11
  wait 1 do
12
+ # alert b.inspect
12
13
  b.refresh
13
14
  b.instance_variable_set("@left", 300)
14
15
  wait 1 do
@@ -1,8 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # grab(:a_styles).data
3
4
  t = text({ data: 'touch me to select all', id: :the_text })
4
5
  b = box({ left: 12, id: :the_box })
5
- circle({ left: 230, id: :the_circle })
6
+ c = circle({ left: 230, id: :the_circle })
7
+ c.color(:green)
8
+ # c.touch(true) do
9
+ # if c.selected
10
+ # c.selected(false)
11
+ # else
12
+ # # example of custom selection style
13
+ # c.selected({ shadow: {
14
+ # left: 9, top: 3, blur: 9,
15
+ # invert: false,
16
+ # red: 0, green: 0, blue: 0, alpha: 1
17
+ # }, border: { thickness: 5, red: 1, green: 1, blue: 1, alpha: 1, pattern: :dotted, id: :the_door,inside: true } })
18
+ # end
19
+ # end
6
20
  image({ path: 'medias/images/red_planet.png', id: :the__red_planet, top: 233 })
7
21
 
8
22
  t.touch(true) do
@@ -16,9 +30,9 @@ t.touch(true) do
16
30
  selected_items = grab(Universe.current_user).selection # we create a group
17
31
 
18
32
  selected_items.each do |atome_id_selected|
19
- atome_selected=grab(atome_id_selected)
20
- atome_selected.width=rand(333)
21
- atome_selected.height=rand(333)
33
+ atome_selected = grab(atome_id_selected)
34
+ atome_selected.width = rand(333)
35
+ atome_selected.height = rand(333)
22
36
 
23
37
  end
24
38
  b.selected(false)
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  c = circle({ id: :the_circle, left: 122, color: :orange, drag: { move: true, inertia: true, lock: :start } })
4
- c.color({ id: :col1, red: 1, blue: 1 })
4
+ c.color({ id: :col1, red: 1, blue: 1 })
5
5
 
6
6
  c.shadow({
7
7
  id: :s1,
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.7.0.3
4
+ version: 0.5.7.0.4
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-04-24 00:00:00.000000000 Z
11
+ date: 2024-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: artoo