atome 0.5.7.0.2 → 0.5.7.0.4
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 +15 -4
- data/lib/atome/genesis/particles/material.rb +2 -0
- data/lib/atome/genesis/particles/utility.rb +15 -4
- data/lib/atome/kernel/universe.rb +2 -1
- data/lib/atome/presets/atome.rb +1 -3
- data/lib/atome/utilities/utilities.rb +20 -15
- data/lib/atome/version.rb +1 -1
- data/lib/renderers/html/html.rb +16 -0
- data/lib/renderers/html/material.rb +16 -0
- data/lib/renderers/html/property.rb +1 -5
- data/vendor/assets/application/examples/border.rb +11 -5
- data/vendor/assets/application/examples/fonts.rb +15 -0
- data/vendor/assets/application/examples/refresh.rb +1 -0
- data/vendor/assets/application/examples/selected.rb +18 -4
- data/vendor/assets/application/examples/shadow.rb +1 -1
- data/vendor/assets/src/css/style.css +4 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43a34334a41145533d60173178c7320ca20fea32690d6e26919f7dfa0553d2b0
|
4
|
+
data.tar.gz: 691dc70c3ed9c4849e5d6b597f879207528f1b88f58a948491d162e424e3091f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
|
@@ -64,14 +64,25 @@ end
|
|
64
64
|
|
65
65
|
new(particle: :selected, category: :identity, type: :boolean) do |params|
|
66
66
|
if params == true
|
67
|
-
|
68
|
-
border({ thickness:
|
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
|
-
|
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
|
-
|
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
|
@@ -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
|
-
|
37
|
-
|
38
|
-
|
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
|
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]
|
@@ -164,6 +164,10 @@ class Atome
|
|
164
164
|
|
165
165
|
end
|
166
166
|
|
167
|
+
def add_text_visual(params)
|
168
|
+
html.add_font_to_css(params)
|
169
|
+
end
|
170
|
+
|
167
171
|
def particle_main(element, params, &user_proc)
|
168
172
|
# TODO : optimise below removing all conditions if possible
|
169
173
|
if Atome.instance_variable_get("@main_#{element}").is_a?(Proc) # post is before rendering and broadcasting
|
@@ -344,23 +348,22 @@ class Atome
|
|
344
348
|
send("#{element}_callback", return_params)
|
345
349
|
end
|
346
350
|
|
347
|
-
def js_callback(id, particle, value,sub=nil
|
348
|
-
current_atome= grab(id)
|
349
|
-
|
350
|
-
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]
|
351
355
|
# proc_found= current_atome.instance_variable_get("@record_code")[:record]
|
352
|
-
|
353
|
-
|
356
|
+
# # alert particle.class
|
357
|
+
# # alert proc_found.class
|
354
358
|
# proc_found.call
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
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
363
|
# proc_found.call
|
360
364
|
|
361
365
|
end
|
362
366
|
|
363
|
-
|
364
367
|
# def callback(data)
|
365
368
|
# @callback[data.keys[0]] = data[data.keys[0]]
|
366
369
|
# end
|
@@ -385,8 +388,7 @@ class Atome
|
|
385
388
|
def particles_to_hash
|
386
389
|
hash = {}
|
387
390
|
instance_variables.each do |var|
|
388
|
-
next if %i[@html_object @history
|
389
|
-
|
391
|
+
next if %i[@html_object @history @initialized @tick @controller_proc].include?(var)
|
390
392
|
hash[var.to_s.delete('@').to_sym] = instance_variable_get(var)
|
391
393
|
end
|
392
394
|
hash
|
@@ -396,10 +398,13 @@ class Atome
|
|
396
398
|
# we get the current color because they will be removed
|
397
399
|
particles_found = particles_to_hash
|
398
400
|
particles_found.each do |particle_found, value_found|
|
401
|
+
puts "refresh : #{particle_found}, #{value_found}"
|
399
402
|
send(particle_found, value_found)
|
400
403
|
end
|
401
|
-
|
402
|
-
|
404
|
+
Universe.applicable_atomes.each do |atome_type|
|
405
|
+
send(atome_type).each do |col|
|
406
|
+
apply(col)
|
407
|
+
end
|
403
408
|
end
|
404
409
|
end
|
405
410
|
|
data/lib/atome/version.rb
CHANGED
data/lib/renderers/html/html.rb
CHANGED
@@ -37,6 +37,20 @@ class HTML
|
|
37
37
|
current_div[:innerHTML] = params
|
38
38
|
end
|
39
39
|
|
40
|
+
def add_font_to_css(params)
|
41
|
+
font_path = params[:path]
|
42
|
+
font_name = params[:name]
|
43
|
+
str_to_eval = <<STRDELIM
|
44
|
+
var styleSheet = document.styleSheets[0];
|
45
|
+
styleSheet.insertRule(`
|
46
|
+
@font-face {
|
47
|
+
font-family: '#{font_name}';
|
48
|
+
src: url('../medias/fonts/#{font_path}/#{font_name}.ttf') format('truetype');
|
49
|
+
}`, styleSheet.cssRules.length);
|
50
|
+
STRDELIM
|
51
|
+
JS.eval(str_to_eval)
|
52
|
+
end
|
53
|
+
|
40
54
|
def add_css_to_atomic_style(css)
|
41
55
|
style_element = JS.global[:document].getElementById('atomic_style')
|
42
56
|
text_node = JS.global[:document].createTextNode(css)
|
@@ -1631,9 +1645,11 @@ class HTML
|
|
1631
1645
|
name = params[:name]
|
1632
1646
|
JS.eval("recordVideo(#{duration},'#{@id}', '#{name}')")
|
1633
1647
|
end
|
1648
|
+
|
1634
1649
|
def stop_video_preview(id)
|
1635
1650
|
JS.eval("stopPreview('#{id}')")
|
1636
1651
|
end
|
1652
|
+
|
1637
1653
|
def video_preview(id, video, audio)
|
1638
1654
|
JS.eval("create_preview('#{id}','#{video}','#{audio}')")
|
1639
1655
|
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|
|
@@ -81,4 +93,8 @@ end
|
|
81
93
|
new({ method: :opacity, type: :integer, renderer: :html}) do |value|
|
82
94
|
# html.opacity(value)
|
83
95
|
html.style('opacity',value)
|
96
|
+
end
|
97
|
+
|
98
|
+
new({ method: :visual, type: :string, renderer: :html, specific: :text }) do |value, _user_proc|
|
99
|
+
html.style('fontFamily', value)
|
84
100
|
end
|
@@ -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
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# add new font face
|
4
|
+
A.add_text_visual({ path: 'Roboto', name: 'Roboto-Black' })
|
5
|
+
A.add_text_visual({ path: 'Roboto', name: 'Roboto-Thin' })
|
6
|
+
A.add_text_visual({ path: 'Roboto', name: 'Roboto-LightItalic' })
|
7
|
+
|
8
|
+
# now applying it
|
9
|
+
first_text=text({ data: :hello, component: { size: 55, visual: 'Roboto-Thin' } })
|
10
|
+
wait 1 do
|
11
|
+
text({ data: :hello, component: { size: 55, visual: 'Roboto-Black' } })
|
12
|
+
wait 1 do
|
13
|
+
first_text.component({visual: 'Roboto-LightItalic'})
|
14
|
+
end
|
15
|
+
end
|
@@ -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)
|
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.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-
|
11
|
+
date: 2024-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: artoo
|
@@ -578,6 +578,7 @@ files:
|
|
578
578
|
- vendor/assets/application/examples/fill.rb
|
579
579
|
- vendor/assets/application/examples/find.rb
|
580
580
|
- vendor/assets/application/examples/fit.rb
|
581
|
+
- vendor/assets/application/examples/fonts.rb
|
581
582
|
- vendor/assets/application/examples/generator_and_build.rb
|
582
583
|
- vendor/assets/application/examples/getter.rb
|
583
584
|
- vendor/assets/application/examples/grab.rb
|