atome 0.5.6.8.7 → 0.5.7.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/documentation/basic.md +7 -8
  3. data/documentation/deep learning/basic_infos.txt +6 -6
  4. data/documentation/installation/atome_server.md +66 -1
  5. data/documentation/installation/buiding_atome.md +307 -0
  6. data/lib/atome/atome.rb +2 -3
  7. data/lib/atome/extensions/atome.rb +38 -12
  8. data/lib/atome/genesis/atomes.rb +1 -1
  9. data/lib/atome/genesis/genesis.rb +11 -11
  10. data/lib/atome/genesis/particles/event.rb +58 -50
  11. data/lib/atome/genesis/particles/identity.rb +3 -0
  12. data/lib/atome/genesis/particles/property.rb +2 -1
  13. data/lib/atome/genesis/particles/utility.rb +19 -12
  14. data/lib/atome/genesis/presets.rb +10 -0
  15. data/lib/atome/genesis/sparkle.rb +11 -9
  16. data/lib/atome/kernel/universe.rb +22 -11
  17. data/lib/atome/presets/atome.rb +20 -17
  18. data/lib/atome/utilities/essentials.rb +5 -5
  19. data/lib/atome/utilities/utilities.rb +173 -16
  20. data/lib/atome/version.rb +1 -1
  21. data/lib/atome.rb +1 -0
  22. data/lib/atome_relative.rb +1 -0
  23. data/lib/molecules/init.rb +22 -42
  24. data/lib/molecules/intuition/_deprecated_inputs.rb +111 -0
  25. data/lib/molecules/intuition/utillities.rb +105 -11
  26. data/lib/renderers/html/event.rb +20 -4
  27. data/lib/renderers/html/html.rb +161 -161
  28. data/lib/renderers/html/identity.rb +10 -2
  29. data/lib/renderers/html/material.rb +4 -0
  30. data/lib/renderers/html/utility.rb +64 -8
  31. data/vendor/assets/application/examples/b64_to_image.rb +9 -0
  32. data/vendor/assets/application/examples/drag.rb +9 -2
  33. data/vendor/assets/application/examples/fonts.rb +15 -0
  34. data/vendor/assets/application/examples/matrix.rb +77 -114
  35. data/vendor/assets/application/examples/recorder.rb +74 -0
  36. data/vendor/assets/application/examples/site.rb +41 -0
  37. data/vendor/assets/application/examples/sub_atome_manipulation.rb +0 -2
  38. data/vendor/assets/application/examples/svg_img_to_vector.rb +6 -0
  39. data/vendor/assets/application/examples/svg_vectorizer.rb +21 -0
  40. data/vendor/assets/application/examples/table.rb +1 -1
  41. data/vendor/assets/application/examples/test.rb +572 -0
  42. data/vendor/assets/application/examples/tools.rb +650 -304
  43. data/vendor/assets/application/examples/vector.rb +16 -3
  44. data/vendor/assets/server/atome_server.rb +3 -2
  45. data/vendor/assets/server/atome_server_wasm.rb +2 -2
  46. data/vendor/assets/server/eDen.rb +135 -14
  47. data/vendor/assets/src/css/style.css +4 -0
  48. data/vendor/assets/src/index.html +1 -1
  49. data/vendor/assets/src/index_opal.html +1 -1
  50. data/vendor/assets/src/index_server.html +1 -1
  51. data/vendor/assets/src/index_server_wasm.html +1 -1
  52. data/vendor/assets/src/index_wasm.html +1 -1
  53. data/vendor/assets/src/js/atome/atome.js +250 -49
  54. data/vendor/assets/src/js/atome/atome_helpers/communication.js +4 -4
  55. data/vendor/assets/src/js/atome/specific/opal.js +19 -3
  56. data/vendor/assets/src/js/atome/specific/wasm.js +18 -3
  57. data/vendor/assets/src/js/molecules/web.js +1 -1
  58. data/vendor/assets/src/medias/images/icons/Lowpass.svg +8 -0
  59. data/vendor/assets/src/medias/images/icons/activate.svg +3 -0
  60. data/vendor/assets/src/medias/images/icons/audio.svg +7 -0
  61. data/vendor/assets/src/medias/images/icons/band_pass.svg +8 -0
  62. data/vendor/assets/src/medias/images/icons/clear.svg +5 -0
  63. data/vendor/assets/src/medias/images/icons/color.svg +5 -0
  64. data/vendor/assets/src/medias/images/icons/copy.svg +8 -0
  65. data/vendor/assets/src/medias/images/icons/create.svg +3 -0
  66. data/vendor/assets/src/medias/images/icons/delete.svg +8 -0
  67. data/vendor/assets/src/medias/images/icons/edit-.svg +4 -0
  68. data/vendor/assets/src/medias/images/icons/edit.svg +4 -0
  69. data/vendor/assets/src/medias/images/icons/edition.svg +4 -0
  70. data/vendor/assets/src/medias/images/icons/equalizer-.svg +5 -0
  71. data/vendor/assets/src/medias/images/icons/equalizer.svg +5 -0
  72. data/vendor/assets/src/medias/images/icons/filter.svg +4 -0
  73. data/vendor/assets/src/medias/images/icons/folder.svg +4 -0
  74. data/vendor/assets/src/medias/images/icons/group.svg +6 -0
  75. data/vendor/assets/src/medias/images/icons/hamburger.svg +8 -0
  76. data/vendor/assets/src/medias/images/icons/high_pass.svg +5 -0
  77. data/vendor/assets/src/medias/images/icons/link.svg +4 -0
  78. data/vendor/assets/src/medias/images/icons/load.svg +4 -0
  79. data/vendor/assets/src/medias/images/icons/low_pass.svg +5 -0
  80. data/vendor/assets/src/medias/images/icons/microphone.svg +7 -0
  81. data/vendor/assets/src/medias/images/icons/midi_in.svg +4 -0
  82. data/vendor/assets/src/medias/images/icons/midi_out.svg +4 -0
  83. data/vendor/assets/src/medias/images/icons/modules.svg +11 -0
  84. data/vendor/assets/src/medias/images/icons/paste.svg +4 -0
  85. data/vendor/assets/src/medias/images/icons/pause.svg +5 -0
  86. data/vendor/assets/src/medias/images/icons/play.svg +7 -0
  87. data/vendor/assets/src/medias/images/icons/record.svg +4 -0
  88. data/vendor/assets/src/medias/images/icons/save.svg +5 -0
  89. data/vendor/assets/src/medias/images/icons/select--.svg +4 -0
  90. data/vendor/assets/src/medias/images/icons/select-.svg +5 -0
  91. data/vendor/assets/src/medias/images/icons/select-all.svg +4 -0
  92. data/vendor/assets/src/medias/images/icons/select.svg +4 -0
  93. data/vendor/assets/src/medias/images/icons/settings.svg +5 -0
  94. data/vendor/assets/src/medias/images/icons/settings0.svg +2 -0
  95. data/vendor/assets/src/medias/images/icons/settings1.svg +17 -0
  96. data/vendor/assets/src/medias/images/icons/settings2.svg +25 -0
  97. data/vendor/assets/src/medias/images/icons/settings_old.svg +6 -0
  98. data/vendor/assets/src/medias/images/icons/shape.svg +7 -0
  99. data/vendor/assets/src/medias/images/icons/speaker.svg +6 -0
  100. data/vendor/assets/src/medias/images/icons/stop.svg +4 -0
  101. data/vendor/assets/src/medias/images/icons/tool.svg +7 -0
  102. data/vendor/assets/src/medias/images/icons/tools.svg +9 -0
  103. data/vendor/assets/src/medias/images/icons/undo2.svg +4 -0
  104. data/vendor/assets/src/medias/images/icons/validate.svg +9 -0
  105. data/vendor/assets/src/medias/images/icons/vie.svg +3 -0
  106. data/vendor/assets/src/medias/images/icons/wave-saw.svg +3 -0
  107. data/vendor/assets/src/medias/images/icons/wave-sine.svg +3 -0
  108. data/vendor/assets/src/medias/images/icons/wave-square-.svg +4 -0
  109. data/vendor/assets/src/medias/images/icons/wave-square.svg +3 -0
  110. data/vendor/assets/src/medias/images/icons/wave-triangle.svg +3 -0
  111. data/vendor/assets/src/medias/images/icons/waveform-.svg +4 -0
  112. data/vendor/assets/src/medias/images/icons/waveform.svg +7 -0
  113. metadata +69 -6
  114. data/lib/molecules/intuition/inputs.rb +0 -111
  115. /data/lib/molecules/{examples → _deprecated_examples}/site.rb +0 -0
  116. /data/lib/molecules/intuition/{toolbox.rb → _deprecated_toolbox.rb} +0 -0
