atome 0.5.7.1.0 → 0.5.7.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/documentation/deep learning/basic_infos.txt +1 -1
- data/lib/atome/extensions/atome.rb +9 -19
- data/lib/atome/genesis/atomes.rb +11 -0
- data/lib/atome/genesis/particles/property.rb +3 -1
- data/lib/atome/genesis/sparkle.rb +2 -1
- data/lib/atome/kernel/universe.rb +2 -1
- data/lib/atome/presets/atome.rb +5 -14
- data/lib/atome/version.rb +1 -1
- data/lib/renderers/html/hierarchy.rb +2 -2
- data/lib/renderers/html/html.rb +44 -17
- data/lib/renderers/html/identity.rb +4 -1
- data/lib/renderers/html/material.rb +10 -10
- data/lib/renderers/html/property.rb +5 -0
- data/lib/renderers/html/utility.rb +1 -1
- data/vendor/assets/application/examples/audio.rb +70 -0
- data/vendor/assets/application/examples/hypertext.rb +24 -3
- data/vendor/assets/application/examples/rotate.rb +8 -0
- data/vendor/assets/application/examples/test.rb +146 -572
- data/vendor/assets/application/examples/text_align.rb +3 -0
- data/vendor/assets/application/examples/tools.rb +46 -31
- data/vendor/assets/src/index.html +14 -6
- data/vendor/assets/src/index_opal.html +16 -7
- data/vendor/assets/src/index_server.html +20 -0
- data/vendor/assets/src/index_server_wasm.html +14 -6
- data/vendor/assets/src/index_wasm.html +20 -12
- data/vendor/assets/src/js/third_parties/wavesurfer.min.js +1 -0
- data/vendor/assets/src/js/third_parties/webaudio-pianoroll.min.js +66 -0
- data/vendor/assets/src/medias/images/icons/module.svg +6 -0
- data/vendor/assets/src/medias/images/utils/full_keyboard.svg +50 -0
- data/vendor/assets/src/medias/images/utils/keyboard.svg +29 -0
- data/vendor/assets/src/medias/images/utils/notes.svg +28 -0
- metadata +12 -3
@@ -1,584 +1,158 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
#
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
def add_tool_actions(tool_name, tool_content)
|
42
|
-
# alert "tool_content is : tool_content#{tool_content}"
|
43
|
-
# int8_f=tool_content[:int8]
|
44
|
-
# activation_f=tool_content[:active]
|
45
|
-
# inactivation_f=tool_content[:inactive]
|
46
|
-
# creator=tool_content[:creation]
|
47
|
-
# alterator=tool_content[:alteration]
|
48
|
-
@tools_actions_to_exec[tool_name] = tool_content
|
49
|
-
end
|
50
|
-
|
51
|
-
def tool_actions_to_exec
|
52
|
-
@tools_actions_to_exec
|
53
|
-
end
|
54
|
-
|
55
|
-
def activate_click_analysis
|
56
|
-
|
57
|
-
# the condition below avoid touchdown analysis accumulation
|
58
|
-
unless @click_analysis_active
|
59
|
-
# this method analyse all object under the touchdown to find the first user objet and return it's id
|
60
|
-
|
61
|
-
@click_analysis = lambda { |native_event|
|
62
|
-
# the instance variable below check if we can apply tool (cf: if the atome we don't want to apply tool)
|
63
|
-
if Universe.allow_tool_operations
|
64
|
-
event = Native(native_event)
|
65
|
-
x = event[:clientX]
|
66
|
-
y = event[:clientY]
|
67
|
-
elements = JS.global[:document].elementsFromPoint(x, y)
|
68
|
-
elements.to_a.each do |element|
|
69
|
-
id_found = element[:id].to_s
|
70
|
-
atome_touched = grab(id_found)
|
71
|
-
if grab(id_found) && grab(id_found).tag[:system]
|
72
|
-
else
|
73
|
-
@creations_f = []
|
74
|
-
@alterations_f = []
|
75
|
-
current_tool = ''
|
76
|
-
@tools_actions_to_exec.each do |tool_name, actions|
|
77
|
-
current_tool = grab(tool_name)
|
78
|
-
@creations_f = @creations_f.concat(actions[:creation]) if actions[:creation] # Concaténation
|
79
|
-
@alterations_f = @alterations_f.concat(actions[:alteration]) if actions[:alteration] # Concaténation
|
80
|
-
end
|
81
|
-
# Creation below
|
82
|
-
@creations_f.each do |create_content|
|
83
|
-
code_before_applying = create_content[:pre]
|
84
|
-
code_after_applying = create_content[:post]
|
85
|
-
instance_exec(atome_touched,event,&code_before_applying) if code_before_applying.is_a? Proc
|
86
|
-
atome_type = create_content[:type]
|
87
|
-
particles = create_content[:particles]
|
88
|
-
new_atome = grab(:view).send(atome_type)
|
89
|
-
particles.each do |particle_found, value_found|
|
90
|
-
new_atome.send(particle_found, value_found)
|
91
|
-
end
|
92
|
-
new_atome.resize(true)
|
93
|
-
new_atome.drag(true)
|
94
|
-
new_atome.left(event[:pageX].to_i)
|
95
|
-
new_atome.top(event[:pageY].to_i)
|
96
|
-
current_tool.data << new_atome
|
97
|
-
instance_exec(atome_touched,new_atome,event,&code_after_applying) if code_after_applying.is_a? Proc
|
98
|
-
|
99
|
-
# now applying alterations on new atome if needed:
|
100
|
-
@alterations_f.each do |actions_f|
|
101
|
-
code_before_applying = actions_f[:pre]
|
102
|
-
code_after_applying = actions_f[:post]
|
103
|
-
instance_exec(new_atome,event,&code_before_applying) if code_before_applying.is_a? Proc
|
104
|
-
action = actions_f[:particle]
|
105
|
-
value = actions_f[:value]
|
106
|
-
new_atome.send(action, value)
|
107
|
-
instance_exec(new_atome,event,&code_after_applying) if code_after_applying.is_a? Proc
|
108
|
-
end
|
109
|
-
|
110
|
-
|
111
|
-
end
|
112
|
-
if atome_touched
|
113
|
-
@alterations_f.each do |actions_f|
|
114
|
-
code_before_applying = actions_f[:pre]
|
115
|
-
code_after_applying = actions_f[:post]
|
116
|
-
instance_exec(nil,event,&code_before_applying) if code_before_applying.is_a? Proc
|
117
|
-
action = actions_f[:particle]
|
118
|
-
value = actions_f[:value]
|
119
|
-
atome_touched.send(action, value)
|
120
|
-
instance_exec(nil,event,&code_after_applying) if code_after_applying.is_a? Proc
|
121
|
-
end
|
122
|
-
# Atome.instance_exec(id_found, x, y, &@click_analysis_action) if @click_analysis_action.is_a?(Proc)
|
123
|
-
end
|
124
|
-
break
|
125
|
-
end
|
126
|
-
end
|
127
|
-
else
|
128
|
-
Universe.allow_tool_operations=true
|
129
|
-
end
|
130
|
-
|
131
|
-
}
|
132
|
-
@click_analysis_active = true
|
133
|
-
end
|
134
|
-
|
135
|
-
end
|
136
|
-
|
137
|
-
def de_activate_click_analysis
|
138
|
-
# alert 'we need to find how many tools are still active'
|
139
|
-
@click_analysis = nil
|
140
|
-
@click_analysis_active = false
|
141
|
-
end
|
142
|
-
|
143
|
-
def start_click_analysis
|
144
|
-
@click_analysis_active = false
|
145
|
-
JS.global[:document].addEventListener('mouseup') do |native_event|
|
146
|
-
Atome.instance_exec(native_event, &@click_analysis) if @click_analysis.is_a?(Proc)
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
end
|
151
|
-
|
152
|
-
def build_tool(params, &bloc)
|
153
|
-
label = params[:name]
|
154
|
-
name = "#{params[:name]}_tool"
|
155
|
-
index = params[:index]
|
156
|
-
orientation = params[:orientation]
|
157
|
-
orientation_wanted = :sn
|
158
|
-
color({ id: :active_tool_col, alpha: 1, red: 1, green: 1, blue: 1 })
|
159
|
-
color({ id: :inactive_tool_col, alpha: 0.6 })
|
160
|
-
tool_content = Atome.instance_exec(&bloc) if bloc.is_a?(Proc)
|
161
|
-
grab(:intuition).storage[:tool_open] ||= []
|
162
|
-
grab(:intuition).storage[:tool_open] << name
|
163
|
-
size = grab(:toolbox_style).data[:size]
|
164
|
-
smooth = grab(:toolbox_style).data[:smooth]
|
165
|
-
case orientation_wanted
|
166
|
-
when :sn
|
167
|
-
top = :auto
|
168
|
-
bottom = index * (size + 3)
|
169
|
-
left = 0
|
170
|
-
right = :auto
|
171
|
-
when :ns
|
172
|
-
when :ew
|
173
|
-
when :we
|
174
|
-
else
|
175
|
-
#
|
176
|
-
end
|
177
|
-
|
178
|
-
# tool creation
|
179
|
-
tool = grab(:intuition).box({ id: name,
|
180
|
-
tag: { system: true },
|
181
|
-
# orientation: orientation_wanted,
|
182
|
-
top: top,
|
183
|
-
bottom: bottom,
|
184
|
-
left: left,
|
185
|
-
right: right,
|
186
|
-
width: size,
|
187
|
-
height: size,
|
188
|
-
smooth: smooth,
|
189
|
-
apply: [:tool_inactive_color, :tool_box_border, :tool_shade],
|
190
|
-
state: :closed,
|
191
|
-
# storage: { taxonomy: Intuition.impulse },
|
192
|
-
})
|
193
|
-
tool.vector({ tag: { system: true }, left: 9, top: :auto, bottom: 9, width: 18, height: 18, id: "#{name}_icon" })
|
194
|
-
tool.text({ tag: { system: true }, data: label, component: { size: 9 }, color: :grey, id: "#{name}_label" })
|
195
|
-
tool.touch(true) do |ev|
|
196
|
-
# we add all specific tool actions to @tools_actions_to_exec hash
|
197
|
-
|
198
|
-
Atome.add_tool_actions(name, tool_content)
|
199
|
-
# we set allow_tool_operations to false to ignore tool operation when clicking on a tool
|
200
|
-
Universe.allow_tool_operations=false
|
201
|
-
# we create the creation_layer if not already exist
|
202
|
-
|
203
|
-
tick(name)
|
204
|
-
# active code exec
|
205
|
-
if tick[name] == 1 # first click
|
206
|
-
# we set edit mode to true (this allow to prevent user atome to respond from click)
|
207
|
-
Universe.edit_mode = true
|
208
|
-
# activate tool analysis test
|
209
|
-
Atome.activate_click_analysis
|
210
|
-
|
211
|
-
# check_me_first = lambda { |atome_id_found, x, y|
|
212
|
-
# puts "first user atome ==> #{grab(atome_id_found).id}, x: #{x}, y: #{y}"
|
213
|
-
# }
|
214
|
-
# Atome.instance_variable_set('@click_analysis_action', check_me_first)
|
215
|
-
# init the tool
|
216
|
-
tool.data = []
|
217
|
-
# generic behavior
|
218
|
-
tool.apply(:active_tool_col)
|
219
|
-
# activation code
|
220
|
-
tool_content[:active].each do |code_exec|
|
221
|
-
tool.instance_exec(&code_exec)
|
222
|
-
end if tool_content && tool_content[:active]
|
223
|
-
if tool_content && tool_content[:alteration]
|
224
|
-
# here we treat any selected items on tool activation
|
225
|
-
tool_content[:alteration].each do |action|
|
226
|
-
Atome.selection.each do |atome_id_to_treat|
|
227
|
-
atome_to_treat=grab(atome_id_to_treat)
|
228
|
-
pre_proc = action[:pre]
|
229
|
-
tool.instance_exec(atome_to_treat,nil, &pre_proc) if pre_proc.is_a? Proc
|
230
|
-
particle_f = action[:particle]
|
231
|
-
value_f = action[:value]
|
232
|
-
atome_to_treat.send(particle_f, value_f)
|
233
|
-
post_proc = action[:post]
|
234
|
-
tool.instance_exec(atome_to_treat,nil, &post_proc) if post_proc.is_a? Proc
|
235
|
-
end
|
236
|
-
end
|
237
|
-
end
|
238
|
-
|
239
|
-
else
|
240
|
-
# when closing delete tools action from tool_actions_to_exec
|
241
|
-
Atome.tool_actions_to_exec.delete(name)
|
242
|
-
# we check if all tools are inactive if so we set edit_mode to false
|
243
|
-
if Atome.tool_actions_to_exec.length == 0
|
244
|
-
# puts "Atome.tool_actions_to_exec.length = 0"
|
245
|
-
Atome.de_activate_click_analysis
|
246
|
-
Universe.edit_mode = false
|
247
|
-
end
|
248
|
-
|
249
|
-
# inactivation code
|
250
|
-
tool_content[:inactive].each do |code_exec|
|
251
|
-
tool.instance_exec(tool.data, &code_exec)
|
252
|
-
end if tool_content && tool_content[:inactive]
|
253
|
-
|
254
|
-
# generic behavior
|
255
|
-
# we remove touch and resize binding on newly created atomes
|
256
|
-
tool.apply(:inactive_tool_col)
|
257
|
-
tool.data.each do |new_atome|
|
258
|
-
new_atome.drag(false)
|
259
|
-
new_atome.resize(:remove)
|
260
|
-
end
|
261
|
-
tick[name] = 0
|
262
|
-
end
|
263
|
-
end
|
264
|
-
end
|
265
|
-
end
|
266
|
-
|
267
|
-
module Intuition
|
268
|
-
class << self
|
269
|
-
@toolbox = { impulse: [:capture_tool, :communication_tool, :creation_tool, :view_tool, :time_tool, :find_tool, :home_tool],
|
270
|
-
capture_tool: [:microphone_tool, :camera_tool,]
|
271
|
-
}
|
272
|
-
|
273
|
-
def intuition_int8
|
274
|
-
# tool taxonomy and list
|
275
|
-
{
|
276
|
-
capture: { int8: { french: :enregistrement, english: :record, german: :datensatz } },
|
277
|
-
communication: { french: :communication, english: :communication, german: :communication },
|
278
|
-
tool: { french: :outils, english: :tools, german: :werkzeuge },
|
279
|
-
view: { french: :vue, english: :view, german: :aussicht },
|
280
|
-
time: { french: :horloge, english: :clock, german: :Uhr },
|
281
|
-
find: { french: :trouve, english: :find, german: :finden },
|
282
|
-
home: { french: :accueil, english: :home, german: :zuhause },
|
283
|
-
code: { french: :code, english: :code, german: :code },
|
284
|
-
impulse: { french: :impulse, english: :impulse, german: :impulse },
|
285
|
-
}
|
286
|
-
end
|
287
|
-
|
288
|
-
def impulse
|
289
|
-
|
290
|
-
# initialise touchdown analysis
|
291
|
-
# Atome.start_click_analysis
|
292
|
-
|
293
|
-
# tool start point
|
294
|
-
# [:capture_tool, :communication, :tool, :view, :time, :find, :home]
|
295
|
-
end
|
296
|
-
end
|
297
|
-
|
298
|
-
end
|
299
|
-
|
300
|
-
##########################################################
|
301
|
-
# new({ tool: :impulse }) do |params|
|
302
|
-
#
|
303
|
-
# creation_code = lambda { |event|
|
304
|
-
# puts :box_creation
|
305
|
-
# }
|
306
|
-
#
|
307
|
-
# active_code = lambda { |event|
|
308
|
-
# puts :start
|
309
|
-
# apply([:tool_active_color])
|
310
|
-
# storage[:taxonomy].each_with_index do |tool, index|
|
311
|
-
#
|
312
|
-
# # Atome.display_tool("tool_#{tool}", index + 1, :ns)
|
1
|
+
# # frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# # m = table({ renderers: [:html], attach: :view, id: :my_test_box, type: :table, apply: [:shape_color],
|
4
|
+
# # left: 333, top: 0, width: 900, smooth: 15, height: 900, overflow: :scroll, option: { header: false },
|
5
|
+
# # component: {
|
6
|
+
# # # border: { thickness: 5, color: :blue, pattern: :dotted },
|
7
|
+
# # # overflow: :auto,
|
8
|
+
# # # color: "red",
|
9
|
+
# # shadow: {
|
10
|
+
# # id: :s4,
|
11
|
+
# # left: 20, top: 0, blur: 9,
|
12
|
+
# # option: :natural,
|
13
|
+
# # red: 0, green: 0, blue: 0, alpha: 1
|
14
|
+
# # },
|
15
|
+
# # height: 5,
|
16
|
+
# # width: 12,
|
17
|
+
# # component: { size: 12, color: :black }
|
18
|
+
# # },
|
19
|
+
# # # data: [
|
20
|
+
# # # { titi: :toto },
|
21
|
+
# # # { dfgdf: 1, name: 'Alice', age: 30, no: 'oko', t: 123, r: 654 },
|
22
|
+
# # # { id: 2, name: 'Bob', age: 22 },
|
23
|
+
# # # { dfg: 4, name: 'Vincent', age: 33, no: grab(:my_circle) },
|
24
|
+
# # # { dfgd: 3, name: 'Roger', age: 18, no: image(:red_planet), now: :nothing }
|
25
|
+
# # #
|
26
|
+
# # # ]
|
27
|
+
# # })
|
28
|
+
# b=box({top: 120})
|
29
|
+
# box({top: 190, id: :the_box})
|
30
|
+
#
|
31
|
+
# b.touch(true) do
|
32
|
+
# a=JS.eval("return performance.now()")
|
33
|
+
# z=Time.now
|
34
|
+
# circle
|
35
|
+
# columns = []
|
36
|
+
#
|
37
|
+
# 96.times do
|
38
|
+
# line = {}
|
39
|
+
# 128.times do |index|
|
40
|
+
# line[:"vel#{index}"] = nil
|
313
41
|
# end
|
314
|
-
#
|
315
|
-
#
|
316
|
-
#
|
317
|
-
#
|
318
|
-
#
|
319
|
-
# #
|
320
|
-
# # grab("tool_#{tool}").delete(true)
|
42
|
+
# columns << line
|
43
|
+
# end
|
44
|
+
# columns.each_with_index do |a, index|
|
45
|
+
# b= box({left: index*30, width: 12})
|
46
|
+
# # b.touch(true) do
|
47
|
+
# # alert b.id
|
321
48
|
# # end
|
322
|
-
# # impulse.apply([:tool_inactive_color])
|
323
|
-
# # impulse.state(:closed)
|
324
|
-
# }
|
325
|
-
#
|
326
|
-
# {
|
327
|
-
# active: [active_code],
|
328
|
-
# inactive: [inactive_code],
|
329
|
-
# creation: [creation_code],
|
330
|
-
# int8: { french: :impulse, english: :impulse, german: :impulse }
|
331
|
-
# }
|
332
|
-
# end
|
333
|
-
|
334
|
-
# toolbox creation
|
335
|
-
# Atome.display_tool(:impulse, 0, :ns)
|
336
|
-
# grab(:impulse).touch(true) do
|
337
|
-
# impulse = grab(:impulse)
|
338
|
-
# if impulse.state == :closed
|
339
|
-
# impulse.apply([:tool_active_color])
|
340
|
-
# impulse.storage[:taxonomy].each_with_index do |tool, index|
|
341
|
-
#
|
342
|
-
# Atome.display_tool("tool_#{tool}", index + 1, :ns)
|
343
|
-
# end
|
344
|
-
# impulse.state(:open)
|
345
|
-
# else
|
346
|
-
# impulse.storage[:taxonomy].each do |tool|
|
347
|
-
# grab("tool_#{tool}").delete(true)
|
348
|
-
# end
|
349
|
-
# impulse.apply([:tool_inactive_color])
|
350
|
-
# impulse.state(:closed)
|
351
49
|
# end
|
352
|
-
#
|
353
|
-
|
354
|
-
#
|
355
|
-
|
356
|
-
new({ tool: :shape }) do |params|
|
357
|
-
|
358
|
-
active_code = lambda {
|
359
|
-
puts :creation_tool_code_activated
|
360
|
-
# puts "activation code here"
|
361
|
-
}
|
362
|
-
|
363
|
-
inactive_code = lambda { |atomes_treated|
|
364
|
-
puts :creation_tool_code_inactivated
|
365
|
-
# atomes_treated.each do |new_atome|
|
366
|
-
# if new_atome.selected
|
367
|
-
# new_atome.left(new_atome.left + 33)
|
368
|
-
# new_atome.color({ red: rand, green: rand, blue: rand })
|
369
|
-
# end
|
370
|
-
# end
|
371
|
-
}
|
372
|
-
pre_crea_code = lambda { |atome_touched, event|
|
373
|
-
puts "pre_creation_code : atome_touched : #{atome_touched} event : #{event} "
|
374
|
-
# Atome.selection.each do |atome_to_treat|
|
375
|
-
# grab(atome_to_treat).color(:red)
|
376
|
-
# grab(atome_to_treat).rotate(21)
|
377
|
-
# puts "pre"
|
378
|
-
# end
|
379
|
-
}
|
380
|
-
|
381
|
-
post_crea_code = lambda { |atome_touched, new_atome, event|
|
382
|
-
puts "post_creation_code,atome_touched: #{atome_touched}, new_atome :#{new_atome}, event : #{event}"
|
383
|
-
|
384
|
-
# new_atome.color(:blue)
|
385
|
-
# puts "post"
|
386
|
-
}
|
387
|
-
|
388
|
-
creation_code = [{ type: :box, particles: { width: 66, height: 66 }, pre: pre_crea_code },
|
389
|
-
{ type: :circle, particles: { width: 66, height: 66 }, post: post_crea_code }
|
390
|
-
]
|
391
|
-
pre_code = lambda { |atome_touched, event|
|
392
|
-
# grab(atome_touched).height(99)
|
393
|
-
puts 'alteration pre treatment'
|
394
|
-
}
|
395
|
-
|
396
|
-
post_code = lambda { |atome_touched, event|
|
397
|
-
|
398
|
-
atome_touched.height(199)
|
399
|
-
# new_atome.height(199) if new_atome
|
400
|
-
# grab(new_atome).width(99)
|
401
|
-
puts 'alteration post treatment'
|
402
|
-
|
403
|
-
}
|
404
|
-
|
405
|
-
alterations = [{ particle: :blur, value: 3, pre: pre_code, post: post_code }]
|
406
|
-
|
407
|
-
{ creation: creation_code, alteration: alterations,
|
408
|
-
active: [active_code],
|
409
|
-
inactive: [inactive_code],
|
410
|
-
int8: { french: :formes, english: :shape, german: :jesaispas } }
|
411
|
-
|
412
|
-
end
|
413
|
-
|
414
|
-
### tool2 test
|
415
|
-
|
416
|
-
new({ tool: :color }) do |params|
|
417
|
-
|
418
|
-
|
419
|
-
active_code = lambda {
|
420
|
-
# grab(:intuition).data[:color] = :red
|
421
|
-
puts :alteration_tool_code_activated
|
422
|
-
}
|
423
|
-
|
424
|
-
inactive_code = lambda { |param|
|
425
|
-
puts :alteration_tool_code_inactivated
|
426
|
-
}
|
427
|
-
pre_code= lambda { |atome_touched, event|
|
428
|
-
puts "post_creation_code,atome_touched: #{atome_touched}, event : #{event}"
|
429
|
-
|
430
|
-
# new_atome.color(:blue)
|
431
|
-
# puts "post"
|
432
|
-
}
|
433
|
-
post_code= lambda { |atome_touched, event|
|
434
|
-
puts "post_creation_code,atome_touched: #{atome_touched}, event : #{event}"
|
435
|
-
|
436
|
-
# new_atome.color(:blue)
|
437
|
-
# puts "post"
|
438
|
-
}
|
439
|
-
alterations = [{ particle: :width, value: 22 }, { particle: :color, value: :red, pre: pre_code,
|
440
|
-
post: post_code, }, { particle: :rotate, value: 33 }]
|
441
|
-
{
|
442
|
-
active: [active_code],
|
443
|
-
inactive: [inactive_code],
|
444
|
-
alteration: alterations,
|
445
|
-
|
446
|
-
int8: { french: :couleur, english: :color, german: :colorad } }
|
447
|
-
|
448
|
-
end
|
449
|
-
|
450
|
-
# new({ tool: :color }) do |params|
|
451
|
-
#
|
452
|
-
# { alteration: [{ particle: :blur, value: 22 }] }
|
453
|
-
#
|
454
|
-
# end
|
455
|
-
# verif below
|
456
|
-
# wait 1 do
|
457
|
-
|
458
|
-
Atome.init_intuition
|
459
|
-
# end
|
460
|
-
|
461
|
-
# ##############################################################################################
|
50
|
+
# z2=Time.now
|
51
|
+
# x=JS.eval("return performance.now();")
|
52
|
+
# alert "#{x.to_f-a.to_f} : #{(z2-z)*1000}"
|
462
53
|
#
|
463
|
-
|
464
|
-
b = box({ left: 123, top: 66, selected: false, id: :the_box })
|
465
|
-
b.touch(:down) do
|
466
|
-
puts '"im touched"'
|
467
|
-
end
|
468
|
-
circle({ left: 123, top: 120, selected: true, id: :the_circle, drag: true })
|
469
|
-
|
470
|
-
# def id_found_under_touch(obj_found)
|
471
|
-
# alert obj_found
|
472
54
|
# end
|
473
|
-
# aa=<<STR
|
474
|
-
# document.addEventListener('click', function(event) {
|
475
|
-
# var x = event.clientX;
|
476
|
-
# var y = event.clientY;
|
477
|
-
# var elementUnderCursor = document.elementFromPoint(x, y).id;
|
478
|
-
# Opal.Object.$id_found_under_touch(elementUnderCursor);
|
479
|
-
# });
|
480
|
-
# STR
|
481
55
|
#
|
482
|
-
# JS.eval(aa)
|
483
|
-
|
484
|
-
# ###################### marche
|
485
|
-
class Atome
|
486
|
-
|
487
|
-
def set_action_on_touch(&action)
|
488
|
-
@touch_action = action
|
489
|
-
|
490
|
-
end
|
491
|
-
|
492
|
-
# def set_atome_on_touch
|
493
|
-
# document = JS.global[:document]
|
494
|
-
# document.addEventListener("click") do |native_event|
|
495
|
-
# event = Native(native_event)
|
496
|
-
# x = event[:clientX]
|
497
|
-
# y = event[:clientY]
|
498
|
-
# element = document.elementFromPoint(x, y)
|
499
|
-
# element_id = element[:id]
|
500
|
-
# puts "test if element is a system element else select it "
|
501
|
-
# @touch_action.call(element_id) if @touch_action.is_a? Proc
|
502
|
-
# end
|
503
|
-
# end
|
504
|
-
|
505
|
-
# def set_atome_on_touch
|
506
|
-
# document = JS.global[:document]
|
507
|
-
# document.addEventListener("click") do |native_event|
|
508
|
-
# event = Native(native_event)
|
509
|
-
# x = event[:clientX]
|
510
|
-
# y = event[:clientY]
|
511
|
-
# element = document.elementFromPoint(x, y)
|
512
|
-
#
|
513
|
-
# # Boucle pour remonter la hiérarchie des éléments
|
514
|
-
# while element && element != document
|
515
|
-
# # Vérifie si l'élément a l'ID 'view'
|
516
|
-
# if element[:id].to_s == 'view'
|
517
|
-
# element_id = element[:id]
|
518
|
-
# @touch_action.call(element_id) if @touch_action.is_a? Proc
|
519
|
-
#
|
520
|
-
# # alert "Clic sur un descendant de 'view'"
|
521
|
-
# break
|
522
|
-
# end
|
523
|
-
# # Passe au parent de l'élément actuel
|
524
|
-
# # element = element.JS[:parentNode]
|
525
|
-
# break
|
526
|
-
# end
|
527
|
-
# end
|
528
|
-
# end
|
529
|
-
|
530
|
-
def remove_get_atome_on_touch
|
531
|
-
@touch_action = nil
|
532
|
-
end
|
533
|
-
|
534
|
-
end
|
535
|
-
|
536
|
-
###### verif
|
537
|
-
# A.set_action_on_touch do |at_id|
|
538
|
-
# puts "==> #{at_id}"
|
539
|
-
# end
|
540
|
-
# A.set_atome_on_touch
|
541
56
|
#
|
57
|
+
# # m.data(columns)
|
58
|
+
# # # tests
|
59
|
+
# # m.color(:orange)
|
60
|
+
# # m.border({ thickness: 5, color: :blue, pattern: :dotted })
|
61
|
+
# #
|
62
|
+
# # m.get({ cell: [1, 2]}).class
|
63
|
+
# # wait 2 do
|
64
|
+
# # m.insert({ cell: [2, 2], content: 999 })
|
65
|
+
# # m.insert({ row: 1 })
|
66
|
+
# # wait 1 do
|
67
|
+
# # m.remove({ row: 2 })
|
68
|
+
# # end
|
69
|
+
# # wait 2 do
|
70
|
+
# # m.remove({ column: 1 })
|
71
|
+
# # end
|
72
|
+
# # wait 3 do
|
73
|
+
# # m.insert({ column: 3 })
|
74
|
+
# # end
|
75
|
+
# #
|
76
|
+
# # wait 4 do
|
77
|
+
# # m.sort({ column: 1, method: :alphabetic })
|
78
|
+
# # puts 1
|
79
|
+
# # wait 1 do
|
80
|
+
# # puts 2
|
81
|
+
# # m.sort({ column: 2, method: :numeric })
|
82
|
+
# # wait 1 do
|
83
|
+
# # puts 3
|
84
|
+
# # m.sort({ column: 3, method: :numeric })
|
85
|
+
# # wait 1 do
|
86
|
+
# # puts 4
|
87
|
+
# # m.sort({ column: 1, method: :numeric })
|
88
|
+
# # end
|
89
|
+
# # end
|
90
|
+
# # end
|
91
|
+
# # end
|
92
|
+
# #
|
93
|
+
# # end
|
94
|
+
# #
|
95
|
+
# # # cell.fusion() # to be implemented later
|
96
|
+
#
|
97
|
+
#
|
98
|
+
# # b=box({width: 1200, height: 900, color: {alpha: 0},top: -50})
|
99
|
+
# # grab(:black_matter).image({id: :kb,path: 'medias/images/utils/keyboard.svg', width: 66, left: 55})
|
100
|
+
# # # grab(:black_matter).image({id: :planet,path: 'medias/images/red_planet.png', width: 66,height: 66, left: 555, top: 180})
|
101
|
+
# # b.fill([atome: :kb, repeat: {x: 8, y: 1}])
|
102
|
+
# # b.drag(true)
|
103
|
+
# #
|
104
|
+
# #
|
105
|
+
# # b2=box({width: 1200, height: 298, top: -100})
|
106
|
+
# # grab(:black_matter).image({id: :notes,path: 'medias/images/utils/notes.svg', width: 166, left: 55})
|
107
|
+
# # # grab(:black_matter).image({id: :planet,path: 'medias/images/red_planet.png', width: 66,height: 66, left: 555, top: 180})
|
108
|
+
# # b2.fill([atome: :notes, repeat: {x: 8, y: 5}])
|
109
|
+
# # b2.drag(true)
|
110
|
+
#
|
111
|
+
#
|
112
|
+
# JS.eval("
|
113
|
+
# // Fonction pour créer les divs
|
114
|
+
# function createDivs() {
|
115
|
+
# // Démarrer le chronomètre
|
116
|
+
# const startTime = performance.now();
|
117
|
+
#
|
118
|
+
# const view = document.getElementById('view');
|
119
|
+
# //view.innerHTML = ''; // Nettoyer le contenu précédent de 'view' si nécessaire
|
120
|
+
#
|
121
|
+
# // Boucle pour créer 98 divs sur l'axe X
|
122
|
+
# for (let i = 0; i < 98; i++) {
|
123
|
+
# const xDiv = document.createElement('div');
|
124
|
+
# xDiv.style.display = 'flex';
|
125
|
+
# xDiv.style.flexDirection = 'column';
|
126
|
+
# xDiv.style.margin = '2px'; // Marge entre les divs de l'axe X
|
127
|
+
#
|
128
|
+
# // Boucle pour créer 128 divs sur l'axe Y
|
129
|
+
# for (let j = 0; j < 128; j++) {
|
130
|
+
# const yDiv = document.createElement('div');
|
131
|
+
# yDiv.style.width = '10px'; // Largeur de chaque div sur l'axe Y
|
132
|
+
# yDiv.style.height = '10px'; // Hauteur de chaque div sur l'axe Y
|
133
|
+
# yDiv.style.border = '1px solid black'; // Bordure pour rendre les divs visibles
|
134
|
+
# yDiv.style.boxSizing = 'border-box'; // Inclure la bordure dans les dimensions
|
135
|
+
# xDiv.appendChild(yDiv);
|
136
|
+
# }
|
137
|
+
#
|
138
|
+
# view.appendChild(xDiv);
|
139
|
+
# }
|
542
140
|
#
|
543
|
-
#
|
544
|
-
#
|
545
|
-
#
|
546
|
-
# puts 'ready again !!'
|
547
|
-
# A.set_action_on_touch do |at_id|
|
548
|
-
# puts "******> #{at_id}"
|
549
|
-
# end
|
550
|
-
# end
|
551
|
-
# end
|
552
|
-
|
553
|
-
###### good algo
|
554
|
-
# class Atome
|
555
|
-
# class << self
|
141
|
+
# // Arrêter le chronomètre
|
142
|
+
# const endTime = performance.now();
|
143
|
+
# const timeTaken = endTime - startTime;
|
556
144
|
#
|
145
|
+
# // Afficher le temps écoulé en console
|
146
|
+
# alert(`Temps écoulé pour créer les divs : ${timeTaken.toFixed(2)} ms`);
|
147
|
+
# }
|
557
148
|
#
|
558
|
-
#
|
149
|
+
# // Ajouter un écouteur d'événements au div 'the_box'
|
150
|
+
# document.getElementById('the_box').addEventListener('click', createDivs);
|
151
|
+
# ``
|
559
152
|
#
|
560
|
-
#
|
153
|
+
# ")
|
561
154
|
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
# alert grab(:intuition).instance_variable_get('@click_analysis_action')
|
567
|
-
|
568
|
-
# wait 3 do
|
569
|
-
# check_me = lambda { |atome_id_found|
|
570
|
-
# puts "Cool cool cool, for :#{atome_id_found}"
|
571
|
-
# }
|
572
|
-
# Atome.instance_variable_set('@click_analysis_action', check_me)
|
573
|
-
# # wait 2 do
|
574
|
-
# # Atome.de_activate_click_analysis
|
575
|
-
# # alert :game_over
|
576
|
-
# # end
|
577
|
-
# end
|
578
|
-
|
579
|
-
# array1 = [1, 2, 3]
|
580
|
-
# array2 = nil
|
581
|
-
# array1.concat(array2) if array2
|
582
|
-
#
|
583
|
-
# alert array1
|
584
|
-
bb = box()
|
155
|
+
new({particle: :merge})
|
156
|
+
a=box
|
157
|
+
c=box
|
158
|
+
d=a.merge(c)
|