atome 0.5.3.7.3 → 0.5.3.8.0
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 +12 -13
- data/lib/atome/extensions/atome.rb +6 -0
- data/lib/atome/extensions/mathematic.rb +24 -0
- data/lib/atome/extensions/matrix.rb +2 -1
- data/lib/atome/genesis/generators/atome.rb +54 -97
- data/lib/atome/genesis/generators/event.rb +8 -1
- data/lib/atome/genesis/generators/identity.rb +24 -75
- data/lib/atome/helpers/utilities.rb +19 -8
- data/lib/atome/kernel/batch.rb +3 -2
- data/lib/atome/kernel/universe.rb +3 -1
- data/lib/atome/presets/atome.rb +3 -66
- data/lib/atome/renderers/browser/event.rb +5 -0
- data/lib/atome/renderers/renderer.rb +2 -2
- data/lib/atome/version.rb +1 -1
- data/lib/atome.rb +1 -0
- data/vendor/assets/src/medias/images/green_planet.png +0 -0
- data/vendor/assets/src/medias/images/logos/vimeo.svg +16 -16
- data/vendor/assets/src/medias/rubies/examples/add.rb +4 -2
- data/vendor/assets/src/medias/rubies/examples/animation.rb +2 -2
- data/vendor/assets/src/medias/rubies/examples/clone.rb +1 -1
- data/vendor/assets/src/medias/rubies/examples/delete.rb +1 -4
- data/vendor/assets/src/medias/rubies/examples/detached.rb +3 -3
- data/vendor/assets/src/medias/rubies/examples/drag.rb +10 -3
- data/vendor/assets/src/medias/rubies/examples/monitoring.rb +4 -4
- data/vendor/assets/src/medias/rubies/examples/table.rb +2 -2
- data/vendor/assets/src/medias/rubies/examples/text.rb +14 -8
- data/vendor/assets/src/medias/rubies/examples/touch.rb +3 -3
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7a73219833a1b762ef00a884f0799800a1b638742057c29352c98c4208f47df
|
4
|
+
data.tar.gz: 7b343fa8cecaa21084ab2e764ce251b38dc954a8ff97d49e1a951fdcd18760fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 482d2e6986aef0fa1ff7dc11df7b89e62fb9fab3211196f9ef5b8be39050478d6735b24e99e9b0e263fdd0fbfcc1fc323ed28ee26daeb7871294ff847cf37d16
|
7
|
+
data.tar.gz: d81ed5c1b4c5e5eacdc3cb85726d0e3d81781726c052bff148664fcf8fd11843f2af975ac3478be9c18b2cffd3cb6cf8a11c6a77de896b528095cc894b378fdf
|
data/lib/atome/atome.rb
CHANGED
@@ -14,7 +14,6 @@ class Atome
|
|
14
14
|
atomes.each_value do |elements|
|
15
15
|
# the instance variable below contain the id all any atomes that need to be informed when changes occurs
|
16
16
|
@broadcast = {}
|
17
|
-
# @at_time = {}
|
18
17
|
# now we store the proc in a an atome's property called :bloc
|
19
18
|
elements[:code] = atomes_proc if atomes_proc
|
20
19
|
@atome = elements
|
@@ -31,7 +30,7 @@ class Atome
|
|
31
30
|
if params || params == false
|
32
31
|
# the line below execute the proc created when using the build_particle method
|
33
32
|
instance_exec(params, user_proc, &method_proc) if method_proc.is_a?(Proc)
|
34
|
-
params = sanitize(element, params)
|
33
|
+
params = sanitize(element, params,&user_proc)
|
35
34
|
create_particle(element, store, render)
|
36
35
|
send("set_#{element}", params, &user_proc)
|
37
36
|
else
|
@@ -50,14 +49,17 @@ class Atome
|
|
50
49
|
|
51
50
|
def atome_creation_pre_treatment(element, params, &user_proc)
|
52
51
|
params = sanitize(element, params)
|
52
|
+
run_optional_proc("pre_render_#{@atome[:type]}".to_sym, self, params, &user_proc)
|
53
53
|
create_atome(element)
|
54
|
+
run_optional_proc("post_render_#{@atome[:type]}".to_sym, self, params, &user_proc)
|
54
55
|
send("set_#{element}", params, &user_proc)
|
55
56
|
end
|
56
57
|
|
57
58
|
def atome_initializer(element, params = {})
|
58
59
|
temp_default = Essentials.default_params[element] || {}
|
59
60
|
generated_render = params[:renderers] || []
|
60
|
-
generated_id = params[:id] ||
|
61
|
+
generated_id = params[:id] || identity_generator(:element)
|
62
|
+
|
61
63
|
generated_parents = params[:parents] || [id.value]
|
62
64
|
generated_children = params[:children] || []
|
63
65
|
temp_default[:id] = generated_id
|
@@ -88,8 +90,8 @@ class Atome
|
|
88
90
|
end
|
89
91
|
end
|
90
92
|
|
91
|
-
def run_optional_proc(proc_name, atome = self,
|
92
|
-
params = instance_variable_get("@#{element}")
|
93
|
+
def run_optional_proc(proc_name, atome = self, params, &user_proc)
|
94
|
+
# params = instance_variable_get("@#{element}")
|
93
95
|
option_found = Universe.get_optional_method(proc_name)
|
94
96
|
atome.instance_exec(params, user_proc, atome, &option_found) if option_found.is_a?(Proc)
|
95
97
|
end
|
@@ -115,14 +117,12 @@ class Atome
|
|
115
117
|
# we create a proc holder of any new particle if user pass a bloc
|
116
118
|
store_code_bloc(element, &user_proc) if user_proc
|
117
119
|
# Params is now an instance variable so it should be passed thru different methods
|
118
|
-
instance_variable_set("@#{element}", params)
|
119
|
-
run_optional_proc("pre_render_#{
|
120
|
-
|
121
|
-
|
122
|
-
run_optional_proc("post_render_#{@atome[:type]}".to_sym, self, element, &user_proc)
|
123
|
-
run_optional_proc("post_render_#{element}".to_sym, self, element, &user_proc)
|
120
|
+
instance_variable_set("@#{element}", params) if store
|
121
|
+
run_optional_proc("pre_render_#{element}".to_sym, self, params, &user_proc)
|
122
|
+
rendering(element,params, &user_proc) if render
|
123
|
+
run_optional_proc("post_render_#{element}".to_sym, self, params, &user_proc)
|
124
124
|
broadcasting(element)
|
125
|
-
store_value(element)
|
125
|
+
store_value(element) if store
|
126
126
|
self
|
127
127
|
end
|
128
128
|
|
@@ -154,7 +154,6 @@ class Atome
|
|
154
154
|
virtual_atome.user_proc = user_proc
|
155
155
|
virtual_atome.value = @atome[element]
|
156
156
|
virtual_atome
|
157
|
-
"it should contain the atome not : #{element}"
|
158
157
|
end
|
159
158
|
|
160
159
|
def create_atome(new_atome)
|
@@ -20,7 +20,13 @@ def new(params, &bloc)
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
def identity_generator(type=:element)
|
24
|
+
"#{type}_#{Universe.counter}"
|
25
|
+
# { date: Time.now, location: geolocation }
|
26
|
+
end
|
27
|
+
|
23
28
|
def grab(atome_to_get)
|
29
|
+
atome_to_get = atome_to_get.value if atome_to_get.instance_of? Atome
|
24
30
|
Universe.atomes[atome_to_get]
|
25
31
|
end
|
26
32
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Atome
|
4
|
+
def /val
|
5
|
+
val=val.value if val.instance_of? Atome
|
6
|
+
value/val
|
7
|
+
end
|
8
|
+
|
9
|
+
def *val
|
10
|
+
val=val.value if val.instance_of? Atome
|
11
|
+
value*val
|
12
|
+
end
|
13
|
+
|
14
|
+
def -val
|
15
|
+
val=val.value if val.instance_of? Atome
|
16
|
+
value-val
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
def +val
|
21
|
+
val=val.value if val.instance_of? Atome
|
22
|
+
value+val
|
23
|
+
end
|
24
|
+
end
|
@@ -242,7 +242,8 @@ module Matrix
|
|
242
242
|
default_renderer = Essentials.default_params[:render_engines]
|
243
243
|
atome_type = :matrix
|
244
244
|
generated_render = params[:renderers] || default_renderer
|
245
|
-
generated_id = params[:id] ||
|
245
|
+
generated_id = params[:id] || identity_generator(:matrix)
|
246
|
+
|
246
247
|
generated_parents = params[:parents] || [id.value]
|
247
248
|
generated_children = params[:children] || []
|
248
249
|
params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
|
@@ -1,18 +1,30 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
new({ atome: :color })
|
4
|
+
|
4
5
|
new({ sanitizer: :color }) do |params|
|
5
6
|
parent_found = found_parents_and_renderers[:parent]
|
6
|
-
|
7
|
+
if parent_found == [:view]
|
8
|
+
parent_found = [:black_matter] if parent_found == [:view]
|
9
|
+
elsif color.value
|
10
|
+
# we delete any previous color if there's one
|
11
|
+
detached(color.value)
|
12
|
+
grab(color.value)&.delete(true)# we had the condition because the color may exist but
|
13
|
+
# so it is not sanitized so it has no id
|
14
|
+
end
|
15
|
+
|
7
16
|
render_found = found_parents_and_renderers[:renderers]
|
8
|
-
|
17
|
+
generated_id = params[:id] || identity_generator(:color)
|
18
|
+
|
19
|
+
default_params = { renderers: render_found, id: generated_id, type: :color,
|
9
20
|
attach: parent_found,
|
10
21
|
red: 0, green: 0, blue: 0, alpha: 1 }
|
11
22
|
params = create_color_hash(params) unless params.instance_of? Hash
|
12
23
|
new_params = default_params.merge!(params)
|
13
|
-
atome[:color] = new_params
|
24
|
+
atome[:color] = new_params[:id]
|
14
25
|
new_params
|
15
26
|
end
|
27
|
+
|
16
28
|
new({ atome: :image })
|
17
29
|
new({ sanitizer: :image }) do |params|
|
18
30
|
unless params.instance_of? Hash
|
@@ -20,7 +32,8 @@ new({ sanitizer: :image }) do |params|
|
|
20
32
|
params = { path: "./medias/images/#{params}" }
|
21
33
|
end
|
22
34
|
default_renderer = Essentials.default_params[:render_engines]
|
23
|
-
generated_id = params[:id] ||
|
35
|
+
generated_id = params[:id] || identity_generator(:image)
|
36
|
+
|
24
37
|
generated_render = params[:renderers] || default_renderer
|
25
38
|
generated_parents = params[:parents] || id.value
|
26
39
|
# TODO : the line below should get the value from default params Essentials
|
@@ -33,36 +46,63 @@ new({ atome: :video })
|
|
33
46
|
new({ sanitizer: :video }) do |params|
|
34
47
|
parent_found = found_parents_and_renderers[:parent]
|
35
48
|
render_found = found_parents_and_renderers[:renderers]
|
36
|
-
|
49
|
+
generated_id = params[:id] || identity_generator(:video)
|
50
|
+
|
51
|
+
default_params = { renderers: render_found, id: generated_id, type: :video,
|
37
52
|
parents: parent_found }
|
38
53
|
default_params.merge!(params)
|
39
54
|
end
|
40
55
|
new({ atome: :shadow })
|
41
56
|
new({ sanitizer: :shadow }) do |params|
|
57
|
+
|
42
58
|
parent_found = found_parents_and_renderers[:parent]
|
43
|
-
|
59
|
+
if parent_found == [:view]
|
60
|
+
parent_found = [:black_matter] if parent_found == [:view]
|
61
|
+
elsif shadow.value
|
62
|
+
# we delete any previous color if there's one
|
63
|
+
detached(shadow.value)
|
64
|
+
grab(shadow.value)&.delete(true)# we had the condition because the shadow may exist but
|
65
|
+
# so it is not sanitized so it has no id
|
66
|
+
end
|
67
|
+
## we delete any previous shadow if there's one
|
68
|
+
# if shadow.value
|
69
|
+
# attached.value.delete(shadow.value)
|
70
|
+
# grab(shadow.value)&.delete(true) # we had the condition because the color may exist but
|
71
|
+
# # so it is not sanitized so it has no id
|
72
|
+
# end
|
73
|
+
# parent_found = found_parents_and_renderers[:parent]
|
74
|
+
# parent_found = [:user_view] if parent_found == [:view]
|
44
75
|
render_found = found_parents_and_renderers[:renderers]
|
45
|
-
|
76
|
+
generated_id = params[:id] || identity_generator(:shadow)
|
77
|
+
|
78
|
+
default_params = { renderers: render_found, id: generated_id, type: :shadow,
|
46
79
|
attach: parent_found,
|
47
80
|
red: 0, green: 0, blue: 0, alpha: 1, blur: 3, left: 3, top: 3 }
|
48
|
-
default_params.merge!(params)
|
81
|
+
# default_params.merge!(params)
|
82
|
+
params = create_shadow_hash(params) unless params.instance_of? Hash
|
83
|
+
new_params = default_params.merge!(params)
|
84
|
+
atome[:shadow] = new_params
|
85
|
+
new_params
|
86
|
+
|
49
87
|
end
|
50
88
|
new({ atome: :shape })
|
51
89
|
new({ atome: :code })
|
52
90
|
new({ atome: :audio })
|
53
91
|
new({ atome: :element })
|
54
|
-
new({ sanitizer: :element })do |params|
|
92
|
+
new({ sanitizer: :element }) do |params|
|
55
93
|
parent_found = found_parents_and_renderers[:parent]
|
56
94
|
render_found = []
|
57
|
-
|
95
|
+
generated_id = params[:id] || identity_generator(:element)
|
96
|
+
|
97
|
+
default_params = { renderers: render_found, id: generated_id, type: :element,
|
58
98
|
parents: parent_found, data: '' }
|
59
99
|
default_params.merge!(params)
|
60
100
|
end
|
61
101
|
new({ atome: :web })
|
62
|
-
new({ sanitizer: :web })do |params|
|
102
|
+
new({ sanitizer: :web }) do |params|
|
63
103
|
default_renderer = Essentials.default_params[:render_engines]
|
104
|
+
generated_id = params[:id] || identity_generator(:web)
|
64
105
|
|
65
|
-
generated_id = params[:id] || "web_#{Universe.atomes.length}"
|
66
106
|
generated_render = params[:renderers] || default_renderer
|
67
107
|
generated_parents = params[:parents] || id.value
|
68
108
|
# TODO : the line below should get the value from default params Essentials
|
@@ -77,7 +117,7 @@ new({ sanitizer: :animation }) do |params|
|
|
77
117
|
default_renderer = Essentials.default_params[:render_engines]
|
78
118
|
atome_type = :animation
|
79
119
|
generated_render = params[:renderers] || default_renderer
|
80
|
-
generated_id = params[:id] ||
|
120
|
+
generated_id = params[:id] || identity_generator(atome_type)
|
81
121
|
generated_parents = params[:parents] || []
|
82
122
|
generated_children = params[:children] || []
|
83
123
|
params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
|
@@ -89,93 +129,10 @@ new({ sanitizer: :text }) do |params|
|
|
89
129
|
default_renderer = Essentials.default_params[:render_engines]
|
90
130
|
atome_type = :text
|
91
131
|
generated_render = params[:renderers] || default_renderer
|
92
|
-
generated_id = params[:id] ||
|
132
|
+
generated_id = params[:id] || identity_generator(atome_type)
|
93
133
|
generated_parents = params[:parents] || [id.value]
|
94
134
|
generated_children = params[:children] || []
|
95
135
|
params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
|
96
136
|
params
|
97
137
|
end
|
98
138
|
|
99
|
-
|
100
|
-
# generator = Genesis.generator
|
101
|
-
#
|
102
|
-
# generator.build_atome(:animation)
|
103
|
-
# generator.build_atome(:color)
|
104
|
-
# generator.build_sanitizer(:color) do |params|
|
105
|
-
# parent_found = found_parents_and_renderers[:parent]
|
106
|
-
# parent_found = [:black_matter] if parent_found == [:view]
|
107
|
-
# render_found = found_parents_and_renderers[:renderers]
|
108
|
-
# default_params = { renderers: render_found, id: "color_#{Universe.atomes.length}", type: :color,
|
109
|
-
# attach: parent_found,
|
110
|
-
# red: 0, green: 0, blue: 0, alpha: 1 }
|
111
|
-
# params = create_color_hash(params) unless params.instance_of? Hash
|
112
|
-
# new_params = default_params.merge!(params)
|
113
|
-
# atome[:color] = new_params
|
114
|
-
# new_params
|
115
|
-
# end
|
116
|
-
#
|
117
|
-
# generator.build_atome(:video)
|
118
|
-
# generator.build_sanitizer(:video) do |params|
|
119
|
-
# parent_found = found_parents_and_renderers[:parent]
|
120
|
-
# render_found = found_parents_and_renderers[:renderers]
|
121
|
-
# default_params = { renderers: render_found, id: "video_#{Universe.atomes.length}", type: :video,
|
122
|
-
# parents: parent_found }
|
123
|
-
# default_params.merge!(params)
|
124
|
-
# end
|
125
|
-
# generator.build_atome(:shadow)
|
126
|
-
# generator.build_sanitizer(:shadow) do |params|
|
127
|
-
# parent_found = found_parents_and_renderers[:parent]
|
128
|
-
# parent_found = [:user_view] if parent_found == [:view]
|
129
|
-
# render_found = found_parents_and_renderers[:renderers]
|
130
|
-
# default_params = { renderers: render_found, id: "shadow_#{Universe.atomes.length}", type: :shadow,
|
131
|
-
# attach: parent_found,
|
132
|
-
# red: 0, green: 0, blue: 0, alpha: 1, blur: 3, left: 3, top: 3 }
|
133
|
-
# default_params.merge!(params)
|
134
|
-
# end
|
135
|
-
# generator.build_atome(:shape)
|
136
|
-
# generator.build_atome(:text)
|
137
|
-
# generator.build_atome(:code)
|
138
|
-
# generator.build_atome(:audio)
|
139
|
-
# generator.build_atome(:element)
|
140
|
-
# generator.build_sanitizer(:element) do |params|
|
141
|
-
# parent_found = found_parents_and_renderers[:parent]
|
142
|
-
# render_found = []
|
143
|
-
# default_params = { renderers: render_found, id: "element_#{Universe.atomes.length}", type: :element,
|
144
|
-
# parents: parent_found, data: '' }
|
145
|
-
# default_params.merge!(params)
|
146
|
-
# end
|
147
|
-
# generator.build_atome(:collector)
|
148
|
-
# generator.build_atome(:web)
|
149
|
-
# generator.build_sanitizer(:web) do |params|
|
150
|
-
# default_renderer = Essentials.default_params[:render_engines]
|
151
|
-
#
|
152
|
-
# generated_id = params[:id] || "web_#{Universe.atomes.length}"
|
153
|
-
# generated_render = params[:renderers] || default_renderer
|
154
|
-
# generated_parents = params[:parents] || id.value
|
155
|
-
# # TODO : the line below should get the value from default params Essentials
|
156
|
-
# temp_default = { renderers: generated_render, id: generated_id, type: :web, parents: [generated_parents],
|
157
|
-
# children: [], width: 120, height: 120, path: 'https://www.youtube.com/embed/usQDazZKWAk' }
|
158
|
-
# params = temp_default.merge(params)
|
159
|
-
# params
|
160
|
-
# end
|
161
|
-
# generator.build_sanitizer(:animation) do |params|
|
162
|
-
# default_renderer = Essentials.default_params[:render_engines]
|
163
|
-
# atome_type = :animation
|
164
|
-
# generated_render = params[:renderers] || default_renderer
|
165
|
-
# generated_id = params[:id] || "#{atome_type}_#{Universe.atomes.length}"
|
166
|
-
# generated_parents = params[:parents] || []
|
167
|
-
# generated_children = params[:children] || []
|
168
|
-
# params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
|
169
|
-
# params
|
170
|
-
# end
|
171
|
-
# generator.build_sanitizer(:text) do |params|
|
172
|
-
# params = { data: params } unless params.instance_of? Hash
|
173
|
-
# default_renderer = Essentials.default_params[:render_engines]
|
174
|
-
# atome_type = :text
|
175
|
-
# generated_render = params[:renderers] || default_renderer
|
176
|
-
# generated_id = params[:id] || "#{atome_type}_#{Universe.atomes.length}"
|
177
|
-
# generated_parents = params[:parents] || [id.value]
|
178
|
-
# generated_children = params[:children] || []
|
179
|
-
# params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
|
180
|
-
# params
|
181
|
-
# end
|
@@ -2,7 +2,14 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
new({particle: :touch })
|
5
|
+
new({particle: :touch , type: :hash, store: false })
|
6
|
+
new({ post: :touch }) do |params, user_bloc|
|
7
|
+
@touch = {} if @touch == nil
|
8
|
+
@touch[params] = user_bloc
|
9
|
+
# as store for touch is set to false we have to manually save the instance variable
|
10
|
+
store_value(:touch)
|
11
|
+
end
|
12
|
+
|
6
13
|
new({particle: :play }) do
|
7
14
|
@atome[:pause] = :false
|
8
15
|
end
|
@@ -2,9 +2,7 @@
|
|
2
2
|
|
3
3
|
new({ particle: :attached })
|
4
4
|
new({ sanitizer: :attached }) do |params|
|
5
|
-
unless params.instance_of? Array
|
6
|
-
params = [params]
|
7
|
-
end
|
5
|
+
params = [params] unless params.instance_of? Array
|
8
6
|
params
|
9
7
|
end
|
10
8
|
new({ pre: :attached }) do |children_ids|
|
@@ -13,32 +11,44 @@ new({ pre: :attached }) do |children_ids|
|
|
13
11
|
child_found = grab(child_id)
|
14
12
|
parents_found = @atome[:id]
|
15
13
|
child_found.family(parents_found)
|
16
|
-
# parents_found.atome[:attach] = [] unless parents_found.atome[:attach]
|
17
14
|
child_found.atome[:attach] = [parents_found]
|
18
15
|
end
|
19
16
|
end
|
20
17
|
new({ particle: :type })
|
21
18
|
new({ particle: :children })
|
22
|
-
|
23
|
-
|
19
|
+
|
20
|
+
new ({ sanitizer: :children }) do |params|
|
21
|
+
# TODO factorise the line below and 'sanitized_params' for all particle type of Array
|
22
|
+
params = [params] unless params.instance_of? Array
|
23
|
+
sanitized_params = []
|
24
|
+
params.each do |child_id|
|
24
25
|
child_id = child_id.value if child_id.instance_of? Atome
|
26
|
+
sanitized_params << child_id
|
25
27
|
child_found = grab(child_id)
|
26
28
|
parents_found = @atome[:id]
|
27
29
|
# FIXME : broadcast may malfunction because of the commented line below,
|
28
|
-
# FIXME suite : if uncomment object
|
29
|
-
#
|
30
|
+
# FIXME suite : if uncomment object hierarchy is broken (cf Vie Project)
|
31
|
+
# FIXME : parent child problem may be caused by th eline below
|
32
|
+
child_found.family(parents_found)
|
30
33
|
child_found.atome[:parents] = [parents_found]
|
31
34
|
end
|
35
|
+
sanitized_params
|
32
36
|
end
|
37
|
+
|
33
38
|
new({ particle: :parents })
|
34
|
-
new({
|
35
|
-
|
39
|
+
new({ sanitizer: :parents }) do |params|
|
40
|
+
params = [params] unless params.instance_of? Array
|
41
|
+
sanitized_params = []
|
42
|
+
params.each do |parents_id|
|
36
43
|
parents_id = parents_id.value if parents_id.instance_of? Atome
|
44
|
+
sanitized_params << parents_id
|
37
45
|
parents_found = grab(parents_id)
|
38
46
|
family(parents_id)
|
39
47
|
parents_found.atome[:children] << atome[:id]
|
40
48
|
end
|
49
|
+
sanitized_params
|
41
50
|
end
|
51
|
+
|
42
52
|
new({ particle: :family })
|
43
53
|
new({ particle: :link })
|
44
54
|
new({ particle: :id })
|
@@ -62,8 +72,10 @@ new({ pre: :attach }) do |parents_ids|
|
|
62
72
|
parents_found.atome[:attached] << atome[:id]
|
63
73
|
end
|
64
74
|
end
|
65
|
-
new({ particle: :detached })
|
66
|
-
|
75
|
+
new({ particle: :detached }) do |value|
|
76
|
+
attached.value.delete(value)
|
77
|
+
end
|
78
|
+
new({ particle: :intricate, type: :array })
|
67
79
|
new({ particle: :clones }) do |clones_found|
|
68
80
|
clones_found.each_with_index do |clone_found, index|
|
69
81
|
particles_intricated = clone_found[:intricate] ||= []
|
@@ -77,66 +89,3 @@ new({ particle: :clones }) do |clones_found|
|
|
77
89
|
end
|
78
90
|
end
|
79
91
|
end
|
80
|
-
|
81
|
-
# generator = Genesis.generator
|
82
|
-
#
|
83
|
-
# generator.build_particle(:type)
|
84
|
-
# generator.build_particle(:parents)
|
85
|
-
# generator.build_particle(:children)
|
86
|
-
# generator.build_option(:pre_render_parents) do |parents_ids|
|
87
|
-
# parents_ids.each do |parents_id|
|
88
|
-
# parents_id = parents_id.value if parents_id.instance_of? Atome
|
89
|
-
# parents_found = grab(parents_id)
|
90
|
-
# family(parents_id)
|
91
|
-
# parents_found.atome[:children] << atome[:id]
|
92
|
-
# end
|
93
|
-
# end
|
94
|
-
# generator.build_option(:pre_render_children) do |children_ids|
|
95
|
-
# children_ids.each do |child_id|
|
96
|
-
# child_id = child_id.value if child_id.instance_of? Atome
|
97
|
-
# child_found = grab(child_id)
|
98
|
-
# parents_found = @atome[:id]
|
99
|
-
# # FIXME : broadcast may malfunction because of the commented line below,
|
100
|
-
# # FIXME suite : if uncomment object hierreachy is broken (cf Vie Project)
|
101
|
-
# # child_found.family(parents_found)
|
102
|
-
# child_found.atome[:parents] = [parents_found]
|
103
|
-
# end
|
104
|
-
# end
|
105
|
-
# generator.build_particle(:family, { render: true, store: false })
|
106
|
-
# generator.build_particle(:link) do |child_id|
|
107
|
-
# child_found = grab(child_id)
|
108
|
-
# child_found.atome[:parents] << @atome[:id]
|
109
|
-
# child_found.refresh
|
110
|
-
# end
|
111
|
-
# generator.build_particle(:id)
|
112
|
-
# generator.build_sanitizer(:id)
|
113
|
-
# generator.build_particle(:name)
|
114
|
-
# generator.build_particle(:active)
|
115
|
-
# generator.build_particle(:attach)
|
116
|
-
# generator.build_option(:pre_render_attach) do |parents_ids|
|
117
|
-
# parents_ids.each do |parents_id|
|
118
|
-
# parents_id = parents_id.value if parents_id.instance_of? Atome
|
119
|
-
# parents_found = grab(parents_id)
|
120
|
-
# family(parents_id)
|
121
|
-
# parents_found.atome[:attached] = [] unless parents_found.atome[:attached]
|
122
|
-
# parents_found.atome[:attached] << atome[:id]
|
123
|
-
# end
|
124
|
-
# end
|
125
|
-
#
|
126
|
-
# generator.build_particle(:detached) do |attach_to_remove|
|
127
|
-
# attached.value.delete(attach_to_remove)
|
128
|
-
# end
|
129
|
-
# generator.build_particle(:intricate, { type: :array })
|
130
|
-
# generator.build_particle(:clones) do |clones_found|
|
131
|
-
# clones_found.each_with_index do |clone_found, index|
|
132
|
-
# particles_intricated = clone_found[:intricate] ||= []
|
133
|
-
# clone_id = "#{particles[:id]}_clone_#{index}"
|
134
|
-
# original_id = atome[:id]
|
135
|
-
# clone_found[:id] = clone_id
|
136
|
-
# clone_found = particles.merge(clone_found)
|
137
|
-
# cloned_atome = Atome.new({ clone: clone_found })
|
138
|
-
# cloned_atome.monitor({ atomes: [original_id], particles: particles_intricated }) do |_atome, particle, value|
|
139
|
-
# cloned_atome.send(particle, value)
|
140
|
-
# end
|
141
|
-
# end
|
142
|
-
# end
|
@@ -6,6 +6,7 @@ class Atome
|
|
6
6
|
|
7
7
|
def collapse
|
8
8
|
@atome.each do |element, value|
|
9
|
+
# puts "=============> #{element}"
|
9
10
|
send(element, value) unless element == :type
|
10
11
|
end
|
11
12
|
end
|
@@ -14,15 +15,12 @@ class Atome
|
|
14
15
|
true
|
15
16
|
end
|
16
17
|
|
17
|
-
def sanitize(element, params)
|
18
|
+
def sanitize(element, params,&user_proc)
|
18
19
|
bloc_found = Universe.get_sanitizer_method(element)
|
19
|
-
params = instance_exec(params, &bloc_found) if bloc_found.is_a?(Proc)
|
20
|
+
params = instance_exec(params,user_proc, &bloc_found) if bloc_found.is_a?(Proc)
|
20
21
|
params
|
21
22
|
end
|
22
23
|
|
23
|
-
def identity_generator
|
24
|
-
{ date: Time.now, location: geolocation }
|
25
|
-
end
|
26
24
|
|
27
25
|
def history(property, value)
|
28
26
|
"historize : #{property} #{value}"
|
@@ -42,11 +40,11 @@ class Atome
|
|
42
40
|
|
43
41
|
def monitor(params=nil, &proc_monitoring)
|
44
42
|
if params
|
45
|
-
atome[:monitor] ||= {}
|
43
|
+
monitoring=atome[:monitor] ||= {}
|
46
44
|
params[:atomes].each do |atome_id|
|
47
45
|
target_broadcaster = grab(atome_id).instance_variable_get('@broadcast')
|
48
46
|
monitor_id = params[:id] || "monitor#{target_broadcaster.length}"
|
49
|
-
|
47
|
+
monitoring[monitor_id]=params.merge({code: proc_monitoring})
|
50
48
|
target_broadcaster[monitor_id] = { particles: params[:particles], code: proc_monitoring }
|
51
49
|
end
|
52
50
|
else
|
@@ -105,7 +103,8 @@ class Atome
|
|
105
103
|
def collector(params = {}, &bloc)
|
106
104
|
atome_type = :collector
|
107
105
|
generated_render = params[:renderers] || []
|
108
|
-
generated_id = params[:id] ||
|
106
|
+
generated_id = params[:id] || identity_generator(atome_type)
|
107
|
+
|
109
108
|
generated_parents = params[:parents] || [id.value]
|
110
109
|
generated_children = params[:children] || []
|
111
110
|
params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
|
@@ -118,6 +117,18 @@ class Atome
|
|
118
117
|
end
|
119
118
|
end
|
120
119
|
|
120
|
+
def include?(value)
|
121
|
+
self.value.include?(value)
|
122
|
+
end
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
def each_with_index(*args)
|
127
|
+
self.value.each_with_index do |val, index|
|
128
|
+
yield(val, index)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
121
132
|
def [](range)
|
122
133
|
if value[range].class == Atome
|
123
134
|
return value[range]
|
data/lib/atome/kernel/batch.rb
CHANGED
@@ -17,7 +17,8 @@ class Batch
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def initialize(params)
|
20
|
-
@id = params[:id] ||
|
20
|
+
@id = params[:id] || identity_generator(:batch)
|
21
|
+
Universe.add_to_atomes(@id, self)
|
21
22
|
Universe.add_to_atomes(@id, self)
|
22
23
|
end
|
23
24
|
|
@@ -27,7 +28,7 @@ class Batch
|
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
30
|
-
# TODO: automatise collector methods creation when
|
31
|
+
# TODO: automatise collector methods creation when creating a new atome type
|
31
32
|
def color(args, &block)
|
32
33
|
|
33
34
|
dispatch(:color, args, &block)
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
# universe method here
|
4
4
|
class Universe
|
5
|
+
@counter=0
|
5
6
|
@atomes = {}
|
6
7
|
@classes = {}
|
7
8
|
@atome_list = []
|
@@ -10,7 +11,7 @@ class Universe
|
|
10
11
|
@options = {}
|
11
12
|
@sanitizers = {}
|
12
13
|
class << self
|
13
|
-
attr_reader :atomes, :renderer_list, :atome_list, :particle_list, :classes
|
14
|
+
attr_reader :atomes, :renderer_list, :atome_list, :particle_list, :classes, :counter
|
14
15
|
|
15
16
|
def add_to_particle_list(particle = nil, type)
|
16
17
|
instance_variable_get('@particle_list')[particle]=type
|
@@ -43,6 +44,7 @@ class Universe
|
|
43
44
|
def add_to_atomes(id, atome)
|
44
45
|
# instance_variable_get('@atomes').merge!(atome)
|
45
46
|
@atomes[id] = atome
|
47
|
+
@counter=@counter+1
|
46
48
|
end
|
47
49
|
|
48
50
|
def update_atome_id(id, atome, prev_id)
|
data/lib/atome/presets/atome.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# TODO: Factorise codes below
|
6
6
|
# TODO we must clarified/unified the usage of presets and sanitizer it is not clear
|
7
7
|
|
8
|
-
|
8
|
+
|
9
9
|
class Atome
|
10
10
|
def atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
|
11
11
|
temp_default = Essentials.default_params[atome_type] || {}
|
@@ -21,7 +21,7 @@ class Atome
|
|
21
21
|
default_renderer = Essentials.default_params[:render_engines]
|
22
22
|
atome_type = :box
|
23
23
|
generated_render = params[:renderers] || default_renderer
|
24
|
-
generated_id = params[:id] ||
|
24
|
+
generated_id = params[:id] || identity_generator(:box)
|
25
25
|
generated_parents = params[:parents] || [id.value]
|
26
26
|
generated_children = params[:children] || []
|
27
27
|
|
@@ -34,74 +34,11 @@ class Atome
|
|
34
34
|
default_renderer = Essentials.default_params[:render_engines]
|
35
35
|
atome_type = :circle
|
36
36
|
generated_render = params[:renderers] || default_renderer
|
37
|
-
generated_id = params[:id] ||
|
37
|
+
generated_id = params[:id] || identity_generator(:circle)
|
38
38
|
generated_parents = params[:parents] || [id.value]
|
39
39
|
generated_children = params[:children] || []
|
40
40
|
params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
|
41
41
|
Atome.new({ atome_type => params }, &bloc)
|
42
42
|
end
|
43
43
|
|
44
|
-
# def image(params = {}, &bloc)
|
45
|
-
# default_renderer = Essentials.default_params[:render_engines]
|
46
|
-
# generated_id = params[:id] || "image_#{Universe.atomes.length}"
|
47
|
-
# generated_render = params[:renderers] || default_renderer
|
48
|
-
# generated_parents = params[:parents] || id.value
|
49
|
-
# # TODO : the line below should get the value from default params Essentials
|
50
|
-
# temp_default = { renderers: generated_render, id: generated_id, type: :image, parents: [generated_parents],
|
51
|
-
# children: [], width: 99, height: 99, path: './medias/images/atome.svg' }
|
52
|
-
# params = temp_default.merge(params)
|
53
|
-
# Atome.new({ image: params }, &bloc)
|
54
|
-
# end
|
55
|
-
#
|
56
|
-
# def text(params = {}, &bloc)
|
57
|
-
# default_renderer = Essentials.default_params[:render_engines]
|
58
|
-
# atome_type = :text
|
59
|
-
# generated_render = params[:renderers] || default_renderer
|
60
|
-
# generated_id = params[:id] || "#{atome_type}_#{Universe.atomes.length}"
|
61
|
-
# generated_parents = params[:parents] || [id.value]
|
62
|
-
# generated_children = params[:children] || []
|
63
|
-
# params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
|
64
|
-
# Atome.new({ atome_type => params }, &bloc)
|
65
|
-
# end
|
66
|
-
|
67
|
-
# def element(params = 'kjh', &bloc)
|
68
|
-
# atome_type = :element
|
69
|
-
#
|
70
|
-
# generated_render = params[:renderers] || []
|
71
|
-
#
|
72
|
-
# generated_id = params[:id] || "#{atome_type}_#{Universe.atomes.length}"
|
73
|
-
# generated_parents = params[:parents] || [id.value]
|
74
|
-
# generated_children = params[:children] || []
|
75
|
-
#
|
76
|
-
# generated_data = ""
|
77
|
-
# params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
|
78
|
-
# # FIXME: do not merge generated_data like this but change the atomecommon
|
79
|
-
# params.merge(generated_data)
|
80
|
-
#
|
81
|
-
# Atome.new({ atome_type => params }, &bloc)
|
82
|
-
# end
|
83
|
-
|
84
|
-
# def web(params = {}, &bloc)
|
85
|
-
# default_renderer = Essentials.default_params[:render_engines]
|
86
|
-
#
|
87
|
-
# generated_id = params[:id] || "web_#{Universe.atomes.length}"
|
88
|
-
# generated_render = params[:renderers] || default_renderer
|
89
|
-
# generated_parents = params[:parents] || id.value
|
90
|
-
# # TODO : the line below should get the value from default params Essentials
|
91
|
-
# temp_default = { renderers: generated_render, id: generated_id, type: :web, parents: [generated_parents],
|
92
|
-
# children: [], width: 120, height: 120, path: 'https://www.youtube.com/embed/usQDazZKWAk' }
|
93
|
-
# params = temp_default.merge(params)
|
94
|
-
# Atome.new({ image: params }, &bloc)
|
95
|
-
# end
|
96
|
-
|
97
|
-
# def animation(params = {}, &bloc)
|
98
|
-
# default_renderer = Essentials.default_params[:render_engines]
|
99
|
-
# atome_type = :animation
|
100
|
-
# generated_render = params[:renderers] || default_renderer
|
101
|
-
# generated_id = params[:id] || "#{atome_type}_#{Universe.atomes.length}"
|
102
|
-
# generated_parents = params[:parents] || []
|
103
|
-
# generated_children = params[:children] || []
|
104
|
-
# params = atome_common(atome_type, generated_id, generated_render, generated_parents, generated_children, params)
|
105
|
-
# Atome.new({ atome_type => params }, &bloc)
|
106
|
-
# end
|
107
44
|
end
|
@@ -4,6 +4,11 @@ generator = Genesis.generator
|
|
4
4
|
|
5
5
|
generator.build_render(:browser_touch) do |value, proc|
|
6
6
|
atome_id = @browser_object.attribute(:id)
|
7
|
+
# value.each do |tap_mode, user_proc|
|
8
|
+
# alert "#{tap_mode} : #{user_proc}\n #{tap_mode.class} : #{user_proc.class}"
|
9
|
+
# BrowserHelper.send("browser_touch_#{tap_mode}", atome_id,self, user_proc)
|
10
|
+
# end
|
11
|
+
# alert "#{value} : #{proc}\n #{value.class} : #{proc.class}"
|
7
12
|
BrowserHelper.send("browser_touch_#{value}", atome_id,self, proc)
|
8
13
|
end
|
9
14
|
|
@@ -4,8 +4,8 @@
|
|
4
4
|
class Atome
|
5
5
|
private
|
6
6
|
|
7
|
-
def rendering(element, &user_proc)
|
8
|
-
params=instance_variable_get("@#{element}")
|
7
|
+
def rendering(element,params, &user_proc)
|
8
|
+
# params=instance_variable_get("@#{element}")
|
9
9
|
render_engines = @atome[:renderers]
|
10
10
|
render_engines.each do |render_engine|
|
11
11
|
send("#{render_engine}_#{element}", params, &user_proc)
|
data/lib/atome/version.rb
CHANGED
data/lib/atome.rb
CHANGED
@@ -10,6 +10,7 @@ require 'atome/helpers/essentials'
|
|
10
10
|
require 'atome/renderers/renderer'
|
11
11
|
require 'atome/helpers/color_helper/color'
|
12
12
|
require 'atome/extensions/atome'
|
13
|
+
require 'atome/extensions/mathematic'
|
13
14
|
require 'atome/atome'
|
14
15
|
require 'atome/helpers/callbacks'
|
15
16
|
require 'atome/genesis/generators/atome'
|
Binary file
|
@@ -1,17 +1,17 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
3
|
-
<svg height="800px" width="800px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
4
|
-
viewBox="0 0 231.228 231.228" xml:space="preserve">
|
5
|
-
<g>
|
6
|
-
<path style="fill:#3FA9F5;" d="M16.398,91.213c-0.596,0.367-1.192,0.412-1.833,0.412c-0.367,0.138-0.779,0.275-1.238,0.275
|
7
|
-
c-3.85,0.138-6.325-3.804-8.479-6.508s-4.446-5.271-4.767-8.846c0-0.092,0.046-0.183,0.092-0.275
|
8
|
-
c-0.275-0.963-0.229-1.971,0.183-2.934C14.06,43.499,50.499,24.203,81.987,21.728c0.137,0,0.275,0,0.412,0
|
9
|
-
c1.512,0,2.658,0.688,3.483,0.688c7.288,4.583,9.946,16.5,12.238,23.192c5.225,15.446,8.525,32.543,12.1,48.447
|
10
|
-
c3.667,16.546,8.984,58.164,32.955,30.938c6.142-6.967,10.359-16.821,13.475-26.767c-1.054-5.454-0.137-10.817-5.133-15.401
|
11
|
-
c-5.454-5.042-11.459-7.517-18.884-6.692c-1.238,0.137-2.063-0.55-2.429-1.513c-1.925-1.467-2.979-4.079-1.375-6.784
|
12
|
-
c16.317-27.592,55.414-68.935,88.598-37.264c34.559,33.047-4.308,91.578-23.971,120.912
|
13
|
-
c-21.084,31.443-67.469,75.902-109.911,55.368c-14.575-7.059-19.617-23.055-23.376-37.676
|
14
|
-
c-6.646-25.805-12.742-51.747-19.342-77.598c-0.092-0.183-0.229-0.321-0.367-0.504c-0.963-1.833-1.283-4.217-2.704-5.729
|
15
|
-
c-2.108-2.292-5.317-2.063-8.021-1.421C24.831,85.163,20.706,88.784,16.398,91.213z"/>
|
16
|
-
</g>
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
3
|
+
<svg height="800px" width="800px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
4
|
+
viewBox="0 0 231.228 231.228" xml:space="preserve">
|
5
|
+
<g>
|
6
|
+
<path style="fill:#3FA9F5;" d="M16.398,91.213c-0.596,0.367-1.192,0.412-1.833,0.412c-0.367,0.138-0.779,0.275-1.238,0.275
|
7
|
+
c-3.85,0.138-6.325-3.804-8.479-6.508s-4.446-5.271-4.767-8.846c0-0.092,0.046-0.183,0.092-0.275
|
8
|
+
c-0.275-0.963-0.229-1.971,0.183-2.934C14.06,43.499,50.499,24.203,81.987,21.728c0.137,0,0.275,0,0.412,0
|
9
|
+
c1.512,0,2.658,0.688,3.483,0.688c7.288,4.583,9.946,16.5,12.238,23.192c5.225,15.446,8.525,32.543,12.1,48.447
|
10
|
+
c3.667,16.546,8.984,58.164,32.955,30.938c6.142-6.967,10.359-16.821,13.475-26.767c-1.054-5.454-0.137-10.817-5.133-15.401
|
11
|
+
c-5.454-5.042-11.459-7.517-18.884-6.692c-1.238,0.137-2.063-0.55-2.429-1.513c-1.925-1.467-2.979-4.079-1.375-6.784
|
12
|
+
c16.317-27.592,55.414-68.935,88.598-37.264c34.559,33.047-4.308,91.578-23.971,120.912
|
13
|
+
c-21.084,31.443-67.469,75.902-109.911,55.368c-14.575-7.059-19.617-23.055-23.376-37.676
|
14
|
+
c-6.646-25.805-12.742-51.747-19.342-77.598c-0.092-0.183-0.229-0.321-0.367-0.504c-0.963-1.833-1.283-4.217-2.704-5.729
|
15
|
+
c-2.108-2.292-5.317-2.063-8.021-1.421C24.831,85.163,20.706,88.784,16.398,91.213z"/>
|
16
|
+
</g>
|
17
17
|
</svg>
|
@@ -1,7 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
my_video = Atome.new(
|
4
|
-
|
4
|
+
video: { renderers: [:browser], id: :video1, type: :video, parents: [:view],
|
5
|
+
path: './medias/videos/avengers.mp4', left: 333, top: 33, width: 777
|
6
|
+
}
|
5
7
|
)
|
6
8
|
|
7
9
|
my_video.touch(true) do
|
@@ -20,4 +22,4 @@ end
|
|
20
22
|
|
21
23
|
my_video.markers({ markers: { begin: 6, code: jumper } })
|
22
24
|
|
23
|
-
my_video.add({ markers: { my_stop: { begin: 16, code: stoper } } })
|
25
|
+
my_video.add({ markers: { my_stop: { begin: 16, code: stoper } } })
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
bb =
|
4
|
-
bb.color(:
|
3
|
+
bb = text({ id: :the_ref, width: 369, data: "touch me!" })
|
4
|
+
bb.color(:orange)
|
5
5
|
box({ id: :my_box, drag: true })
|
6
6
|
c = circle({ id: :the_circle, left: 222, drag: { move: true, inertia: true, lock: :start } })
|
7
7
|
c.shadow({ renderers: [:browser], id: :shadow2, type: :shadow,
|
@@ -9,7 +9,7 @@ wait 4 do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
wait 3 do
|
12
|
-
b.children.
|
12
|
+
b.children.each do |attached_atome_id|
|
13
13
|
b.delete({id: attached_atome_id})
|
14
14
|
b.shadow({ renderers: [:browser], id: :shadow2, type: :shadow, parents: [], children: [],
|
15
15
|
left: 3, top: 9, blur: 3, direction: '',
|
@@ -24,6 +24,3 @@ wait 2 do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
|
27
|
-
wait 1 do
|
28
|
-
b.delete({id: :the_circle})
|
29
|
-
end
|
@@ -4,10 +4,10 @@ color({ red: 0.8, green: 0.8, blue: 0.8, id: :active_color })
|
|
4
4
|
color( { red: 0.3, green: 0.3, blue: 0.3, id: :inactive_color } )
|
5
5
|
|
6
6
|
b=box
|
7
|
-
b.attached(
|
7
|
+
b.attached(:inactive_color)
|
8
8
|
puts b.attached
|
9
9
|
b.touch(true) do
|
10
|
-
b.detached(
|
11
|
-
b.attached(
|
10
|
+
b.detached(:inactive_color)
|
11
|
+
b.attached(:active_color)
|
12
12
|
puts b.attached
|
13
13
|
end
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
a = box({ width: 333, height: 333, id: :the_boxy })
|
4
4
|
a.color(:red)
|
5
|
-
b =
|
6
|
-
b.parents([a.id
|
5
|
+
b = circle({ width: 33, height: 33, id: :the_box, drag: true })
|
6
|
+
b.parents([a.id])
|
7
7
|
b.color(:black)
|
8
8
|
# b.parents([:the_boxy ])
|
9
9
|
b.drag({ move: true }) do |e|
|
@@ -37,4 +37,11 @@ b.drag({ lock: :x })
|
|
37
37
|
b.drag({ constraint: :parent })
|
38
38
|
b.drag({ snap: { x: 100, y: 190 } })
|
39
39
|
|
40
|
-
# b.drag({ constraint: :the_boxy })
|
40
|
+
# b.drag({ constraint: :the_boxy })
|
41
|
+
|
42
|
+
cc=circle(drag: true)
|
43
|
+
bb=box({drag: true, color: :yellow})
|
44
|
+
|
45
|
+
bb.parents(cc.id)
|
46
|
+
|
47
|
+
# alert"#{b.parents.class} : #{b.parents}"
|
@@ -11,7 +11,7 @@ c = Atome.new(shape: { type: :shape, id: :my_pix, children: [], parents: [:view]
|
|
11
11
|
left: 50, right: 78
|
12
12
|
})
|
13
13
|
|
14
|
-
a.monitor({ atomes: grab(:view).children
|
14
|
+
a.monitor({ atomes: grab(:view).children, particles: [:left] }) do |atome, element, value|
|
15
15
|
puts "monitoring: #{atome.id}, #{element}, #{value}"
|
16
16
|
end
|
17
17
|
|
@@ -31,14 +31,14 @@ end
|
|
31
31
|
|
32
32
|
aa.box({ id: :theboxy })
|
33
33
|
|
34
|
-
aa.monitor({ atomes: grab(:view).children
|
34
|
+
aa.monitor({ atomes: grab(:view).children, particles: [:left] }) do |_atome, _element, value|
|
35
35
|
puts "the left value was change to : #{value}"
|
36
36
|
end
|
37
37
|
|
38
|
-
aa.monitor({ atomes: grab(:view).children
|
38
|
+
aa.monitor({ atomes: grab(:view).children, particles: [:width] }) do |_atome, _element, value|
|
39
39
|
puts "the width's value was change to : #{value}"
|
40
40
|
end
|
41
41
|
|
42
|
-
aa.monitor({ atomes: grab(:view).children
|
42
|
+
aa.monitor({ atomes: grab(:view).children, particles: [:left], id: :my_monitorer }) do |_atome, _element, value|
|
43
43
|
puts "the second monitor left value was log to : #{value}"
|
44
44
|
end
|
@@ -61,7 +61,7 @@ grab(:my_table_26).color(:purple)
|
|
61
61
|
# test.color(:blue)
|
62
62
|
# m.columns(6).data[0..3].color(:white)
|
63
63
|
|
64
|
-
grab(m.id
|
64
|
+
grab(m.id).drag({ move: true }) do |e|
|
65
65
|
puts e
|
66
66
|
end
|
67
67
|
wait 1 do
|
@@ -127,7 +127,7 @@ m.delete({ relations: :rel_2 })
|
|
127
127
|
# grab("my_table_9").children .each do |child|
|
128
128
|
# grab(child).color(:white)
|
129
129
|
# end
|
130
|
-
matrix_ratio=m.height
|
130
|
+
matrix_ratio=m.height/m.width
|
131
131
|
# alert prev_size
|
132
132
|
$window.on :resize do |e|
|
133
133
|
# m.top(0)
|
@@ -3,24 +3,30 @@
|
|
3
3
|
my_text = Atome.new(
|
4
4
|
text: { renderers: [:browser], id: :text1, type: :text, parents: [:view], children: [], visual: { size: 33 },
|
5
5
|
data: 'My first text!', left: 120, top: 33, width: 199, height: 33,
|
6
|
-
|
7
|
-
red: 0.6, green: 0.6, blue: 0.6, alpha: 1 }
|
6
|
+
|
8
7
|
}
|
9
8
|
)
|
10
9
|
|
10
|
+
Atome.new(color: { renderers: [:browser], id: :c31, type: :color, parents: [:text1], children: [],
|
11
|
+
red: 0.6, green: 0.6, blue: 0.6, alpha: 1 })
|
12
|
+
|
11
13
|
wait 1 do
|
12
14
|
my_text.data(:kool)
|
13
15
|
end
|
14
16
|
|
15
17
|
text({ id: :the_text, left: 0 })
|
16
18
|
|
17
|
-
text2
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
}
|
19
|
+
text2=Atome.new(
|
20
|
+
text: { renderers: [:browser], id: :text2, type: :text, parents: [:view], children: [], visual: { size: 33 },
|
21
|
+
data: 'My second text!', left: 333, top: 33, width: 199, height: 33,
|
22
|
+
|
23
|
+
}
|
23
24
|
)
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
Atome.new(color: { renderers: [:browser], id: :c33, type: :color, parents: [:text2], children: [],
|
29
|
+
red: 0.6, green: 0.6, blue: 0.1, alpha: 1 })
|
24
30
|
wait 2 do
|
25
31
|
text2.data(:ok)
|
26
32
|
end
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
separator=120
|
4
4
|
b=box({ left: separator, id: :test_box })
|
5
|
-
c=box({ left: b.left
|
6
|
-
d=box({ left: c.left
|
7
|
-
e=box({ left: d.left
|
5
|
+
c=box({ left: b.left+separator })
|
6
|
+
d=box({ left: c.left+separator })
|
7
|
+
e=box({ left: d.left+separator })
|
8
8
|
|
9
9
|
b.touch(:down) do
|
10
10
|
b.color(:red)
|
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.3.
|
4
|
+
version: 0.5.3.8.0
|
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: 2023-02-
|
11
|
+
date: 2023-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: arduino_firmata
|
@@ -394,6 +394,7 @@ files:
|
|
394
394
|
- lib/atome/atome.rb
|
395
395
|
- lib/atome/extensions/atome.rb
|
396
396
|
- lib/atome/extensions/geolocation.rb
|
397
|
+
- lib/atome/extensions/mathematic.rb
|
397
398
|
- lib/atome/extensions/matrix.rb
|
398
399
|
- lib/atome/extensions/ping.rb
|
399
400
|
- lib/atome/extensions/sha.rb
|
@@ -556,6 +557,7 @@ files:
|
|
556
557
|
- vendor/assets/src/medias/images/atome.svg
|
557
558
|
- vendor/assets/src/medias/images/ballanim.png
|
558
559
|
- vendor/assets/src/medias/images/blank.png
|
560
|
+
- vendor/assets/src/medias/images/green_planet.png
|
559
561
|
- vendor/assets/src/medias/images/icons/email.svg
|
560
562
|
- vendor/assets/src/medias/images/icons/mail_gray.svg
|
561
563
|
- vendor/assets/src/medias/images/icons/mail_green.svg
|