@@ -1,320 +1,666 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Universe.allow_localstorage = false
3
+ size = 33
4
+ smooth = 3
5
+ shadow({
6
+ id: :tool_shade,
7
+ left: 3, top: 3, blur: 3,
8
+ invert: false,
9
+ red: 0, green: 0, blue: 0, alpha: 0.6
10
+ })
4
11
 
5
- color({ id: :creation_layer_col, alpha: 1 })
12
+ color({ id: :tool_inactive_color, red: 1, green: 1, blue: 1, alpha: 0.12 })
13
+ color({ id: :tool_active_color, red: 1, green: 1, blue: 1, alpha: 0.3 })
14
+ border({ id: :tool_box_border, thickness: 1, red: 1, green: 1, blue: 1, alpha: 0.06, pattern: :solid, inside: true })
15
+ # Tool's style object container below
16
+ element({ aid: :toolbox_style, id: :toolbox_style, data: {
17
+ color: :gray,
18
+ size: size,
19
+ smooth: smooth
20
+ } })
6
21
 
7
- b = box({ top: :auto, bottom: 0, id: :box_tool })
22
+ class Atome
23
+ class << self
24
+ def init_intuition
25
+ Atome.start_click_analysis
26
+ root = [:box, :blur, :drag, :rotate, :select, :move,:project]
27
+ root.each_with_index do |root_tool, index|
28
+ tools_scheme = Universe.tools[root_tool]
29
+ A.build_tool({ name: root_tool, scheme: tools_scheme, index: index })
30
+ end
31
+ # Universe.tools.each_with_index do |(tool_name, bloc), index|
32
+ #
33
+ # A.build_tool({ name: tool_name, index: index }, &bloc)
34
+ # end
35
+ end
36
+
37
+ def selection
38
+ grab(Universe.current_user).selection.collect
39
+ end
40
+
41
+ def activate_click_analysis
42
+
43
+ # the condition below avoid touchdown analysis accumulation
44
+ unless @click_analysis_active
45
+ # this method analyse all object under the touchdown to find the first user objet and return it's id
46
+ @click_analysis = lambda { |native_event|
47
+ # the instance variable below check if we can apply tool (cf: if the atome we don't want to apply tool)
48
+ if Universe.allow_tool_operations
49
+ event = Native(native_event)
50
+ x = event[:clientX]
51
+ y = event[:clientY]
52
+ elements = JS.global[:document].elementsFromPoint(x, y)
53
+ elements.to_a.each do |atome_touched|
54
+ id_found = atome_touched[:id].to_s
55
+ atome_found = grab(id_found)
56
+ unless atome_found && atome_found.tag[:system]
57
+
58
+ # if atome_found
59
+ Universe.active_tools.each do |tool|
60
+ apply_tool(tool, atome_found, event)
61
+ end
62
+ break
63
+ end
64
+ end
65
+ else
66
+ Universe.allow_tool_operations = true
67
+ end
68
+ }
69
+ @click_analysis_active = true
70
+ end
71
+
72
+ end
73
+
74
+ def de_activate_click_analysis
75
+ @click_analysis = nil
76
+ @click_analysis_active = false
77
+ end
78
+
79
+ def start_click_analysis
80
+ @click_analysis_active = false
81
+ JS.global[:document].addEventListener('mouseup') do |native_event|
82
+ Atome.instance_exec(native_event, &@click_analysis) if @click_analysis.is_a?(Proc)
83
+ end
84
+ end
85
+
86
+ def alteration(current_tool, tool_actions, atome_touched, a_event)
87
+ if atome_touched
88
+ storage_allowed = Universe.allow_localstorage
89
+ action_found = tool_actions[:action]
90
+ pre = tool_actions[:pre]
91
+ post = tool_actions[:post]
92
+ params = { current_tool: current_tool, atome_touched: atome_touched, event: a_event }
93
+ action_found.each do |part, val|
94
+ Universe.allow_localstorage = false
95
+ #################################
96
+ touch_found = atome_touched.touch
97
+ touch_procs=atome_touched.instance_variable_get("@touch_code")
98
+ resize_found = atome_touched.resize
99
+ resize_procs=atome_touched.instance_variable_get("@resize_code")
100
+ current_tool.data[:prev_states][atome_touched] = {events: { touch: touch_found, resize: resize_found },
101
+ procs: {touch_code: touch_procs, resize_code: resize_procs } }
102
+
103
+ #################################
104
+ current_tool.instance_exec(params, &pre) if pre.is_a? Proc
105
+ Universe.allow_localstorage = storage_allowed
106
+ if current_tool.data[:allow_alteration]
107
+ atome_touched.send(part, val)
108
+ current_tool.data[:treated] << atome_touched
109
+ end
110
+ current_tool.instance_exec(params, &post) if post.is_a? Proc
111
+ end
112
+
113
+ end
114
+ end
115
+
116
+ def creation(current_tool, tool_actions, atome_touched, a_event)
117
+ # we store prev_local_storage prior to lock it to prevent unwanted logs
118
+ # prev_local_storage=Universe.allow_localstorage()
119
+ storage_allowed = Universe.allow_localstorage
120
+ Universe.allow_localstorage = false
121
+
122
+ action_found = tool_actions[:action]
123
+ pre = tool_actions[:pre]
124
+ post = tool_actions[:post]
125
+ params = { current_tool: current_tool, atome_touched: atome_touched, event: a_event }
126
+
127
+ action_found.each do |atome, particle|
128
+ current_tool.instance_exec(params, &pre) if pre.is_a? Proc
129
+ temp_val = particle.merge({ resize: true, drag: true, top: a_event[:pageY].to_i, left: a_event[:pageX].to_i })
130
+ if current_tool.data[:allow_creation]
131
+ # uncomment the line below if you want to attach to current atome
132
+ if atome_touched
133
+ new_atome = atome_touched.send(atome, temp_val)
134
+ else
135
+ new_atome = grab(:view).send(atome, temp_val)
136
+ end
137
+ # current_tool.data[:treated] << new_atome
138
+ current_tool.data[:created] << new_atome
139
+ params.delete(:atome_touched)
140
+ params[new_atome: new_atome]
141
+ Universe.allow_localstorage = [atome]
142
+ Universe.historicize(new_atome.aid, :write, atome, particle)
143
+ end
144
+
145
+ end
146
+ current_tool.instance_exec(params, &post) if post.is_a? Proc
147
+ # we restore prev_local_storage to allow logs of drag and resize ...
148
+ Universe.allow_localstorage = storage_allowed
149
+ end
150
+
151
+ def apply_tool(tool, atome_touched, a_event)
152
+ current_tool = grab(tool)
153
+ tool_actions = current_tool.data
154
+ method_found = tool_actions[:method]
155
+ unless method_found
156
+ method_found = :alteration
157
+ tool_actions[:action] = { noop: true }
158
+ current_tool.data = tool_actions
159
+ end
160
+
161
+ send(method_found, current_tool, tool_actions, atome_touched, a_event)
162
+ end
163
+
164
+ end
165
+
166
+ def noop(_p)
167
+ # this method is used by tools when no treatment is needed
168
+ end
169
+
170
+ def set_action_on_touch(&action)
171
+ @touch_action = action
8
172
 
