atome 0.5.6.2.4 → 0.5.6.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/atome.gemspec +4 -0
- data/lib/atome/atome.rb +7 -1
- data/lib/atome/extensions/atome.rb +83 -13
- data/lib/atome/genesis/generators/event.rb +11 -0
- data/lib/atome/genesis/generators/hierarchy.rb +6 -5
- data/lib/atome/genesis/generators/identity.rb +17 -8
- data/lib/atome/genesis/sparkle.rb +12 -7
- data/lib/atome/kernel/universe.rb +16 -3
- data/lib/atome/presets/atome.rb +3 -2
- data/lib/atome/version.rb +1 -1
- data/lib/atome.rb +1 -1
- data/lib/atome_relative.rb +2 -1
- data/lib/eVe/eVe.rb +4 -1
- data/lib/eVe/eVe_relative.rb +4 -1
- data/lib/eVe/lib/examples/site.rb +34 -0
- data/lib/eVe/lib/init.rb +54 -0
- data/lib/eVe/lib/intuition/inputs.rb +111 -0
- data/lib/eVe/lib/intuition/sliders.rb +49 -0
- data/lib/eVe/lib/intuition/toolbox.rb +280 -0
- data/lib/eVe/lib/version.rb +11 -0
- data/lib/renderers/html/html.rb +2 -2
- data/vendor/assets/application/examples/animation.rb +2 -7
- data/vendor/assets/application/examples/attached.rb +9 -2
- data/vendor/assets/application/examples/basic_understanding.rb +2 -0
- data/vendor/assets/application/examples/category.rb +6 -2
- data/vendor/assets/application/examples/database_handling.rb +39 -39
- data/vendor/assets/application/examples/find.rb +5 -4
- data/vendor/assets/application/examples/random.rb +3 -3
- data/vendor/assets/application/examples/repeat.rb +1 -1
- data/vendor/assets/application/examples/test.rb +1 -6
- data/vendor/assets/server/eDen.rb +54 -25
- data/vendor/assets/src/index_wasm.html +6 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9034e0154aea8e0b9824eaf694efc80cee092201b66eaf4b053792c9bc0ee2a8
|
4
|
+
data.tar.gz: a8353fdc49263c322bd90e0d709b2ee18dd6052726bec4979c90d5e40578d2b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61338bfdb8ee585fa20a979e3587e3d8ee33e488ef307ead2049fbe1c3aaac4013ac6d40b0f039f7926dab5650c021369b8d61097938e9beefc355995d33c0d2
|
7
|
+
data.tar.gz: cf616fa2d32ffb36f8f67e1b31442488262df2577a7fc57b5ce0ab0107cebdb91deb86aca049e3ce876716779d937675ebdd7ee95d8e9dc21c8a11b01a6a0809
|
data/atome.gemspec
CHANGED
@@ -78,6 +78,10 @@ Gem::Specification.new do |spec|
|
|
78
78
|
# the gem below are need to make the atome server works on Windows
|
79
79
|
spec.add_runtime_dependency 'tzinfo-data', '~> 1.2023.4'
|
80
80
|
spec.add_runtime_dependency 'win32-security', '~> 0.5.0'
|
81
|
+
spec.add_runtime_dependency 'wdm', '>= 0.1.0' if Gem.win_platform?
|
82
|
+
|
83
|
+
# patch because guard have bad dependency
|
84
|
+
# spec.add_runtime_dependency 'pry', '>= 0.14.2'
|
81
85
|
|
82
86
|
# Uncomment to register a new dependency of your gem
|
83
87
|
# spec.add_dependency "example-gem", "~> 1.0"
|
data/lib/atome/atome.rb
CHANGED
@@ -4,6 +4,9 @@
|
|
4
4
|
class Atome
|
5
5
|
include Essentials
|
6
6
|
|
7
|
+
def aid(_v=nil)
|
8
|
+
@aid
|
9
|
+
end
|
7
10
|
def initialize(new_atome = {}, &atomes_proc)
|
8
11
|
# TODO: atome format should always be as followed : {value: 0.44, unit: :px, opt1: 554}
|
9
12
|
# when using optimised version of atome you must type eg : a.set({left: {value: 33, unit: '%', reference: :center}})
|
@@ -20,7 +23,10 @@ class Atome
|
|
20
23
|
@collect = {}
|
21
24
|
@int8= {}
|
22
25
|
@css = {}
|
23
|
-
@
|
26
|
+
@aid = identity_generator(:a)
|
27
|
+
Universe.add_to_atomes( @aid, self)
|
28
|
+
@id = new_atome[:id] || @aid
|
29
|
+
Universe.id_to_aid(@id,@aid)
|
24
30
|
@type = new_atome[:type] || :element
|
25
31
|
@attached = []
|
26
32
|
@category = []
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
module ObjectExtension
|
2
3
|
|
3
|
-
# atome extensions
|
4
|
-
class Object
|
5
4
|
def new(params, &bloc)
|
6
5
|
# Genesis = Genesis.Genesis
|
7
6
|
if params.key?(:atome)
|
@@ -42,15 +41,69 @@ class Object
|
|
42
41
|
end
|
43
42
|
render_method = "#{renderer_found}_#{params[:specific]}#{params[:method]}"
|
44
43
|
Genesis.build_render(render_method, &bloc)
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
44
|
+
# elsif params.key?(:callback)
|
45
|
+
# particle_targetted = params[:callback]
|
46
|
+
# Atome.define_method("#{particle_targetted}_callback", option) do
|
47
|
+
# alert option
|
48
|
+
# bloc.call(option)
|
49
|
+
# end
|
51
50
|
end
|
51
|
+
super if defined?(super)
|
52
52
|
end
|
53
53
|
|
54
|
+
end
|
55
|
+
# atome extensions
|
56
|
+
class Object
|
57
|
+
include ObjectExtension
|
58
|
+
# def new(params, &bloc)
|
59
|
+
# # Genesis = Genesis.Genesis
|
60
|
+
# if params.key?(:atome)
|
61
|
+
# if Universe.atome_list.include?(params[:atome])
|
62
|
+
# puts "atome #{params[:atome]} already exist you can't create it"
|
63
|
+
# else
|
64
|
+
# Universe.add_atomes_specificities params[:atome]
|
65
|
+
# Genesis.build_atome(params[:atome], &bloc)
|
66
|
+
# end
|
67
|
+
# elsif params.key?(:particle)
|
68
|
+
# if Universe.particle_list[params[:particle]]
|
69
|
+
# puts "particle #{params[:particle]} already exist you can't create it"
|
70
|
+
# else
|
71
|
+
# Atome.instance_variable_set("@main_#{params[:particle]}", bloc)
|
72
|
+
# # render indicate if the particle needs to be rendered
|
73
|
+
# # store tell the system if it need to store the particle value
|
74
|
+
# # type help the system what type of type the particle will receive and store
|
75
|
+
# Genesis.build_particle(params[:particle], { render: params[:render], return: params[:return],
|
76
|
+
# store: params[:store], type: params[:type],
|
77
|
+
# category: params[:category] }, &bloc)
|
78
|
+
# end
|
79
|
+
#
|
80
|
+
# elsif params.key?(:sanitizer)
|
81
|
+
# Genesis.build_sanitizer(params[:sanitizer], &bloc)
|
82
|
+
# elsif params.key?(:pre)
|
83
|
+
# Atome.instance_variable_set("@pre_#{params[:pre]}", bloc)
|
84
|
+
# elsif params.key?(:post)
|
85
|
+
# Atome.instance_variable_set("@post_#{params[:post]}", bloc)
|
86
|
+
# elsif params.key?(:after)
|
87
|
+
# Atome.instance_variable_set("@after_#{params[:after]}", bloc)
|
88
|
+
# elsif params.key?(:read)
|
89
|
+
# Atome.instance_variable_set("@read_#{params[:read]}", bloc)
|
90
|
+
# elsif params[:renderer]
|
91
|
+
# renderer_found = params[:renderer]
|
92
|
+
# if params[:specific]
|
93
|
+
# Universe.set_atomes_specificities(params)
|
94
|
+
# params[:specific] = "#{params[:specific]}_"
|
95
|
+
# end
|
96
|
+
# render_method = "#{renderer_found}_#{params[:specific]}#{params[:method]}"
|
97
|
+
# Genesis.build_render(render_method, &bloc)
|
98
|
+
# # elsif params.key?(:callback)
|
99
|
+
# # particle_targetted = params[:callback]
|
100
|
+
# # Atome.define_method("#{particle_targetted}_callback", option) do
|
101
|
+
# # alert option
|
102
|
+
# # bloc.call(option)
|
103
|
+
# # end
|
104
|
+
# end
|
105
|
+
# end
|
106
|
+
|
54
107
|
def reorder_particles(hash_to_reorder)
|
55
108
|
# we reorder the hash
|
56
109
|
ordered_keys = %i[renderers id alien type attach int8 unit]
|
@@ -67,15 +120,32 @@ class Object
|
|
67
120
|
end
|
68
121
|
|
69
122
|
def identity_generator(type_needed = :element)
|
70
|
-
"#{type_needed}_#{Universe.counter}"
|
123
|
+
"#{type_needed}_#{Universe.counter}".to_sym
|
124
|
+
end
|
125
|
+
|
126
|
+
def hook(a_id)
|
127
|
+
a_id=a_id.to_sym
|
128
|
+
Universe.atomes[a_id]
|
71
129
|
end
|
72
130
|
|
73
131
|
def grab(id_to_get)
|
132
|
+
id_to_get=id_to_get.to_sym
|
74
133
|
return if id_to_get == false
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
134
|
+
aid_to_get= Universe.atomes_ids[id_to_get]
|
135
|
+
# puts id_to_get.class
|
136
|
+
# alert Universe.atomes
|
137
|
+
aid_to_get = '' if aid_to_get.instance_of? Array
|
138
|
+
# id_to_get = id_to_get.to_sym
|
139
|
+
|
140
|
+
# if id_to_get.nil? do
|
141
|
+
# if aid_to_get.nil?
|
142
|
+
# alert id_to_get
|
143
|
+
# else
|
144
|
+
|
145
|
+
# end
|
146
|
+
# end
|
147
|
+
# alert Universe.atomes[id_to_get]
|
148
|
+
Universe.atomes[aid_to_get]
|
79
149
|
end
|
80
150
|
|
81
151
|
def box(params = {}, &proc)
|
@@ -322,3 +322,14 @@ new({ particle: :overflow, category: :event, type: :boolean }) do |params, bloc|
|
|
322
322
|
params
|
323
323
|
|
324
324
|
end
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
new({particle: :animate , category: :event, type: :hash}) do |params|
|
329
|
+
if params.instance_of? Hash
|
330
|
+
params={ from: 0, to: 300, duration: 1000 }.merge(params)
|
331
|
+
else
|
332
|
+
params={ from: 0, to: 300, duration: 1000 }
|
333
|
+
end
|
334
|
+
html.play_animation(params)
|
335
|
+
end
|
@@ -7,11 +7,12 @@ def detach_child(child)
|
|
7
7
|
|
8
8
|
end
|
9
9
|
|
10
|
-
def detach_from_parent(parent_found, child_found)
|
11
|
-
|
12
|
-
end
|
10
|
+
# def detach_from_parent(parent_found, child_found)
|
11
|
+
# child_found.attach(parent_found.id)
|
12
|
+
# end
|
13
13
|
|
14
14
|
def attachment_common(child_id, parents_id, direction, &user_proc)
|
15
|
+
|
15
16
|
parent_found = grab(parents_id)
|
16
17
|
if direction == :attach
|
17
18
|
if parent_found
|
@@ -21,11 +22,11 @@ def attachment_common(child_id, parents_id, direction, &user_proc)
|
|
21
22
|
render(:attach, parents_id, &user_proc)
|
22
23
|
else
|
23
24
|
# we remove the current id from parent
|
24
|
-
grab(attach).attached.delete(@id)
|
25
|
+
# grab(attach).attached.delete(@id)
|
25
26
|
end
|
26
27
|
else
|
27
28
|
child_found = grab(child_id)
|
28
|
-
|
29
|
+
child_found.attach(parents_id)
|
29
30
|
child_found.render(:attach, parents_id, &user_proc)
|
30
31
|
end
|
31
32
|
end
|
@@ -5,11 +5,20 @@ new({ particle: :type, category: :identity, type: :string })
|
|
5
5
|
new({ particle: :id, category: :identity, type: :int })
|
6
6
|
new({ sanitizer: :id }) do |params|
|
7
7
|
# first we sanitize the the id below
|
8
|
+
|
8
9
|
params = params.to_sym
|
9
|
-
|
10
|
-
|
10
|
+
# we check id is already assign
|
11
|
+
if Universe.atomes[params]
|
12
|
+
# we reassign the old id
|
13
|
+
puts "the id : #{params} is already used"
|
14
|
+
params = @id
|
11
15
|
else
|
12
|
-
|
16
|
+
if @id.to_sym != params
|
17
|
+
Universe.update_atome_id(params, self, @id)
|
18
|
+
else
|
19
|
+
Universe.add_to_atomes(params, self)
|
20
|
+
end
|
21
|
+
|
13
22
|
end
|
14
23
|
params
|
15
24
|
end
|
@@ -31,12 +40,12 @@ new({ particle: :active, category: :identity, type: :boolean })
|
|
31
40
|
# end
|
32
41
|
# end
|
33
42
|
new({ particle: :markup, category: :identity, type: :string })
|
34
|
-
new({particle: :bundle, category: :identity, type: :string})
|
43
|
+
new({ particle: :bundle, category: :identity, type: :string })
|
35
44
|
new({ particle: :data, category: :identity, type: :string })
|
36
45
|
|
37
|
-
new({particle: :category, category: :identity, type: :string, store: false}) do |category_names|
|
38
|
-
category_names=[category_names] unless category_names.instance_of? Array
|
39
|
-
category_names.each do |category_name|
|
46
|
+
new({ particle: :category, category: :identity, type: :string, store: false }) do |category_names|
|
47
|
+
category_names = [category_names] unless category_names.instance_of? Array
|
48
|
+
category_names.each do |category_name|
|
40
49
|
@category << category_name
|
41
50
|
end
|
42
51
|
end
|
@@ -61,6 +70,6 @@ new(particle: :selected, category: :identity, type: :boolean) do |params|
|
|
61
70
|
end
|
62
71
|
|
63
72
|
new({ particle: :format, category: :identity, type: :string })
|
64
|
-
new({ particle: :alien, category: :identity, type: :string }) #special particel that old alien object
|
73
|
+
new({ particle: :alien, category: :identity, type: :string }) # special particel that old alien object
|
65
74
|
|
66
75
|
new({ particle: :email, category: :identity, type: :string })
|
@@ -154,22 +154,27 @@ def init_database # this method is call from JS (atome/communication)
|
|
154
154
|
|
155
155
|
particles = Universe.particle_list
|
156
156
|
categories = Universe.categories
|
157
|
+
# here we populate the DB
|
157
158
|
categories.each do |category|
|
158
159
|
A.message({ action: :crate_db_table, data: { table: category } }) do |db_state|
|
159
|
-
puts db_state
|
160
|
+
# puts db_state
|
160
161
|
end
|
161
162
|
end
|
162
163
|
particles_length=particles.length
|
163
164
|
particles.each_with_index do |(particle, infos), index|
|
164
165
|
type = infos[:type]
|
165
166
|
table = infos[:category]
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
167
|
+
if type && table
|
168
|
+
@i=1
|
169
|
+
A.message({ action: :create_db_column, data: { table: table, column: particle, type: type } }) do |db_state|
|
170
|
+
@i+=1
|
171
|
+
if @i==particles_length
|
172
|
+
user_login
|
173
|
+
end
|
174
|
+
# puts db_state
|
171
175
|
end
|
172
|
-
|
176
|
+
else
|
177
|
+
puts "*** Warning feed type and category to #{particle}"
|
173
178
|
end
|
174
179
|
|
175
180
|
end
|
@@ -4,6 +4,7 @@
|
|
4
4
|
class Universe
|
5
5
|
@counter = 0
|
6
6
|
@atomes = {}
|
7
|
+
@atomes_ids = {}
|
7
8
|
@atome_list = []
|
8
9
|
@particle_list = {}
|
9
10
|
@renderer_list = %i[html browser headless server log]
|
@@ -19,12 +20,20 @@ class Universe
|
|
19
20
|
@example = {}
|
20
21
|
|
21
22
|
class << self
|
22
|
-
attr_reader :atomes, :renderer_list, :atome_list, :particle_list, :classes, :counter, :atomes_specificities
|
23
|
+
attr_reader :atomes,:atomes_ids, :renderer_list, :atome_list, :particle_list, :classes, :counter, :atomes_specificities
|
23
24
|
|
24
25
|
def messages
|
25
26
|
@messages
|
26
27
|
end
|
27
28
|
|
29
|
+
def eVe(val = nil)
|
30
|
+
if val
|
31
|
+
@eve = val
|
32
|
+
else
|
33
|
+
@eve
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
28
37
|
def store_messages(new_msg)
|
29
38
|
@messages[new_msg[:msg_nb]] = new_msg[:proc]
|
30
39
|
end
|
@@ -85,11 +94,15 @@ class Universe
|
|
85
94
|
instance_variable_get('@atome_list').push(atome)
|
86
95
|
end
|
87
96
|
|
88
|
-
def add_to_atomes(
|
89
|
-
@atomes[
|
97
|
+
def add_to_atomes(aid, atome)
|
98
|
+
@atomes[aid] = atome
|
90
99
|
@counter = @counter + 1
|
91
100
|
end
|
92
101
|
|
102
|
+
def id_to_aid(id, aid)
|
103
|
+
@atomes_ids[id] = aid
|
104
|
+
end
|
105
|
+
|
93
106
|
def update_atome_id(id, atome, prev_id)
|
94
107
|
@atomes[id] = atome
|
95
108
|
@atomes.delete(prev_id)
|
data/lib/atome/presets/atome.rb
CHANGED
@@ -14,6 +14,7 @@ class Atome
|
|
14
14
|
preset_params = Essentials.default_params[atome_preset] || {}
|
15
15
|
|
16
16
|
basic_params[:type] = preset_params[:type] || :element
|
17
|
+
# basic_params[:aid] = identity_generator(:a)
|
17
18
|
basic_params[:id] = params[:id] || identity_generator(atome_preset)
|
18
19
|
basic_params[:renderers] = @renderers || preset_params[:renderers]
|
19
20
|
essential_params = basic_params.merge(preset_params)
|
@@ -40,8 +41,8 @@ class Atome
|
|
40
41
|
end
|
41
42
|
|
42
43
|
def preset_common(params, &bloc)
|
43
|
-
|
44
|
-
params[:id] = "#{params[:id]}_#{Universe.atomes.length}" if grab(params[:id])
|
44
|
+
## if an atome with current id exist we update the ID in the params
|
45
|
+
# params[:id] = "#{params[:id]}_#{Universe.atomes.length}" if grab(params[:id])
|
45
46
|
Atome.new(params, &bloc)
|
46
47
|
end
|
47
48
|
|
data/lib/atome/version.rb
CHANGED
data/lib/atome.rb
CHANGED
data/lib/atome_relative.rb
CHANGED
@@ -32,5 +32,6 @@ require_relative './renderers/html/index_relative'
|
|
32
32
|
require_relative './renderers/headless/index_relative'
|
33
33
|
require_relative './renderers/server/index_relative'
|
34
34
|
require_relative './atome/helpers/sanitizer'
|
35
|
-
require_relative './eVe/eVe_relative'
|
36
35
|
require_relative './atome/genesis/sparkle'
|
36
|
+
require_relative './eVe/eVe_relative'
|
37
|
+
|
data/lib/eVe/eVe.rb
CHANGED
data/lib/eVe/eVe_relative.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
|
2
|
+
new(application: {name: :compose })
|
3
|
+
|
4
|
+
|
5
|
+
grab(:toto).color(:cyan)
|
6
|
+
|
7
|
+
def layout
|
8
|
+
compose_back=box
|
9
|
+
|
10
|
+
compose_back.color({ alpha: 0 })
|
11
|
+
media_reader=compose_back.box({left: 99, width: 250, height: 250, top: 99})
|
12
|
+
viewer_1=compose_back.box({left: 360, width: 250, height: 250, top: 99})
|
13
|
+
viewer_2=compose_back.box({left: 690, width: 250, height: 250, top: 99})
|
14
|
+
timeline=compose_back.box({left: 99, width: 250, height: 250, top: 399})
|
15
|
+
login=compose_back.text(:log)
|
16
|
+
login.touch(true) do
|
17
|
+
compose_back.delete(true)
|
18
|
+
# grab(:view).clear(true)
|
19
|
+
form
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
def form
|
25
|
+
form1=box
|
26
|
+
form1.text(:login)
|
27
|
+
|
28
|
+
form1.touch(true) do
|
29
|
+
form1.delete(true)
|
30
|
+
layout
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
form
|
data/lib/eVe/lib/init.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Universe.eVe(true)
|
4
|
+
puts "eVe version : #{EVe::VERSION}"
|
5
|
+
|
6
|
+
module EVe
|
7
|
+
def new(params, &bloc)
|
8
|
+
if params[:page]
|
9
|
+
site_found = grab(params[:page][:application])
|
10
|
+
site_found.clear(true)
|
11
|
+
page_id = params[:page][:name]
|
12
|
+
site_found.box({ id: page_id })
|
13
|
+
elsif params[:application]
|
14
|
+
|
15
|
+
footer_header_size=33
|
16
|
+
footer_header_color=color({red: 0, green: 0, blue: 0, id: :footer_header_color})
|
17
|
+
|
18
|
+
if params[:header]
|
19
|
+
top = footer_header_size
|
20
|
+
header=box({ left: 0, right: 0, width: :auto, top: 0, height: top, id: :header })
|
21
|
+
# header.attach(:footer_header_color)
|
22
|
+
else
|
23
|
+
top = 0
|
24
|
+
end
|
25
|
+
if params[:footer]
|
26
|
+
bottom = footer_header_size
|
27
|
+
box({ left: 0, right: 0, width: :auto, top: :auto, bottom: 0, height: bottom, id: :footer })
|
28
|
+
else
|
29
|
+
bottom = 0
|
30
|
+
end
|
31
|
+
box({ left: 0, right: 0, width: :auto, top: top, bottom: bottom, height: :auto, id: params[:application] })
|
32
|
+
elsif params[:module]
|
33
|
+
|
34
|
+
end
|
35
|
+
super if defined?(super)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
class Object
|
40
|
+
include EVe
|
41
|
+
end
|
42
|
+
|
43
|
+
# tests
|
44
|
+
new({application: :compose, header: true, footer: true })
|
45
|
+
|
46
|
+
# new(page: {name: :home, application: :compose, attach: :root })
|
47
|
+
|
48
|
+
# new(module: {name: :home, application: :compose, attach: :root })
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
|
@@ -0,0 +1,111 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# def atome_common(atome_preset, params)
|
4
|
+
# basic_params = { renderers: [] }
|
5
|
+
# # TODO : remove Essentials.default_params[atome_preset] || {} as it is
|
6
|
+
# # applied twice because preset is now a particle
|
7
|
+
# preset_params = Essentials.default_params[atome_preset] || {}
|
8
|
+
#
|
9
|
+
# basic_params[:type] = preset_params[:type] || :element
|
10
|
+
# basic_params[:id] = params[:id] || identity_generator(atome_preset)
|
11
|
+
# basic_params[:renderers] = @renderers || preset_params[:renderers]
|
12
|
+
# essential_params = basic_params.merge(preset_params)
|
13
|
+
# reordered_params = essential_params.reject { |key, _| params.has_key?(key) }
|
14
|
+
# params = reordered_params.merge(params)
|
15
|
+
#
|
16
|
+
# # condition to handle color/shadow/paint atomes that shouldn't be attach to view
|
17
|
+
# # TODO : add category for atome( material/physical vs modifier : color, shadow, .. vs shape, image ..)
|
18
|
+
# # then add condition same things fo code in genesis new_atome
|
19
|
+
# if %i[color shadow paint].include?(atome_preset)
|
20
|
+
# unless params[:affect]
|
21
|
+
# params[:affect] = if @id == :view
|
22
|
+
# [:black_matter]
|
23
|
+
# else
|
24
|
+
# [@id]
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
# else
|
28
|
+
# params[:attach] = params[:attach] || @id || :view
|
29
|
+
# end
|
30
|
+
# params
|
31
|
+
# end
|
32
|
+
#
|
33
|
+
# def preset_common(params, &bloc)
|
34
|
+
# # if an atome with current id exist we update the ID in the params
|
35
|
+
# params[:id] = "#{params[:id]}_#{Universe.atomes.length}" if grab(params[:id])
|
36
|
+
# Atome.new(params, &bloc)
|
37
|
+
# end
|
38
|
+
# class EVe < Atome
|
39
|
+
class EVe < Atome
|
40
|
+
def initialize
|
41
|
+
@atomes = {}
|
42
|
+
end
|
43
|
+
|
44
|
+
def atome(atome_to_find)
|
45
|
+
@atomes[atome_to_find]
|
46
|
+
end
|
47
|
+
|
48
|
+
def input_box(params = {}, &bloc)
|
49
|
+
height_wanted = 15
|
50
|
+
width_wanted = 222
|
51
|
+
input_back = Atome.new(
|
52
|
+
{ renderers: [:html], id: :input_back, type: :shape, attach: :view, apply: [:shape_color],
|
53
|
+
left: 120, top: 120,data: '', width: width_wanted, height: height_wanted + height_wanted * 20 / 100, smooth: 6 })
|
54
|
+
|
55
|
+
@atomes[:input_back] = input_back
|
56
|
+
|
57
|
+
Atome.new(
|
58
|
+
{ renderers: [:html], id: :input_text_color, type: :color, tag: ({ system: true, persistent: true }),
|
59
|
+
red: 0.1, green: 0.1, blue: 0.1, alpha: 1 }
|
60
|
+
)
|
61
|
+
|
62
|
+
text_input = Atome.new(
|
63
|
+
{ renderers: [:html], id: :input_text, type: :text, apply: [:input_text_color], component: { size: height_wanted },
|
64
|
+
data: :input, left: height_wanted * 20 / 100, top: 0, edit: true, attach: :input_back, height: height_wanted, position: :absolute })
|
65
|
+
|
66
|
+
text_input.touch(true) do
|
67
|
+
text_input.component({ selected: { color: 'rgba(0,0,0,0.3)', text: :orange } })
|
68
|
+
end
|
69
|
+
|
70
|
+
text_input.keyboard(:down) do |native_event|
|
71
|
+
event = Native(native_event)
|
72
|
+
if event[:keyCode].to_s == '13'
|
73
|
+
# we prevent the input
|
74
|
+
event.preventDefault()
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
text_input.keyboard(:up) do |native_event|
|
80
|
+
input_back.data=text_input.data
|
81
|
+
end
|
82
|
+
@atomes[:input_text] = text_input
|
83
|
+
|
84
|
+
input_back
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
def input(params = {}, &proc)
|
90
|
+
text_color = :white
|
91
|
+
text_size = 12
|
92
|
+
back_color = :gray
|
93
|
+
width = 2000
|
94
|
+
in_b = EVe.new()
|
95
|
+
in_b.input_box
|
96
|
+
end
|
97
|
+
|
98
|
+
i= input
|
99
|
+
|
100
|
+
b=box({top: 0, left: 0, width: 33, height: 33})
|
101
|
+
b.touch(true) do
|
102
|
+
puts "i.data : #{i.data}"
|
103
|
+
end
|
104
|
+
i.left(66)
|
105
|
+
i.color(:white)
|
106
|
+
i.text.left(55)
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
button = box({smooth: 6,left: 55,top: 160, color:{red: 0.3, green: 0.3, blue: 0.3},id: :my_box})
|
4
|
+
button.shadow({
|
5
|
+
id: :s1,
|
6
|
+
left: 3, top: 3, blur: 9,
|
7
|
+
invert: true,
|
8
|
+
red: 0, green: 0, blue: 0, alpha: 0.7
|
9
|
+
})
|
10
|
+
button.touch(true) do
|
11
|
+
button.controller(:hello)
|
12
|
+
end
|
13
|
+
slider=box({ width: 333, height: 25, top: 45, left: 55, smooth: 9, color:{red: 0.3, green: 0.3, blue: 0.3}})
|
14
|
+
slider.shadow({
|
15
|
+
id: :s2,
|
16
|
+
left: 3, top: 3, blur: 9,
|
17
|
+
invert: true,
|
18
|
+
red: 0, green: 0, blue: 0, alpha: 0.7
|
19
|
+
})
|
20
|
+
cursor= slider.circle({width: 30, height: 30, left: 2, top: 1, color:{red: 0.3, green: 0.3, blue: 0.3}})
|
21
|
+
|
22
|
+
cursor.left(0)
|
23
|
+
cursor.top(0)
|
24
|
+
cursor.shadow({
|
25
|
+
id: :s4,
|
26
|
+
left: 1, top: 1, blur: 3,
|
27
|
+
option: :natural,
|
28
|
+
red: 0, green: 0, blue: 0, alpha: 0.6
|
29
|
+
})
|
30
|
+
label=text({data: 0, top: 69, left: 69, component: { size: 12 }, color: :gray})
|
31
|
+
cursor.drag({ restrict: {max:{ left: 309, top: 0}} }) do |event|
|
32
|
+
puts cursor.left
|
33
|
+
value = cursor.left/309*100
|
34
|
+
label.data(value)
|
35
|
+
cursor.controller({ action: :setModuleParameterValue, params: { moduleId: 6456549897,parameterId: 9846546, value: value} })
|
36
|
+
|
37
|
+
end
|
38
|
+
support=box({top: 300, left: 55, width: 300, height: 40, smooth: 9, color:{red: 0.3, green: 0.3, blue: 0.3}, id: :support })
|
39
|
+
support.shadow({
|
40
|
+
id: :s3,
|
41
|
+
left: 3, top: 3, blur: 9,
|
42
|
+
invert: true,
|
43
|
+
red: 0, green: 0, blue: 0, alpha: 0.7
|
44
|
+
})
|
45
|
+
support.import(true) do |content|
|
46
|
+
puts "add code here, content: #{content}"
|
47
|
+
end
|
48
|
+
|
49
|
+
in_box=input_box
|