atome 0.5.7.0.3 → 0.5.7.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/atome/atome.rb +7 -7
- data/lib/atome/extensions/atome.rb +0 -3
- data/lib/atome/genesis/genesis.rb +1 -3
- data/lib/atome/genesis/particles/effect.rb +6 -6
- data/lib/atome/genesis/particles/identity.rb +18 -5
- data/lib/atome/genesis/particles/material.rb +15 -17
- data/lib/atome/genesis/particles/utility.rb +12 -4
- data/lib/atome/kernel/universe.rb +3 -1
- data/lib/atome/presets/atome.rb +1 -3
- data/lib/atome/utilities/utilities.rb +18 -17
- data/lib/atome/version.rb +1 -1
- data/lib/renderers/html/material.rb +13 -1
- data/lib/renderers/html/property.rb +1 -5
- data/vendor/assets/application/examples/border.rb +11 -5
- data/vendor/assets/application/examples/fonts.rb +1 -1
- data/vendor/assets/application/examples/refresh.rb +6 -6
- data/vendor/assets/application/examples/selected.rb +24 -4
- data/vendor/assets/application/examples/shadow.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23166944704e42b25801cc052708c19f265c1f8247dd3ff9b099944ecb415401
|
4
|
+
data.tar.gz: 38a31b2cdcc6ceeef5453b926ee4d7eaf704e48c58039830126a94b5a430c188
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86db3598d96617483482c8e97006bf3fe2e981be529cd871e75b7370b55838002914192c64dcb4b46cf72313f470a91a9ff3f2408fa5914439b84126c924cd44
|
7
|
+
data.tar.gz: 655b083c5529f5ed4c642ee5c7457d2940062914433e072a582964ae1e7a4932423731b3a353d0f927d1d6db5b5d56386907d91d7011dfca53979b4e3c532608
|
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.
|
54
|
+
Universe.atomes.each_value do |atome_f|
|
55
55
|
# we affect the already existing atome to target
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
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)
|
@@ -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
|
-
|
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
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
|
@@ -15,7 +15,6 @@ new({ sanitizer: :id }) do |params|
|
|
15
15
|
# Universe.add_to_atomes(params, self)
|
16
16
|
# end
|
17
17
|
|
18
|
-
|
19
18
|
# Universe.atomes.each do |_aid,atome_f|
|
20
19
|
#
|
21
20
|
# if atome_f.id == params
|
@@ -64,14 +63,28 @@ end
|
|
64
63
|
|
65
64
|
new(particle: :selected, category: :identity, type: :boolean) do |params|
|
66
65
|
if params == true
|
67
|
-
|
68
|
-
border({ thickness:
|
66
|
+
@selection_style = []
|
67
|
+
# select_style= border({ thickness: 3, red: 1, green: 1, blue: 1, alpha: 1, pattern: :dotted })
|
68
|
+
default_style = Universe.default_selection_style
|
69
|
+
select_style = ''
|
70
|
+
default_style.each do |atome_f, part_f|
|
71
|
+
select_style = send(atome_f, part_f)
|
72
|
+
end
|
73
|
+
@selection_style << select_style.id
|
69
74
|
grab(Universe.current_user).selection << @id
|
70
75
|
elsif params == false
|
71
|
-
|
76
|
+
@selection_style&.each do |style_f|
|
77
|
+
remove(style_f)
|
78
|
+
end
|
79
|
+
@selection_style = nil
|
72
80
|
grab(Universe.current_user).selection.collect.delete(@id)
|
73
81
|
else
|
74
|
-
|
82
|
+
@selection_style = []
|
83
|
+
params.each do |part_f, val_f|
|
84
|
+
select_style = send(part_f, val_f)
|
85
|
+
@selection_style << select_style.id
|
86
|
+
end
|
87
|
+
grab(Universe.current_user).selection << @id
|
75
88
|
end
|
76
89
|
params
|
77
90
|
end
|
@@ -12,36 +12,34 @@ end
|
|
12
12
|
new({ particle: :hide, category: :material, type: :boolean })
|
13
13
|
|
14
14
|
new({ particle: :remove, category: :property, type: :hash }) do |params|
|
15
|
-
|
15
|
+
|
16
|
+
if params.instance_of? Hash
|
16
17
|
if params[:row]
|
17
18
|
data.delete_at(params[:row])
|
18
|
-
|
19
19
|
elsif params[:column]
|
20
20
|
column = params[:column]
|
21
21
|
data.map do |hash|
|
22
22
|
hash.delete(hash.keys[column]) if hash.keys[column]
|
23
|
-
hash
|
24
23
|
end
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
24
|
+
# elsif params[:all]
|
25
|
+
# apply.each do |applied_atome|
|
26
|
+
# if grab(applied_atome).type.to_sym == params[:all].to_sym
|
27
|
+
# puts "!go"
|
28
|
+
# end
|
29
|
+
# end
|
31
30
|
# puts "so_good #{params}"
|
32
31
|
# puts "***> #{apply}"
|
33
32
|
end
|
33
|
+
|
34
34
|
params
|
35
35
|
else
|
36
36
|
|
37
37
|
params
|
38
38
|
end
|
39
39
|
|
40
|
-
|
41
40
|
end
|
42
41
|
# new({ particle: :remove, category: :property, type: :hash })
|
43
42
|
|
44
|
-
|
45
43
|
new({ post: :remove }) do |params|
|
46
44
|
# TODO : we have to rethink the removal of atome and particles (with exception like category) and maybe 'use particle type' to handle removal
|
47
45
|
if params.instance_of?(Hash)
|
@@ -98,22 +96,22 @@ end
|
|
98
96
|
new({ particle: :gradient, category: :material, type: :int })
|
99
97
|
|
100
98
|
new({ particle: :thickness, category: :material, type: :int })
|
101
|
-
new({ after: :thickness}) do |params|
|
102
|
-
a=affect.dup # FIXME we have to dup else some items in the array array other duplicated
|
99
|
+
new({ after: :thickness }) do |params|
|
100
|
+
a = affect.dup # FIXME we have to dup else some items in the array array other duplicated
|
103
101
|
a.each do |atome_to_refresh|
|
104
102
|
grab(atome_to_refresh).apply(id)
|
105
103
|
end
|
106
104
|
params
|
107
105
|
end
|
108
106
|
new({ particle: :pattern, category: :material, type: :string })
|
109
|
-
new({ after: :pattern })do |params|
|
110
|
-
a=affect.dup # FIXME we have to dup else some items in the array array other duplicated
|
107
|
+
new({ after: :pattern }) do |params|
|
108
|
+
a = affect.dup # FIXME we have to dup else some items in the array array other duplicated
|
111
109
|
a.each do |atome_to_refresh|
|
112
110
|
grab(atome_to_refresh).apply(id)
|
113
111
|
end
|
114
112
|
params
|
115
113
|
end
|
116
114
|
# new({ particle: :border, category: :material, type: :int })
|
117
|
-
new({particle: :fill, category: :material, type: :array })
|
115
|
+
new({ particle: :fill, category: :material, type: :array })
|
118
116
|
|
119
|
-
new({particle: :opacity, category: :material, type: :int })
|
117
|
+
new({ particle: :opacity, category: :material, type: :int })
|
@@ -33,9 +33,17 @@ new({ particle: :delete, category: :utility, type: :boolean, render: false }) do
|
|
33
33
|
render(:delete, params)
|
34
34
|
# the machine delete the current atome from the universe
|
35
35
|
id_found = @id.to_sym
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
if @attach
|
37
|
+
parent_found = grab(@attach)
|
38
|
+
parent_found.attached.delete(id_found)
|
39
|
+
end
|
40
|
+
@affect&.each do |affected_atome|
|
41
|
+
affected_found = grab(affected_atome)
|
42
|
+
affected_found.apply.delete(id_found)
|
43
|
+
affected_found.refresh
|
44
|
+
end
|
45
|
+
|
46
|
+
# Universe.delete(@aid)
|
39
47
|
end
|
40
48
|
elsif params.instance_of? Hash
|
41
49
|
|
@@ -64,6 +72,7 @@ new({ particle: :delete, category: :utility, type: :boolean, render: false }) do
|
|
64
72
|
send(params, 0) unless params == :id
|
65
73
|
end
|
66
74
|
end
|
75
|
+
|
67
76
|
new({ particle: :clear, category: :utility, type: :boolean })
|
68
77
|
|
69
78
|
new({ post: :clear }) do
|
@@ -255,7 +264,6 @@ end
|
|
255
264
|
new({ particle: :storage, category: :utility, type: :hash })
|
256
265
|
new({ particle: :state, category: :utility, type: :symbol })
|
257
266
|
|
258
|
-
|
259
267
|
new({ particle: :record, category: :utility, type: :hash })
|
260
268
|
new({ particle: :preview, category: :utility, type: :hash })
|
261
269
|
|
@@ -27,12 +27,14 @@ class Universe
|
|
27
27
|
@allow_tool_operations = false
|
28
28
|
@active_tools = []
|
29
29
|
@atome_preset = []
|
30
|
+
@default_selection_style={border: { thickness: 3, red: 1, green: 1, blue: 1, alpha: 1, pattern: :dotted }}
|
31
|
+
@applicable_atomes= %i[color shadow border paint animation]
|
30
32
|
# @historicize=false
|
31
33
|
class << self
|
32
34
|
attr_reader :atomes, :atomes_ids, :renderer_list, :molecule_list, :atome_list, :particle_list, :classes, :counter,
|
33
35
|
:atomes_specificities
|
34
36
|
attr_accessor :connected, :allow_sync, :allow_localstorage, :database_ready, :edit_mode, :tools,
|
35
|
-
:allow_tool_operations, :active_tools, :atome_preset
|
37
|
+
:allow_tool_operations, :active_tools, :atome_preset, :applicable_atomes, :default_selection_style
|
36
38
|
|
37
39
|
def messages
|
38
40
|
@messages
|
data/lib/atome/presets/atome.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
-
|
357
|
-
|
356
|
+
# # alert particle.class
|
357
|
+
# # alert proc_found.class
|
358
358
|
# proc_found.call
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
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
|
393
|
-
|
391
|
+
next if %i[@selection_style @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
|
-
|
406
|
-
|
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
@@ -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
|
@@ -38,7 +44,13 @@ new({ method: :remove, renderer: :html, type: :string }) do |object_id_to_remove
|
|
38
44
|
html.style("boxShadow", 'none')
|
39
45
|
html.style("filter", 'none')
|
40
46
|
@apply.delete(object_id_to_remove)
|
41
|
-
apply(@apply)
|
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
|
-
|
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
|
-
|
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-
|
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
|
|
@@ -23,13 +23,13 @@ wait 1 do
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
26
|
-
|
26
|
+
i=image(:green_planet)
|
27
27
|
# alert i.path
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
#
|
32
|
-
|
28
|
+
i.instance_variable_set("@path", './medias/images/red_planet.png')
|
29
|
+
wait 2 do
|
30
|
+
i.refresh
|
31
|
+
# i.path'./medias/images/red_planet.png'
|
32
|
+
end
|
33
33
|
|
34
34
|
|
35
35
|
#
|
@@ -2,7 +2,27 @@
|
|
2
2
|
|
3
3
|
t = text({ data: 'touch me to select all', id: :the_text })
|
4
4
|
b = box({ left: 12, id: :the_box })
|
5
|
-
circle({ left: 230, id: :the_circle })
|
5
|
+
c = circle({ left: 230, id: :the_circle, color: { blue: 1, id: :c1 } })
|
6
|
+
c.color({ green: 1, id: :c2 })
|
7
|
+
# to change default selection style
|
8
|
+
Universe.default_selection_style = { border: { thickness: 3, red: 1, green: 0, blue: 1, alpha: 1, pattern: :dotted } }
|
9
|
+
|
10
|
+
c.touch(true) do
|
11
|
+
if c.selected
|
12
|
+
c.selected(false)
|
13
|
+
else
|
14
|
+
# c.selected(true)
|
15
|
+
# example of custom selection style
|
16
|
+
c.selected({ shadow: { id: :titi,
|
17
|
+
left: 9, top: 3, blur: 9,
|
18
|
+
invert: false,
|
19
|
+
red: 0, green: 0, blue: 0, alpha: 1
|
20
|
+
}, border: { id: :toto, thickness: 5, red: 1, green: 1, blue: 1, alpha: 1,
|
21
|
+
pattern: :dotted, inside: true }
|
22
|
+
})
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
6
26
|
image({ path: 'medias/images/red_planet.png', id: :the__red_planet, top: 233 })
|
7
27
|
|
8
28
|
t.touch(true) do
|
@@ -16,9 +36,9 @@ t.touch(true) do
|
|
16
36
|
selected_items = grab(Universe.current_user).selection # we create a group
|
17
37
|
|
18
38
|
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)
|
39
|
+
atome_selected = grab(atome_id_selected)
|
40
|
+
atome_selected.width = rand(333)
|
41
|
+
atome_selected.height = rand(333)
|
22
42
|
|
23
43
|
end
|
24
44
|
b.selected(false)
|
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.
|
4
|
+
version: 0.5.7.0.5
|
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-
|
11
|
+
date: 2024-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: artoo
|