9
- b.touch(:down) do
10
- creation_layer = box({ top: 0, left: 0, id: :creation_layer, width: '100%', height: '100%', apply: :creation_layer_col })
11
- creation_layer.touch(:down) do |event|
12
- left_found = event[:pageX].to_i
13
- top_found = event[:pageY].to_i
14
- box({ left: left_found, top: top_found ,id: "tutu_#{Universe.atomes.length}", color: :red})
15
- creation_layer.delete(true)
16
- creation_layer.touch({ remove: :down })
17
- puts Universe.atomes.length
18
- puts "=> #{Universe.user_atomes}"
173
+ end
174
+
175
+ def remove_get_atome_on_touch
176
+ @touch_action = nil
177
+ end
178
+
179
+ def build_tool(params)
180
+ label = params[:name]
181
+ tool_name = "#{params[:name]}_tool"
182
+ index = params[:index]
183
+ orientation_wanted = :sn
184
+ tool_scheme = params[:scheme]
185
+ color({ id: :active_tool_col, alpha: 1, red: 1, green: 1, blue: 1 })
186
+ color({ id: :inactive_tool_col, alpha: 0.6 })
187
+ grab(:intuition).storage[:tool_open] ||= []
188
+ grab(:intuition).storage[:tool_open] << tool_name
189
+ size = grab(:toolbox_style).data[:size]
190
+ smooth = grab(:toolbox_style).data[:smooth]
191
+ case orientation_wanted
192
+ when :sn
193
+ top = :auto
194
+ bottom = index * (size + 3)
195
+ left = 0
196
+ right = :auto
197
+ when :ns
198
+ when :ew
199
+ when :we
200
+ else
201
+ #
202
+ end
203
+
204
+ # tool creation
205
+ if tool_scheme[:creation]
206
+ action = tool_scheme[:creation]
207
+ method = :creation
208
+ end
209
+ if tool_scheme[:alteration]
210
+ action = tool_scheme[:alteration]
211
+ method = :alteration
212
+ end
213
+
214
+ tool = grab(:intuition).box({ id: tool_name,
215
+ tag: { system: true },
216
+ # orientation: orientation_wanted,
217
+ top: top,
218
+ bottom: bottom,
219
+ left: left,
220
+ right: right,
221
+ width: size,
222
+ height: size,
223
+ smooth: smooth,
224
+ apply: [:tool_inactive_color, :tool_box_border, :tool_shade],
225
+ state: :closed,
226
+ data: { method: method,
227
+ action: action,
228
+ allow_alteration: true,
229
+ allow_creation: true,
230
+ # activation: tool_scheme[:activation],
231
+ # inactivation: tool_scheme[:inactivation], zone: tool_scheme[:zone],
232
+ post: tool_scheme[:post],
233
+ pre: tool_scheme[:pre],
234
+ }
235
+
236
+ })
237
+ tool.vector({ tag: { system: true }, left: 9, top: :auto, bottom: 9, width: 18, height: 18, id: "#{tool_name}_icon" })
238
+ tool.text({ tag: { system: true }, data: label, component: { size: 9 }, color: :grey, id: "#{tool_name}_label" })
239
+ code_for_zone = tool_scheme[:zone]
240
+ tool.instance_exec(tool, &code_for_zone) if code_for_zone.is_a? Proc
241
+ tool.touch(true) do
242
+ # we add all specific tool actions to @tools_actions_to_exec hash
243
+ # we set allow_tool_operations to false to ignore tool operation when clicking on a tool
244
+ Universe.allow_tool_operations = false
245
+ # we create the creation_layer if not already exist
246
+ tick(tool_name)
247
+ # active code exec
248
+ if tick[tool_name] == 1 # first click
249
+ events_allow = [:top, :left, :right, :bottom, :width, :height]
250
+ alterations = tool_scheme[:alteration] ? tool_scheme[:alteration].keys : []
251
+ creations = tool_scheme[:creation] ? tool_scheme[:creation].keys : []
252
+ prev_auth = Universe.allow_localstorage ||= []
253
+ storage_allowed = events_allow.concat(alterations).concat(creations).concat(prev_auth).uniq
254
+ Universe.allow_localstorage = storage_allowed
255
+ # we set edit mode to true (this allow to prevent user atome to respond from click)
256
+ Universe.edit_mode = true
257
+ Universe.active_tools << tool_name
258
+ # init the tool
259
+ tool.data[:treated] = []
260
+ tool.data[:created] = []
261
+ tool.data[:prev_states] = {}
262
+ # generic behavior
263
+ tool.apply(:active_tool_col)
264
+ # activation code
265
+ activation_code = tool_scheme[:activation]
266
+ tool.instance_exec(&activation_code) if activation_code.is_a? Proc
267
+ # below we the particles of selected atomes to feed tools values
268
+ # possibility 1 (pipette like):
269
+ # now we get the values from selected atomes
270
+ Atome.selection.each do |atome_id_to_treat|
271
+ tool.data[:action].each do |particle_req, value_f|
272
+ unless Universe.atome_preset
273
+ value_found = grab(atome_id_to_treat).send(particle_req)
274
+ if value_found
275
+ tool.data[:action][particle_req] = value_found
276
+ else
277
+ end
278
+ end
279
+ end
280
+ end
281
+ # possibility 2 (immediate apply):
282
+ allow_creation = tool.data[:allow_creation]
283
+ allow_alteration = tool.data[:allow_alteration]
284
+ Atome.selection.each do |atome_id_to_treat|
285
+ atome_found = grab(atome_id_to_treat)
286
+ event = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 }
287
+ Atome.apply_tool(tool_name, atome_found, event)
288
+ end unless tool_name.to_sym == :select_tool || !allow_creation || !allow_alteration
289
+
290
+ # activate tool analysis test
291
+ Atome.activate_click_analysis
292
+ else
293
+ Universe.allow_localstorage = false
294
+ # when closing delete tools action from tool_actions_to_exec
295
+ Universe.active_tools.delete(tool_name)
296
+ # we check if all tools are inactive if so we set edit_mode to false
297
+ if Universe.active_tools.length == 0
298
+ Atome.de_activate_click_analysis
299
+ Universe.edit_mode = false
300
+ end
301
+
302
+ inactivation_code = tool_scheme[:inactivation]
303
+ tool.instance_exec(tool.data, &inactivation_code) if inactivation_code.is_a? Proc
304
+ # end if tool_content && tool_content[:inactive]
305
+
306
+ # generic behavior
307
+ # we remove touch and resize binding on newly created atomes
308
+ tool.apply(:inactive_tool_col)
309
+ tool.data[:created].each do |new_atome|
310
+ new_atome.drag(false)
311
+ new_atome.resize(:remove)
312
+ end
313
+ ################################
314
+ # we restore prev touch and resize
315
+ tool.data[:prev_states].each do |atome_f, prev_par|
316
+ puts prev_par
317
+
318
+ # params[:events].each do |part_f, val_f|
319
+ # # alert "@#{part_f}, #{part_f}"
320
+ # atome_f.send(part_f, val_f)
321
+ # end
322
+ # alert "--> params : #{params[:events]}"
323
+ # alert "--> procs : #{params[:procs][params[:events]]}"
324
+ # atome_f.touch(false)
325
+ # atome_f.touch(true) do
326
+ # alert :kool
327
+ # end
328
+ # alert params[:procs]
329
+ # params[:procs].each do |var_n, procs_f|
330
+ # # procs_f.each do |action_f, proc|
331
+ # # # puts "#{var_n}==> #{action_f}, #{proc}"
332
+ # # end
333
+ # puts "==> #{var_n}, #{proc_f}"
334
+ # # atome_f.instance_variable_set("@#{var_n}", proc_f)
335
+ # end
336
+ # atome_f.touch(false)
337
+ # alert "#{atome_f.touch} : #{atome_f.instance_variable_get("@touch_code")}"
338
+ end
339
+
340
+ # atome_f.touch(touch_found)
341
+ # atome_f.resize(resize_found)
342
+ # inactivation code
343
+ #################################
344
+ tick[tool_name] = 0
345
+ end
346
+ end
19
347
  end
20
348
  end
21
349
 
350
+ module Intuition
351
+ class << self
352
+ @toolbox = { impulse: [:capture_tool, :communication_tool, :creation_tool, :view_tool, :time_tool, :find_tool, :home_tool],
353
+ capture_tool: [:microphone_tool, :camera_tool,]
354
+ }
22
355
 
23
- #
24
- # ######################
25
- #
26
- # # frozen_string_literal: true
27
- # class Atome
28
- #
29
- # def build_tool(&bloc)
30
- # # alert params[:tool]
31
- # a = Atome.instance_exec(&bloc)
32
- # puts "===> a is : #{a[:action]}"
33
- # # check below
34
- # # wait 2 do
35
- # # send a[:action]
36
- # # end
37
- # grab(:toolbox).box({color: :white, width: Intuition.style[:tool][:width], height: Intuition.style[:tool][:width]})
38
- # end
356
+ def intuition_int8
357
+ # tool taxonomy and list
358
+ {
359
+ capture: { int8: { french: :enregistrement, english: :record, german: :datensatz } },
360
+ communication: { french: :communication, english: :communication, german: :communication },
361
+ tool: { french: :outils, english: :tools, german: :werkzeuge },
362
+ view: { french: :vue, english: :view, german: :aussicht },
363
+ time: { french: :horloge, english: :clock, german: :Uhr },
364
+ find: { french: :trouve, english: :find, german: :finden },
365
+ home: { french: :accueil, english: :home, german: :zuhause },
366
+ code: { french: :code, english: :code, german: :code },
367
+ impulse: { french: :impulse, english: :impulse, german: :impulse },
368
+ }
369
+ end
370
+
371
+ end
372
+
373
+ end
374
+
375
+ # ##############################################################################################
376
+
377
+ new({ tool: :blur }) do |params|
378
+
379
+ active_code = lambda {
380
+ puts :alteration_tool_code_activated
381
+ }
382
+
383
+ inactive_code = lambda { |param|
384
+ puts :alteration_tool_code_inactivated
385
+ }
386
+ pre_code = lambda { |params|
387
+ puts "pre_creation_code,atome_touched: #{:params}"
388
+
389
+ }
390
+ post_code = lambda { |params|
391
+ puts "post_creation_code,atome_touched: #{:params}"
392
+
393
+ }
394
+
395
+ zone_spe = lambda { |current_tool|
396
+ puts "current tool is : #{:current_tool} now creating specific zone"
397
+ # b = box({ width: 33, height: 12 })
398
+ # b.text({ data: :all })
399
+
400
+ }
401
+
402
+ {
403
+ activation: active_code,
404
+ inactivation: inactive_code,
405
+ alteration: { width: 22, blur: 3 },
406
+ pre: pre_code,
407
+ post: post_code,
408
+ zone: zone_spe,
409
+ int8: { french: :couleur, english: :color, german: :colorad } }
410
+
411
+ end
412
+
413
+ new({ tool: :box }) do |params|
414
+
415
+ active_code = lambda {
416
+ puts :creation_tool_code_activated
417
+ }
418
+
419
+ inactive_code = lambda { |atomes_treated|
420
+ puts :creation_tool_code_inactivated
421
+
422
+ }
423
+ pre_creation_code = lambda { |params|
424
+ puts "pre_creation_code : atome_touched : #{:params} "
425
+
426
+ }
427
+
428
+ post_creation_code = lambda { |params|
429
+ puts "post_creation_code,atome_touched: #{:params}"
430
+ }
431
+
432
+ { creation: { box: { color: :blue, width: 66, height: 66 } },
433
+ activation: active_code,
434
+ inactivation: inactive_code,
435
+ pre: pre_creation_code,
436
+ post: post_creation_code,
437
+ int8: { french: :formes, english: :shape, german: :jesaispas } }
438
+
439
+ end
440
+
441
+ new({ tool: :drag }) do |params|
442
+
443
+ active_code = lambda {
444
+ # Atome.selection.each do |atome_id_to_treat|
445
+ # # reinit first to avoid multiple drag event
446
+ # grab(atome_id_to_treat).drag(false)
447
+ # end
448
+ # drag_remove
449
+ # puts :alteration_tool_code_activated
450
+ }
451
+
452
+ inactive_code = lambda { |param|
453
+ # puts :alteration_tool_code_inactivated
454
+ }
455
+ pre_code = lambda { |params|
456
+ atome_target = params[:atome_touched]
457
+ # puts "==> #{atome_target.drag}"
458
+ if atome_target.drag
459
+ atome_target.drag(false)
460
+ else
461
+ atome_target.drag(true)
462
+ end
463
+
464
+ }
465
+ post_code = lambda { |params|
466
+ # puts "post_creation_code,atome_touched: #{params}"
467
+
468
+ }
469
+
470
+ zone_spe = lambda { |current_tool|
471
+ # puts "current tool is : #{current_tool} now creating specific zone"
472
+ # b = box({ width: 33, height: 12 })
473
+ # b.text({ data: :all })
474
+
475
+ }
476
+
477
+ {
478
+ activation: active_code,
479
+ inactivation: inactive_code,
480
+ # alteration: { drag: true },
481
+ pre: pre_code,
482
+ post: post_code,
483
+ zone: zone_spe,
484
+ int8: { french: :drag, english: :drag, german: :drag } }
485
+
486
+ end
487
+
488
+ new({ tool: :select }) do |params|
489
+ pre_code = lambda { |param|
490
+ atome_touched = param[:atome_touched]
491
+ current_tool = param[:current_tool]
492
+ if atome_touched.selected
493
+ atome_touched.selected(false)
494
+ current_tool.data[:allow_alteration] = false
495
+ else
496
+ # alert atome_touched.selected
497
+ # alert Atome.selection
498
+ atome_touched.selected(true)
499
+ # alert atome_touched.selected
500
+
501
+ current_tool.data[:allow_alteration] = true
502
+ end
503
+ }
504
+ {
505
+ pre: pre_code,
506
+ alteration: { selected: true },
507
+ int8: { french: :select, english: :select, german: :select }
508
+ }
509
+ end
510
+
511
+ new({ tool: :rotate }) do
512
+ { alteration: { height: 150, rotate: 45 } }
513
+ end
514
+ new({ tool: :move }) do |params|
515
+ active_code = lambda {
516
+ # if Atome.selection.instance_of? Array
517
+ # end
518
+ Atome.selection.each do |atome_id_to_treat|
519
+ # # # reinit first to avoid multiple drag event
520
+ # # grab(atome_id_to_treat).drag(false)
521
+ end
522
+ # drag_remove
523
+ # puts :alteration_tool_code_activated
524
+ }
525
+
526
+ inactive_code = lambda { |params|
527
+ # we remove drag
528
+ params[:treated].each do |atome_f|
529
+ atome_f.drag(false)
530
+ end
531
+ # puts :alteration_tool_code_inactivated
532
+
533
+ }
534
+ pre_code = lambda { |params|
535
+ atome_target = params[:atome_touched]
536
+ # puts "==> #{atome_target.drag}"
537
+ if atome_target.drag
538
+ # atome_target.drag(false)
539
+ else
540
+ atome_target.drag(true)
541
+ end
542
+
543
+ }
544
+ post_code = lambda { |params|
545
+
546
+ # puts "post_creation_code,atome_touched: #{params}"
547
+
548
+ }
549
+
550
+ zone_spe = lambda { |current_tool|
551
+ # puts "current tool is : #{current_tool} now creating specific zone"
552
+ # b = box({ width: 33, height: 12 })
553
+ # b.text({ data: :all })
554
+
555
+ }
556
+
557
+ {
558
+ activation: active_code,
559
+ inactivation: inactive_code,
560
+ # alteration: { drag: true },
561
+ pre: pre_code,
562
+ post: post_code,
563
+ zone: zone_spe,
564
+ int8: { french: :drag, english: :drag, german: :drag } }
565
+
566
+ end
567
+ new({ tool: :project }) do
568
+ active_code = lambda {
569
+
570
+ alert :get_projects_now
571
+ # if Atome.selection.instance_of? Array
572
+ # end
573
+ # Atome.selection.each do |atome_id_to_treat|
574
+ # # # # reinit first to avoid multiple drag event
575
+ # # # grab(atome_id_to_treat).drag(false)
576
+ # end
577
+ # drag_remove
578
+ # puts :alteration_tool_code_activated
579
+ }
580
+ { activation: active_code }
581
+ end
582
+ # new({ tool: :move }) do
583
+ # inactivate=lambda{|param|
584
+ # param[:treated].each do |atome_f|
585
+ # atome_f.drag(false)
586
+ # end
587
+ # }
588
+ # { alteration: { drag: true, left: nil , top: nil}, inactivation: inactivate }
39
589
  # end
40
- #
41
- # class Object
42
- # def new(params, &bloc)
43
- # # Genesis = Genesis.Genesis
44
- # if params.key?(:atome)
45
- # Universe.add_atomes_specificities params[:atome]
46
- # Genesis.build_atome(params[:atome], &bloc)
47
- # elsif params.key?(:particle)
48
- # Atome.instance_variable_set("@main_#{params[:particle]}", bloc)
49
- # # render indicate if the particle needs to be rendered
50
- # # store tell the system if it need to store the particle value
51
- # # type help the system what type of type the particle will receive and store
52
- # Genesis.build_particle(params[:particle], { render: params[:render], return: params[:return],
53
- # store: params[:store], type: params[:type] }, &bloc)
54
- # elsif params.key?(:sanitizer)
55
- # Genesis.build_sanitizer(params[:sanitizer], &bloc)
56
- # elsif params.key?(:pre)
57
- # Atome.instance_variable_set("@pre_#{params[:pre]}", bloc)
58
- # elsif params.key?(:post)
59
- # Atome.instance_variable_set("@post_#{params[:post]}", bloc)
60
- # elsif params.key?(:after)
61
- # Atome.instance_variable_set("@after_#{params[:after]}", bloc)
62
- # elsif params.key?(:read)
63
- # Atome.instance_variable_set("@read_#{params[:read]}", bloc)
64
- # elsif params[:renderer]
65
- # renderer_found = params[:renderer]
66
- # if params[:specific]
67
- # Universe.set_atomes_specificities(params)
68
- # params[:specific] = "#{params[:specific]}_"
69
- # end
70
- # render_method = "#{renderer_found}_#{params[:specific]}#{params[:method]}"
71
- # Genesis.build_render(render_method, &bloc)
72
- # elsif params.key?(:callback)
73
- # particle_targetted = params[:callback]
74
- # Atome.define_method "#{particle_targetted}_callback" do
75
- # bloc.call
76
- # end
77
- # elsif params.key?(:tool)
78
- # A.build_tool(&bloc)
79
- # end
80
- # end
590
+ ### tool2 test
591
+
592
+ Atome.init_intuition
593
+
594
+ # ###################
595
+
596
+ b = box({ left: 123, top: 66, selected: false, id: :the_box, color: :green })
597
+ b.touch(:down) do
598
+ puts " on touch : #{Universe.allow_localstorage}"
599
+ end
600
+ b.resize(true) do
601
+ puts :good!
602
+ end
603
+ the_circ = circle({ left: 123, top: 120, selected: false, id: :the_circle })
604
+
605
+ the_circ.touch(:down) do |params|
606
+ puts " down : params: #{params}, id: #{the_circ.id}"
607
+ end
608
+
609
+ the_circ.touch(:up) do
610
+ puts "up :kool"
611
+ end
612
+ the_circ.drag(true) do
613
+ puts "drag : now"
614
+ end
615
+
616
+ bb = box({ left: 333, width: 120, selected: false, id: :big_box })
617
+
618
+ b = box({ id: :the_big_boxy })
619
+ # text({ data: :hello, selected: true, left: 120, id: :texting, blur: 12 })
620
+ # text({data: :hello, left: 120, id: :texting})
621
+ # Universe.tools.each_with_index do |(tool_name, bloc), index|
622
+ # Atome.instance_exec(&bloc) if bloc.is_a?(Proc)
623
+ # # alert "#{tool_name} : #{tool_content}"
624
+ # # alert b.id
81
625
  # end
82
- #
83
- #
84
- # def record_tool
85
- # grab(Universe.current_user).selection
86
- # alert "must get selection to treat it "
626
+
627
+ # wait 2 do
628
+ # # c.preset( {:box=>{:width=>39, :height=>39, :apply=>[:box_color], :left=>0, :top=>0}} )
629
+ # c.preset( :box )
87
630
  # end
88
- #
89
- #
90
- # module Intuition
91
- # class << self
92
- # def style
93
- # size=39
94
- # style={}
95
- # style[:toolbox]={width: size}
96
- # style[:toolbox]={height: size}
97
- # style[:tool]={width: size}
98
- # style[:tool]={height: size}
99
- #
100
- # style
101
- # end
102
- # def intuition_int8
103
- # # tool taxonomy and list
104
- # {
105
- # capture: { int8: { french: :enregistrement, english: :record, german: :datensatz } },
106
- # communication: { french: :communication, english: :communication, german: :communication },
107
- # tool: { french: :outils, english: :tools, german: :werkzeuge },
108
- # view: { french: :vue, english: :view, german: :aussicht },
109
- # time: { french: :horloge, english: :clock, german: :Uhr },
110
- # find: { french: :trouve, english: :find, german: :finden },
111
- # home: { french: :accueil, english: :home, german: :zuhause },
112
- # code: { french: :code, english: :code, german: :code },
113
- # impulse: { french: :impulse, english: :impulse, german: :impulse },
114
- # }
115
- # end
116
- # def intuition_taxonomy
117
- #
118
- # end
119
- #
120
- # def impulse
121
- # # tool start point
122
- # [:capture, :communication, :tool, :view, :time, :find, :home]
631
+ # b=box({left: 333, top: 333})
632
+ # b.touch(true) do
633
+ # alert Atome.selection
634
+ # end
635
+ # grab(:the_texting).color(:white)
636
+ # grab(:the_texting).left(33)
637
+ # grab(:the_texting).top(133)
638
+ # grab(:the_texting).width(133)
639
+ # grab(:the_texting).top(133)
640
+ # grab(:the_texting).data(:kool)
641
+ # grab(:the_texting).type(:text)
642
+ # grab(:the_texting).rotate(:text)
643
+
644
+ # b=box
645
+ # b.touch(true) do
646
+ # puts :ok
647
+ # # alert b.instance_variable_get('@touch')
648
+ # # alert b.instance_variable_get('@touch_code')
649
+ # b.touch(false)
650
+ # wait 3 do
651
+ # puts :ready
652
+ # b.touch(true) do
653
+ # puts :kool
123
654
  # end
655
+ # # alert b.touch
656
+ # # alert b.instance_variable_get('@touch')
657
+ # # alert b.instance_variable_get('@touch_code')
124
658
  # end
125
- #
126
- #
127
- # # def capture
128
- # # categories=ATOME.methods_categories
129
- # # [categories[:inputs]]
130
- # # end
131
- # #
132
- # # def communication
133
- # # categories=ATOME.methods_categories
134
- # # [categories[:communications]]
135
- # # end
136
- # #
137
- # # def toolz
138
- # # categories=ATOME.methods_categories
139
- # # [categories[:spatials],categories[:helpers],categories[:materials],
140
- # # categories[:geometries],categories[:effects],
141
- # # categories[:medias],categories[:hierarchies],categories[:utilities],categories[:events]]
142
- # # end
143
- # #
144
- # # def tool_style(size = 33)
145
- # # # styling
146
- # # shadows = [{ x: size / 15, y: size / 15, thickness: 0, blur: size / 3, color: { red: 0, green: 0, blue: 0, alpha: 0.3 } }, { x: -size / 15, y: -size / 15, thickness: 0, blur: size / 6, color: { red: 1, green: 1, blue: 1, alpha: 0.3 } }]
147
- # # style = { type: :tool, content: { points: 4 }, color: { red: 0.9, green: 0.9, blue: 0.9, alpha: 0.15 }, parent: :intuition, shadow: shadows, blur: { value: 6, invert: true } }
148
- # # return style
149
- # # end
150
- # #
151
- # # def open_tool(tool_id, widthness=3, orientation=:x, speed=0.6)
152
- # # if orientation == :x
153
- # # orientation = :width
154
- # # value = grab(tool_id).width
155
- # # else
156
- # # orientation = :height
157
- # # value = grab(tool_id).height
158
- # # end
159
- # # animate({
160
- # # start: { orientation => value },
161
- # # end: { orientation => value * widthness },
162
- # # duration: speed * 1000,
163
- # # loop: 0,
164
- # # curve: :easing,
165
- # # target: tool_id
166
- # # })
167
- # # notification "find why this id #{self.atome_id}, add annimation callback to set overflow when anim complete"
168
- # # grab(tool_id).overflow(:visible)
169
- # # end
170
- # #
171
- # # def close_tool(tool_id, widthness, orientation, speed)
172
- # # if orientation == :x
173
- # # orientation = :width
174
- # # value = grab(tool_id).width
175
- # # else
176
- # # orientation = :height
177
- # # value = grab(tool_id).height
178
- # # end
179
- # # animate({
180
- # # start: { orientation => value * widthness },
181
- # # end: { orientation => value },
182
- # # duration: speed * 1000,
183
- # # loop: 0,
184
- # # curve: :easing,
185
- # # target: tool_id
186
- # # })
187
- # # # grab(tool_id).overflow(:hidden)
188
- # # end
189
- # #
190
- # # def create_tool(tool_name, size = 33, x_pos = 0, y_pos = 33, offsset=0)
191
- # # tool_created = tool(self.tool_style(size).merge({ parent: :main_menu, atome_id: "tool_" + tool_name, id: "tool_" + tool_name,
192
- # # width: size, height: size, smooth: size / 9, overflow: :hidden, x: x_pos, y: y_pos, z: 1, content: [] }))
193
- # # icon=tool_created.shape({ path: tool_name, width: size - size / 2, height: size - size / 2, center: true })
194
- # # # name = intuition_list[tool_name][language]
195
- # # particle({ atome_id: :tools_property_container, color: { red: 0.6, green: 0.6, blue: 0.6 } })
196
- # # # we get the plugin code only if the plugin hasn't been interpreted before (unless condition below)
197
- # # unless grab(:intuition).content.include? tool_name
198
- # # ATOME.reader("./medias/e_rubies/tools/#{tool_name}.rb") do |data|
199
- # # # todo add a security parser here
200
- # # # we set the variable tool that can be used to facilitate plugin creation
201
- # # data="tool=grab(:#{tool_created.atome_id})\n"+data
202
- # # compile(data)
203
- # # # we add the tool to the intuition content so it won't be loaded twice
204
- # # grab(:intuition).content |= [tool_name]
205
- # # end
206
- # # end
207
- # # # end
208
- # # tool_created.active({ exec: false })
209
- # # tool_created.inactive({ exec: false })
210
- # # icon.touch(stop: true) do
211
- # # if tool_created.active[:exec] == true
212
- # # tool_created.color(:transparent)
213
- # # tool_created.active(exec: false, proc: tool_created.active[:proc] )
214
- # # tool_created.inactive(exec: true, proc: tool_created.inactive[:proc] )
215
- # # else
216
- # # tool_created.color({alpha: 0.3})
217
- # # tool_created.active({ exec: true, proc: tool_created.active[:proc] })
218
- # # end
219
- # # end
220
- # # end
221
- # #
222
- # # # we get menu entry point
223
- # # def open_intuition(position = {})
224
- # # position = { x: 0, yy: 0, size: 33, orientation: :vertical, offset: 0 }.merge(position)
225
- # # # we get content language from view's language
226
- # # if grab(:main_menu)
227
- # # grab(:main_menu).delete
228
- # # else
229
- # # grab(:view).language
230
- # # self.language(grab(:view).language)
231
- # # orientation = position.delete(:orientation)
232
- # # size = position.delete(:size)
233
- # # offset = position.delete(:offset)
234
- # # # positioning and scaling
235
- # # if orientation == :vertical
236
- # # requested_width = size
237
- # # requested_height = (size+offset)* impulse.length
238
- # # else
239
- # # requested_width = (size+offset) * impulse.length
240
- # # requested_height = size
241
- # # end
242
- # # tool({ atome_id: :main_menu, parent: :intuition, color: { alpha: 0 } }.merge(position).merge(width: requested_width, height: requested_height))
243
- # # impulse.each_with_index do |item, index|
244
- # # if orientation == :vertical
245
- # # create_tool(item, size, 0, index * (size+offset))
246
- # # else
247
- # # create_tool(item, size, index * (size+offset), 0)
248
- # # end
249
- # # end
250
- # # end
251
- # # end
252
- # end
253
- # # atome class extension for eVe
254
- #
255
- # class Atome
256
- # include Intuition
257
- # # def atome(requested_property)
258
- # # # add component list iin the content we maybe ahave to create a tool object because box can't handle this type of content
259
- # # new_atome=self.tool({ atome_id: "#{self.atome_id}_#{requested_property}_atome_#{self.content.length}", x: 66})
260
- # # new_atome.touch({ stop: true, option: :down}) do
261
- # # color(:red)
262
- # # new_atome.height = new_atome.height*3
263
- # # end
264
- # # new_atome.touch({ stop: true, option: :up}) do
265
- # # color(:red)
266
- # # new_atome.height = new_atome.height/3
267
- # # end
268
- # # notification "now we have to add an object or a new property (style) to store complete tool style including size and
269
- # # orientation so we can position the new atome correctly"
270
- # # # alert self.content.class
271
- # # # alert self.content.length
272
- # # # alert tool_style
273
- # # end
274
659
  # end
275
- #
276
- # # # we initialise the toolbox here :
277
- # #
278
- # # # the launch bar
279
- # # launch_bar = box({ x: 0, y: 0, width: 33, height: "100%", parent: :intuition, z: 0, color: { alpha: 0 } })
280
- # # launch_bar.touch({ option: :long }) do |evt|
281
- # # size = 33
282
- # # yy_touch_position = grab(:view).convert(:height) - evt.page_y
283
- # # if yy_touch_position < size
284
- # # #if the long touch is within the wanted area( in this at bottom of the screen) we open the menu
285
- # # # launch_bar.open_intuition({ x: size, yy: 6,offset: 6, orientation: :horizontal, size: size })
286
- # # launch_bar.open_intuition({ x: 6, yy: size,offset: 6, orientation: :vertical, size: size })
287
- # # end
288
- # # end
289
- # #
290
- # # # # # # # # # # # # # # # # tests below # # # # # # # # # # # # #
291
- # #
292
- # # list = molecule_analysis(@molecules_list)
293
- # # notif list[:tools]
294
- # # notif "======"
295
- # # notif list[:molecules]
296
- # # notif "======"
297
- # # notif list[:atomes]
298
- # # notif "======"
299
- # # notif list[:molecules][:shadow]
300
- # # let's build the toolbox
301
- # grab(:intuition).box({id: :toolbox, top: :auto, bottom: 0, left: 0, width: Intuition.style[:toolbox][:width], height: 255})
302
- #
303
- # # tool builder
304
- #
305
- # new({ tool: :capture }) do |params|
306
- # tool = { id: :rec_01,
307
- # name: :record, icon: :record, action: {open: [:sub_menu]}, code: :record_tool, position: { root: 1 }, # position can be multiple
308
- # option: { opt1: :method_2 }, int8: { french: :enregistrement, english: :record, german: :datensatz } }
309
- # tool
310
- # end
311
- # # Intuition::toolbox_style
312
- # # Intuition.toolbox_style
313
- # # puts A.impulse
314
- # # def fill_toolzone(tools_ids)
315
- # #
316
- # # end
317
- # #
318
- # # fill_toolzone(%i[files edition select group link copy undo settings])
319
- #
660
+
661
+ # A.html.record
662
+
663
+ # A.html.record
664
+
665
+
320
666