atome 0.5.7.1.0 → 0.5.7.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/atome/genesis/particles/property.rb +3 -1
- data/lib/atome/kernel/universe.rb +2 -1
- data/lib/atome/version.rb +1 -1
- data/lib/renderers/html/html.rb +21 -5
- data/lib/renderers/html/material.rb +10 -10
- data/lib/renderers/html/property.rb +5 -0
- data/vendor/assets/application/examples/rotate.rb +8 -0
- data/vendor/assets/application/examples/test.rb +57 -584
- 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 +1 -0
- data/vendor/assets/src/index_opal.html +1 -0
- data/vendor/assets/src/index_server.html +1 -0
- data/vendor/assets/src/index_server_wasm.html +1 -0
- data/vendor/assets/src/index_wasm.html +1 -0
- data/vendor/assets/src/js/third_parties/wavesurfer.min.js +1 -0
- data/vendor/assets/src/medias/images/icons/module.svg +6 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a382b0c451af7a259820a14e61aadbf779d0ddba6a67a603ec3940a28d6f252
|
4
|
+
data.tar.gz: a44e9004e18b867645ca3be9681d295997cce04fd7b4c13b8107b546b76e0e2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 956973bed7a67e04f0ec7c2921602b1751afc5281f9869587596be81621eb4cf323f870183ae9dabc5fa9a476f7e67926f8255a65adc6c9daeacdf433dc7c494
|
7
|
+
data.tar.gz: bf54e93e8ab7a82854f6da1a185c2926f7bef89222da5a80b28fedb24a052ec083b2cd6341754116e72f4fb5e10f55d9f67d24df45081d055606b04787a7f7c7
|
@@ -142,6 +142,8 @@ new({ particle: :value }) do |val|
|
|
142
142
|
val
|
143
143
|
end
|
144
144
|
|
145
|
-
new({ particle: :behavior })
|
145
|
+
new({ particle: :behavior, type: :symbol, category: :property })
|
146
146
|
|
147
147
|
new({ particle: :orientation, type: :symbol, category: :property })
|
148
|
+
|
149
|
+
new({ particle: :align , type: :symbol, category: :property })
|
@@ -23,6 +23,7 @@ class Universe
|
|
23
23
|
@allow_sync = false # temp server storage sync
|
24
24
|
@connected = false
|
25
25
|
@database_ready = false
|
26
|
+
@tools_root=[]
|
26
27
|
@tools = {}
|
27
28
|
@allow_tool_operations = false
|
28
29
|
@active_tools = []
|
@@ -33,7 +34,7 @@ class Universe
|
|
33
34
|
class << self
|
34
35
|
attr_reader :atomes, :atomes_ids, :renderer_list, :molecule_list, :atome_list, :particle_list, :classes, :counter,
|
35
36
|
:atomes_specificities
|
36
|
-
attr_accessor :connected, :allow_sync, :allow_localstorage, :database_ready, :edit_mode, :tools,
|
37
|
+
attr_accessor :connected, :allow_sync, :allow_localstorage, :database_ready, :edit_mode, :tools,:tools_root,
|
37
38
|
:allow_tool_operations, :active_tools, :atome_preset, :applicable_atomes, :default_selection_style
|
38
39
|
|
39
40
|
def messages
|
data/lib/atome/version.rb
CHANGED
data/lib/renderers/html/html.rb
CHANGED
@@ -1339,6 +1339,7 @@ STRDELIM
|
|
1339
1339
|
# Table manipulation
|
1340
1340
|
|
1341
1341
|
def table(data)
|
1342
|
+
|
1342
1343
|
table_html = JS.global[:document].createElement('table')
|
1343
1344
|
thead = JS.global[:document].createElement('thead')
|
1344
1345
|
|
@@ -1358,7 +1359,7 @@ STRDELIM
|
|
1358
1359
|
|
1359
1360
|
table_html.appendChild(thead)
|
1360
1361
|
tbody = JS.global[:document].createElement('tbody')
|
1361
|
-
|
1362
|
+
# alert data
|
1362
1363
|
data.each_with_index do |row, row_index|
|
1363
1364
|
tr = JS.global[:document].createElement('tr')
|
1364
1365
|
|
@@ -1388,6 +1389,20 @@ STRDELIM
|
|
1388
1389
|
JS.global[:document].querySelector("##{@id}").appendChild(table_html)
|
1389
1390
|
end
|
1390
1391
|
|
1392
|
+
|
1393
|
+
|
1394
|
+
# Helper function to handle Atome objects
|
1395
|
+
def handle_atome(atome, td_element)
|
1396
|
+
atome.fit(cell_height)
|
1397
|
+
html_element = JS.global[:document].getElementById(atome.id.to_s)
|
1398
|
+
td_element.appendChild(html_element)
|
1399
|
+
html_element[:style][:transformOrigin] = 'top left'
|
1400
|
+
html_element[:style][:position] = 'relative'
|
1401
|
+
atome.top(0)
|
1402
|
+
atome.left(0)
|
1403
|
+
end
|
1404
|
+
|
1405
|
+
|
1391
1406
|
def refresh_table(_params)
|
1392
1407
|
# first we need to extact all atome from the table or they will be deleted by the table refres
|
1393
1408
|
data = @original_atome.data
|
@@ -1425,18 +1440,19 @@ STRDELIM
|
|
1425
1440
|
end
|
1426
1441
|
|
1427
1442
|
def set_td_style(td)
|
1428
|
-
cell_height =
|
1443
|
+
cell_height = @original_atome.component[:height]
|
1444
|
+
cell_width = @original_atome.component[:width]
|
1429
1445
|
td[:style][:border] = '1px solid black'
|
1430
1446
|
td[:style][:backgroundColor] = 'white'
|
1431
1447
|
td[:style][:boxShadow] = '10px 10px 5px #888888'
|
1432
|
-
td[:style][:width] = "#{
|
1433
|
-
td[:style]['min-width'] = "#{
|
1448
|
+
td[:style][:width] = "#{cell_width}px"
|
1449
|
+
td[:style]['min-width'] = "#{cell_width}px"
|
1434
1450
|
td[:style]['max-width'] = "#{cell_height}px"
|
1435
1451
|
td[:style]['min-height'] = "#{cell_height}px"
|
1436
1452
|
td[:style]['max-height'] = "#{cell_height}px"
|
1437
1453
|
td[:style][:height] = "#{cell_height}px"
|
1438
1454
|
td[:style][:overflow] = 'hidden'
|
1439
|
-
{ cell_height: cell_height, cell_width:
|
1455
|
+
{ cell_height: cell_height, cell_width: cell_width }
|
1440
1456
|
end
|
1441
1457
|
|
1442
1458
|
def insert_cell(params)
|
@@ -20,9 +20,11 @@ new({ method: :remove, renderer: :html, type: :string }) do |object_id_to_remove
|
|
20
20
|
when :category
|
21
21
|
html.remove_class(value)
|
22
22
|
else
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
if object_id_to_remove[:all]
|
24
|
+
atome_ids_found = send(object_id_to_remove[:all])
|
25
|
+
atome_ids_found.each do |atome_id|
|
26
|
+
remove(atome_id)
|
27
|
+
end
|
26
28
|
end
|
27
29
|
end
|
28
30
|
end
|
@@ -44,9 +46,7 @@ new({ method: :remove, renderer: :html, type: :string }) do |object_id_to_remove
|
|
44
46
|
html.style("boxShadow", 'none')
|
45
47
|
html.style("filter", 'none')
|
46
48
|
@apply.delete(object_id_to_remove)
|
47
|
-
# apply(@apply)
|
48
49
|
when :border
|
49
|
-
# alert :poipoipoipoipo
|
50
50
|
html.style("border", 'none')
|
51
51
|
html.style("filter", 'none')
|
52
52
|
@apply.delete(object_id_to_remove)
|
@@ -81,20 +81,20 @@ end
|
|
81
81
|
#
|
82
82
|
# html.style(:border, "#{type} #{thickness}px rgba(#{red},#{green},#{blue},#{alpha})")
|
83
83
|
# end
|
84
|
-
new({ method: :thickness, type: :integer, renderer: :html})
|
84
|
+
new({ method: :thickness, type: :integer, renderer: :html })
|
85
85
|
|
86
86
|
# end
|
87
|
-
new({ method: :pattern, type: :integer, renderer: :html})
|
87
|
+
new({ method: :pattern, type: :integer, renderer: :html })
|
88
88
|
|
89
89
|
new({ method: :fill, renderer: :html }) do |params|
|
90
90
|
html.fill(params)
|
91
91
|
end
|
92
92
|
|
93
|
-
new({ method: :opacity, type: :integer, renderer: :html}) do |value|
|
93
|
+
new({ method: :opacity, type: :integer, renderer: :html }) do |value|
|
94
94
|
# html.opacity(value)
|
95
|
-
html.style('opacity',value)
|
95
|
+
html.style('opacity', value)
|
96
96
|
end
|
97
97
|
|
98
98
|
new({ method: :visual, type: :string, renderer: :html, specific: :text }) do |value, _user_proc|
|
99
|
-
|
99
|
+
html.style('fontFamily', value)
|
100
100
|
end
|
@@ -1,584 +1,57 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
shadow
|
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
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
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)
|
313
|
-
# end
|
314
|
-
# state(:open)
|
315
|
-
# }
|
316
|
-
#
|
317
|
-
# inactive_code = lambda { |param|
|
318
|
-
# puts :stop
|
319
|
-
# # impulse.storage[:taxonomy].each do |tool|
|
320
|
-
# # grab("tool_#{tool}").delete(true)
|
321
|
-
# # 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
|
-
# end
|
352
|
-
# end
|
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
|
-
# ##############################################################################################
|
462
|
-
#
|
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
|
-
# 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
|
-
#
|
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
|
-
#
|
542
|
-
#
|
543
|
-
# wait 2 do
|
544
|
-
# A.remove_get_atome_on_touch
|
545
|
-
# wait 3 do
|
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
|
556
|
-
#
|
557
|
-
#
|
558
|
-
# end
|
559
|
-
#
|
560
|
-
# end
|
561
|
-
|
562
|
-
# check_me_first = lambda { |atome_id_found|
|
563
|
-
# puts "first user atome ==> #{grab(atome_id_found).id}"
|
564
|
-
# }
|
565
|
-
# Atome.instance_variable_set('@click_analysis_action', check_me_first)
|
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()
|
1
|
+
m = table({ renderers: [:html], attach: :view, id: :my_test_box, type: :table, apply: [:shape_color],
|
2
|
+
left: 333, top: 0, width: 300, smooth: 15, height: 900, overflow: :scroll, option: { header: false },
|
3
|
+
component: {
|
4
|
+
border: { thickness: 5, color: :blue, pattern: :dotted },
|
5
|
+
overflow: :auto,
|
6
|
+
color: "white",
|
7
|
+
shadow: {
|
8
|
+
id: :s4,
|
9
|
+
left: 20, top: 0, blur: 9,
|
10
|
+
option: :natural,
|
11
|
+
red: 0, green: 1, blue: 0, alpha: 1
|
12
|
+
},
|
13
|
+
# height: 80,
|
14
|
+
# width: 12,
|
15
|
+
component: { size: 12, color: :black }
|
16
|
+
},
|
17
|
+
data: [
|
18
|
+
{ remove_me: :nonono },
|
19
|
+
{ dfgdf: 1, name: 'Alice', age: 30, no: 'oko', t: 123, r: 654, f: 123, g: 654, w: 123, x: 654, c: 123, v: 654 },
|
20
|
+
]
|
21
|
+
})
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
m.data( [
|
26
|
+
{header_title: nil },
|
27
|
+
{ dfgdf:nil, name: nil, age: nil, no: nil, t: nil, r: nil, f: nil, g: nil, w: nil, x: nil, c: nil, v: nil },
|
28
|
+
{ id: nil, name: nil, age: nil },
|
29
|
+
{ dfg: nil, name: nil, age: nil, no: nil },
|
30
|
+
{ dfgd: nil, name: nil, age: nil, no: nil },
|
31
|
+
{header_title: nil },
|
32
|
+
{ dfgdf:nil, name: nil, age: nil, no: nil, t: nil, r: nil, f: nil, g: nil, w: nil, x: nil, c: nil, v: nil },
|
33
|
+
{ id: nil, name: nil, age: nil },
|
34
|
+
{ dfg: nil, name: nil, age: nil, no: nil },
|
35
|
+
{ dfgd: nil, name: nil, age: nil, no: nil },
|
36
|
+
{header_title: nil },
|
37
|
+
{ dfgdf:nil, name: nil, age: nil, no: nil, t: nil, r: nil, f: nil, g: nil, w: nil, x: nil, c: nil, v: nil },
|
38
|
+
{ id: nil, name: nil, age: nil },
|
39
|
+
{ dfg: nil, name: nil, age: nil, no: nil },
|
40
|
+
{ dfgd: nil, name: nil, age: nil, no: nil },
|
41
|
+
{header_title: nil },
|
42
|
+
{ dfgdf:nil, name: nil, age: nil, no: nil, t: nil, r: nil, f: nil, g: nil, w: nil, x: nil, c: nil, v: nil },
|
43
|
+
{ id: nil, name: nil, age: nil },
|
44
|
+
{ dfg: nil, name: nil, age: nil, no: nil },
|
45
|
+
{ dfgd: nil, name: nil, age: nil, no: nil },
|
46
|
+
{header_title: nil },
|
47
|
+
{ dfgdf:nil, name: nil, age: nil, no: nil, t: nil, r: nil, f: nil, g: nil, w: nil, x: nil, c: nil, v: nil },
|
48
|
+
{ id: nil, name: nil, age: nil },
|
49
|
+
{ dfg: nil, name: nil, age: nil, no: nil },
|
50
|
+
{ dfgd: nil, name: nil, age: nil, no: nil },
|
51
|
+
{header_title: nil },
|
52
|
+
{ dfgdf:nil, name: nil, age: nil, no: nil, t: nil, r: nil, f: nil, g: nil, w: nil, x: nil, c: nil, v: nil },
|
53
|
+
{ id: nil, name: nil, age: nil },
|
54
|
+
{ dfg: nil, name: nil, age: nil, no: nil },
|
55
|
+
{ dfgd: nil, name: nil, age: nil, no: nil },
|
56
|
+
|
57
|
+
])
|
@@ -23,11 +23,12 @@ class Atome
|
|
23
23
|
class << self
|
24
24
|
def init_intuition
|
25
25
|
Atome.start_click_analysis
|
26
|
-
root =
|
26
|
+
root = Universe.tools_root
|
27
27
|
root.each_with_index do |root_tool, index|
|
28
28
|
tools_scheme = Universe.tools[root_tool]
|
29
29
|
A.build_tool({ name: root_tool, scheme: tools_scheme, index: index })
|
30
30
|
end
|
31
|
+
|
31
32
|
# Universe.tools.each_with_index do |(tool_name, bloc), index|
|
32
33
|
#
|
33
34
|
# A.build_tool({ name: tool_name, index: index }, &bloc)
|
@@ -511,6 +512,7 @@ end
|
|
511
512
|
new({ tool: :rotate }) do
|
512
513
|
{ alteration: { height: 150, rotate: 45 } }
|
513
514
|
end
|
515
|
+
|
514
516
|
new({ tool: :move }) do |params|
|
515
517
|
active_code = lambda {
|
516
518
|
# if Atome.selection.instance_of? Array
|
@@ -564,6 +566,7 @@ new({ tool: :move }) do |params|
|
|
564
566
|
int8: { french: :drag, english: :drag, german: :drag } }
|
565
567
|
|
566
568
|
end
|
569
|
+
|
567
570
|
new({ tool: :project }) do
|
568
571
|
active_code = lambda {
|
569
572
|
|
@@ -579,43 +582,55 @@ new({ tool: :project }) do
|
|
579
582
|
}
|
580
583
|
{ activation: active_code }
|
581
584
|
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 }
|
589
|
-
# end
|
590
|
-
### tool2 test
|
591
585
|
|
592
|
-
|
586
|
+
new({tool: :test}) do
|
587
|
+
active_code = lambda {
|
588
|
+
# alert :ok
|
589
|
+
b=Object.box
|
590
|
+
# b=grab(:view).box
|
591
|
+
b.touch(true) do
|
592
|
+
Object.alert :kool
|
593
|
+
end
|
594
|
+
}
|
595
|
+
# active_code=:tito
|
596
|
+
{ activation: active_code }
|
597
|
+
end
|
593
598
|
|
594
|
-
# ###################
|
595
599
|
|
596
|
-
|
597
|
-
|
598
|
-
|
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 })
|
600
|
+
# Universe.tools_root=[:box, :blur, :drag, :rotate, :select, :move,:project]
|
601
|
+
Universe.tools_root=[:test]
|
602
|
+
Atome.init_intuition
|
604
603
|
|
605
|
-
the_circ.touch(:down) do |params|
|
606
|
-
puts " down : params: #{params}, id: #{the_circ.id}"
|
607
|
-
end
|
608
604
|
|
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
605
|
|
616
|
-
bb = box({ left: 333, width: 120, selected: false, id: :big_box })
|
617
606
|
|
618
|
-
|
607
|
+
# ################### check below
|
608
|
+
|
609
|
+
# b = box({ left: 123, top: 66, selected: false, id: :the_box, color: :green })
|
610
|
+
# b.touch(:down) do
|
611
|
+
# puts " on touch : #{Universe.allow_localstorage}"
|
612
|
+
# end
|
613
|
+
# b.resize(true) do
|
614
|
+
# puts :good!
|
615
|
+
# end
|
616
|
+
# the_circ = circle({ left: 123, top: 120, selected: false, id: :the_circle })
|
617
|
+
#
|
618
|
+
# the_circ.touch(:down) do |params|
|
619
|
+
# puts " down : params: #{params}, id: #{the_circ.id}"
|
620
|
+
# end
|
621
|
+
#
|
622
|
+
# the_circ.touch(:up) do
|
623
|
+
# puts "up :kool"
|
624
|
+
# end
|
625
|
+
# the_circ.drag(true) do
|
626
|
+
# puts "drag : now"
|
627
|
+
# end
|
628
|
+
#
|
629
|
+
# bb = box({ left: 333, width: 120, selected: false, id: :big_box })
|
630
|
+
#
|
631
|
+
# b = box({ id: :the_big_boxy })
|
632
|
+
|
633
|
+
#################@
|
619
634
|
# text({ data: :hello, selected: true, left: 120, id: :texting, blur: 12 })
|
620
635
|
# text({data: :hello, left: 120, id: :texting})
|
621
636
|
# Universe.tools.each_with_index do |(tool_name, bloc), index|
|
@@ -14,6 +14,7 @@
|
|
14
14
|
<script type="text/javascript" src="js/third_parties/popmotion.min.js" defer></script>
|
15
15
|
<script type="text/javascript" src="js/third_parties/sortable.min.js" defer></script>
|
16
16
|
<script type="text/javascript" src="js/third_parties/wad.min.js" defer></script>
|
17
|
+
<script type="text/javascript" src="js/third_parties/wavesurfer.min.js" defer></script>
|
17
18
|
<script type="text/javascript" src="js/third_parties/sha256.min.js" defer></script>
|
18
19
|
<script type="text/javascript" src="js/third_parties/ping.min.js" defer></script>
|
19
20
|
<script type="text/javascript" src="js/third_parties/fabric.min.js" defer></script>
|
@@ -13,6 +13,7 @@
|
|
13
13
|
<script type="text/javascript" src="js/third_parties/popmotion.min.js" defer></script>
|
14
14
|
<script type="text/javascript" src="js/third_parties/sortable.min.js" defer></script>
|
15
15
|
<script type="text/javascript" src="js/third_parties/wad.min.js" defer></script>
|
16
|
+
<script type="text/javascript" src="js/third_parties/wavesurfer.min.js" defer></script>
|
16
17
|
<script type="text/javascript" src="js/third_parties/sha256.min.js" defer></script>
|
17
18
|
<script type="text/javascript" src="js/third_parties/ping.min.js" defer></script>
|
18
19
|
<script defer src="js/third_parties/fabric.min.js" type="text/javascript"></script>
|
@@ -13,6 +13,7 @@
|
|
13
13
|
<script defer src="js/third_parties/popmotion.min.js" type="text/javascript"></script>
|
14
14
|
<script defer src="js/third_parties/sortable.min.js" type="text/javascript"></script>
|
15
15
|
<script defer src="js/third_parties/wad.min.js" type="text/javascript"></script>
|
16
|
+
<script defer src="js/third_parties/wavesurfer.min.js" type="text/javascript"></script>
|
16
17
|
<script defer src="js/third_parties/sha256.min.js" type="text/javascript"></script>
|
17
18
|
<script defer src="js/third_parties/ping.min.js" type="text/javascript"></script>
|
18
19
|
<script defer src="js/third_parties/fabric.min.js" type="text/javascript"></script>
|
@@ -14,6 +14,7 @@
|
|
14
14
|
<script type="text/javascript" src="js/third_parties/popmotion.min.js" defer></script>
|
15
15
|
<script type="text/javascript" src="js/third_parties/sortable.min.js" defer></script>
|
16
16
|
<script type="text/javascript" src="js/third_parties/wad.min.js" defer></script>
|
17
|
+
<script type="text/javascript" src="js/third_parties/wavesurfer.min.js" defer></script>
|
17
18
|
<script type="text/javascript" src="js/third_parties/sha256.min.js" defer></script>
|
18
19
|
<script type="text/javascript" src="js/third_parties/ping.min.js" defer></script>
|
19
20
|
<script type="text/javascript" src="js/third_parties/fabric.min.js" defer></script>
|
@@ -14,6 +14,7 @@
|
|
14
14
|
<script type="text/javascript" src="js/third_parties/popmotion.min.js" defer></script>
|
15
15
|
<script type="text/javascript" src="js/third_parties/sortable.min.js" defer></script>
|
16
16
|
<script type="text/javascript" src="js/third_parties/wad.min.js" defer></script>
|
17
|
+
<script type="text/javascript" src="js/third_parties/wavesurfer.min.js" defer></script>
|
17
18
|
<script type="text/javascript" src="js/third_parties/sha256.min.js" defer></script>
|
18
19
|
<script type="text/javascript" src="js/third_parties/ping.min.js" defer></script>
|
19
20
|
<script type="text/javascript" src="js/third_parties/fabric.min.js" defer></script>
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):((t="undefined"!=typeof globalThis?globalThis:t||self).WaveSurfer=t.WaveSurfer||{},t.WaveSurfer.Regions=e())}(this,(function(){"use strict";class t{constructor(){this.listeners={}}on(t,e,i){if(this.listeners[t]||(this.listeners[t]=new Set),this.listeners[t].add(e),null==i?void 0:i.once){const i=()=>{this.un(t,i),this.un(t,e)};return this.on(t,i),i}return()=>this.un(t,e)}un(t,e){var i;null===(i=this.listeners[t])||void 0===i||i.delete(e)}once(t,e){return this.on(t,e,{once:!0})}unAll(){this.listeners={}}emit(t,...e){this.listeners[t]&&this.listeners[t].forEach((t=>t(...e)))}}class e extends t{constructor(t){super(),this.subscriptions=[],this.options=t}onInit(){}_init(t){this.wavesurfer=t,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach((t=>t()))}}function i(t,e,i,n,s=3,o=0,r=100){if(!t)return()=>{};const a=matchMedia("(pointer: coarse)").matches;let l=()=>{};const h=h=>{if(h.button!==o)return;h.preventDefault(),h.stopPropagation();let d=h.clientX,c=h.clientY,u=!1;const g=Date.now(),p=n=>{if(n.preventDefault(),n.stopPropagation(),a&&Date.now()-g<r)return;const o=n.clientX,l=n.clientY,h=o-d,p=l-c;if(u||Math.abs(h)>s||Math.abs(p)>s){const n=t.getBoundingClientRect(),{left:s,top:r}=n;u||(null==i||i(d-s,c-r),u=!0),e(h,p,o-s,l-r),d=o,c=l}},v=e=>{if(u){const i=e.clientX,s=e.clientY,o=t.getBoundingClientRect(),{left:r,top:a}=o;null==n||n(i-r,s-a)}l()},m=t=>{t.relatedTarget&&t.relatedTarget!==document.documentElement||v(t)},f=t=>{u&&(t.stopPropagation(),t.preventDefault())},b=t=>{u&&t.preventDefault()};document.addEventListener("pointermove",p),document.addEventListener("pointerup",v),document.addEventListener("pointerout",m),document.addEventListener("pointercancel",m),document.addEventListener("touchmove",b,{passive:!1}),document.addEventListener("click",f,{capture:!0}),l=()=>{document.removeEventListener("pointermove",p),document.removeEventListener("pointerup",v),document.removeEventListener("pointerout",m),document.removeEventListener("pointercancel",m),document.removeEventListener("touchmove",b),setTimeout((()=>{document.removeEventListener("click",f,{capture:!0})}),10)}};return t.addEventListener("pointerdown",h),()=>{l(),t.removeEventListener("pointerdown",h)}}function n(t,e){const i=e.xmlns?document.createElementNS(e.xmlns,t):document.createElement(t);for(const[t,s]of Object.entries(e))if("children"===t)for(const[t,s]of Object.entries(e))"string"==typeof s?i.appendChild(document.createTextNode(s)):i.appendChild(n(t,s));else"style"===t?Object.assign(i.style,s):"textContent"===t?i.textContent=s:i.setAttribute(t,s.toString());return i}function s(t,e,i){const s=n(t,e||{});return null==i||i.appendChild(s),s}class o extends t{constructor(t,e,i=0){var n,s,o,r,a,l,h,d;super(),this.totalDuration=e,this.numberOfChannels=i,this.minLength=0,this.maxLength=1/0,this.contentEditable=!1,this.subscriptions=[],this.subscriptions=[],this.id=t.id||`region-${Math.random().toString(32).slice(2)}`,this.start=this.clampPosition(t.start),this.end=this.clampPosition(null!==(n=t.end)&&void 0!==n?n:t.start),this.drag=null===(s=t.drag)||void 0===s||s,this.resize=null===(o=t.resize)||void 0===o||o,this.color=null!==(r=t.color)&&void 0!==r?r:"rgba(0, 0, 0, 0.1)",this.minLength=null!==(a=t.minLength)&&void 0!==a?a:this.minLength,this.maxLength=null!==(l=t.maxLength)&&void 0!==l?l:this.maxLength,this.channelIdx=null!==(h=t.channelIdx)&&void 0!==h?h:-1,this.contentEditable=null!==(d=t.contentEditable)&&void 0!==d?d:this.contentEditable,this.element=this.initElement(),this.setContent(t.content),this.setPart(),this.renderPosition(),this.initMouseEvents()}clampPosition(t){return Math.max(0,Math.min(this.totalDuration,t))}setPart(){const t=this.start===this.end;this.element.setAttribute("part",`${t?"marker":"region"} ${this.id}`)}addResizeHandles(t){const e={position:"absolute",zIndex:"2",width:"6px",height:"100%",top:"0",cursor:"ew-resize",wordBreak:"keep-all"},n=s("div",{part:"region-handle region-handle-left",style:Object.assign(Object.assign({},e),{left:"0",borderLeft:"2px solid rgba(0, 0, 0, 0.5)",borderRadius:"2px 0 0 2px"})},t),o=s("div",{part:"region-handle region-handle-right",style:Object.assign(Object.assign({},e),{right:"0",borderRight:"2px solid rgba(0, 0, 0, 0.5)",borderRadius:"0 2px 2px 0"})},t);this.subscriptions.push(i(n,(t=>this.onResize(t,"start")),(()=>null),(()=>this.onEndResizing()),1),i(o,(t=>this.onResize(t,"end")),(()=>null),(()=>this.onEndResizing()),1))}removeResizeHandles(t){const e=t.querySelector('[part*="region-handle-left"]'),i=t.querySelector('[part*="region-handle-right"]');e&&t.removeChild(e),i&&t.removeChild(i)}initElement(){const t=this.start===this.end;let e=0,i=100;this.channelIdx>=0&&this.channelIdx<this.numberOfChannels&&(i=100/this.numberOfChannels,e=i*this.channelIdx);const n=s("div",{style:{position:"absolute",top:`${e}%`,height:`${i}%`,backgroundColor:t?"none":this.color,borderLeft:t?"2px solid "+this.color:"none",borderRadius:"2px",boxSizing:"border-box",transition:"background-color 0.2s ease",cursor:this.drag?"grab":"default",pointerEvents:"all"}});return!t&&this.resize&&this.addResizeHandles(n),n}renderPosition(){const t=this.start/this.totalDuration,e=(this.totalDuration-this.end)/this.totalDuration;this.element.style.left=100*t+"%",this.element.style.right=100*e+"%"}toggleCursor(t){var e;this.drag&&(null===(e=this.element)||void 0===e?void 0:e.style)&&(this.element.style.cursor=t?"grabbing":"grab")}initMouseEvents(){const{element:t}=this;t&&(t.addEventListener("click",(t=>this.emit("click",t))),t.addEventListener("mouseenter",(t=>this.emit("over",t))),t.addEventListener("mouseleave",(t=>this.emit("leave",t))),t.addEventListener("dblclick",(t=>this.emit("dblclick",t))),t.addEventListener("pointerdown",(()=>this.toggleCursor(!0))),t.addEventListener("pointerup",(()=>this.toggleCursor(!1))),this.subscriptions.push(i(t,(t=>this.onMove(t)),(()=>this.toggleCursor(!0)),(()=>{this.toggleCursor(!1),this.drag&&this.emit("update-end")}))),this.contentEditable&&this.content&&(this.content.addEventListener("click",(t=>this.onContentClick(t))),this.content.addEventListener("blur",(()=>this.onContentBlur()))))}_onUpdate(t,e){if(!this.element.parentElement)return;const{width:i}=this.element.parentElement.getBoundingClientRect(),n=t/i*this.totalDuration,s=e&&"start"!==e?this.start:this.start+n,o=e&&"end"!==e?this.end:this.end+n,r=o-s;s>=0&&o<=this.totalDuration&&s<=o&&r>=this.minLength&&r<=this.maxLength&&(this.start=s,this.end=o,this.renderPosition(),this.emit("update",e))}onMove(t){this.drag&&this._onUpdate(t)}onResize(t,e){this.resize&&this._onUpdate(t,e)}onEndResizing(){this.resize&&this.emit("update-end")}onContentClick(t){t.stopPropagation();t.target.focus(),this.emit("click",t)}onContentBlur(){this.emit("update-end")}_setTotalDuration(t){this.totalDuration=t,this.renderPosition()}play(){this.emit("play")}setContent(t){var e;if(null===(e=this.content)||void 0===e||e.remove(),t){if("string"==typeof t){const e=this.start===this.end;this.content=s("div",{style:{padding:`0.2em ${e?.2:.4}em`,display:"inline-block"},textContent:t})}else this.content=t;this.contentEditable&&(this.content.contentEditable="true"),this.content.setAttribute("part","region-content"),this.element.appendChild(this.content)}else this.content=void 0}setOptions(t){var e,i;if(t.color&&(this.color=t.color,this.element.style.backgroundColor=this.color),void 0!==t.drag&&(this.drag=t.drag,this.element.style.cursor=this.drag?"grab":"default"),void 0!==t.start||void 0!==t.end){const n=this.start===this.end;this.start=this.clampPosition(null!==(e=t.start)&&void 0!==e?e:this.start),this.end=this.clampPosition(null!==(i=t.end)&&void 0!==i?i:n?this.start:this.end),this.renderPosition(),this.setPart()}if(t.content&&this.setContent(t.content),t.id&&(this.id=t.id,this.setPart()),void 0!==t.resize&&t.resize!==this.resize){const e=this.start===this.end;this.resize=t.resize,this.resize&&!e?this.addResizeHandles(this.element):this.removeResizeHandles(this.element)}}remove(){this.emit("remove"),this.subscriptions.forEach((t=>t())),this.element.remove(),this.element=null}}class r extends e{constructor(t){super(t),this.regions=[],this.regionsContainer=this.initRegionsContainer()}static create(t){return new r(t)}onInit(){if(!this.wavesurfer)throw Error("WaveSurfer is not initialized");this.wavesurfer.getWrapper().appendChild(this.regionsContainer);let t=[];this.subscriptions.push(this.wavesurfer.on("timeupdate",(e=>{const i=this.regions.filter((t=>t.start<=e&&(t.end===t.start?t.start+.05:t.end)>=e));i.forEach((e=>{t.includes(e)||this.emit("region-in",e)})),t.forEach((t=>{i.includes(t)||this.emit("region-out",t)})),t=i})))}initRegionsContainer(){return s("div",{style:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",zIndex:"3",pointerEvents:"none"}})}getRegions(){return this.regions}avoidOverlapping(t){if(!t.content)return;const e=t.content,i=e.getBoundingClientRect(),n=this.regions.map((e=>{if(e===t||!e.content)return 0;const n=e.content.getBoundingClientRect();return i.left<n.left+n.width&&n.left<i.left+i.width?n.height:0})).reduce(((t,e)=>t+e),0);e.style.marginTop=`${n}px`}adjustScroll(t){var e,i;const n=null===(i=null===(e=this.wavesurfer)||void 0===e?void 0:e.getWrapper())||void 0===i?void 0:i.parentElement;if(!n)return;const{clientWidth:s,scrollWidth:o}=n;if(o<=s)return;const r=n.getBoundingClientRect(),a=t.element.getBoundingClientRect(),l=a.left-r.left,h=a.right-r.left;l<0?n.scrollLeft+=l:h>s&&(n.scrollLeft+=h-s)}saveRegion(t){this.regionsContainer.appendChild(t.element),this.avoidOverlapping(t),this.regions.push(t);const e=[t.on("update",(e=>{e||this.adjustScroll(t)})),t.on("update-end",(()=>{this.avoidOverlapping(t),this.emit("region-updated",t)})),t.on("play",(()=>{var e,i;null===(e=this.wavesurfer)||void 0===e||e.play(),null===(i=this.wavesurfer)||void 0===i||i.setTime(t.start)})),t.on("click",(e=>{this.emit("region-clicked",t,e)})),t.on("dblclick",(e=>{this.emit("region-double-clicked",t,e)})),t.once("remove",(()=>{e.forEach((t=>t())),this.regions=this.regions.filter((e=>e!==t)),this.emit("region-removed",t)}))];this.subscriptions.push(...e),this.emit("region-created",t)}addRegion(t){var e,i;if(!this.wavesurfer)throw Error("WaveSurfer is not initialized");const n=this.wavesurfer.getDuration(),s=null===(i=null===(e=this.wavesurfer)||void 0===e?void 0:e.getDecodedData())||void 0===i?void 0:i.numberOfChannels,r=new o(t,n,s);return n?this.saveRegion(r):this.subscriptions.push(this.wavesurfer.once("ready",(t=>{r._setTotalDuration(t),this.saveRegion(r)}))),r}enableDragSelection(t,e=3){var n;const s=null===(n=this.wavesurfer)||void 0===n?void 0:n.getWrapper();if(!(s&&s instanceof HTMLElement))return()=>{};let r=null,a=0;return i(s,((t,e,i)=>{r&&r._onUpdate(t,i>a?"end":"start")}),(e=>{var i,n;if(a=e,!this.wavesurfer)return;const s=this.wavesurfer.getDuration(),l=null===(n=null===(i=this.wavesurfer)||void 0===i?void 0:i.getDecodedData())||void 0===n?void 0:n.numberOfChannels,{width:h}=this.wavesurfer.getWrapper().getBoundingClientRect(),d=e/h*s,c=(e+5)/h*s;r=new o(Object.assign(Object.assign({},t),{start:d,end:c}),s,l),this.regionsContainer.appendChild(r.element)}),(()=>{r&&(this.saveRegion(r),r=null)}),e)}clearRegions(){this.regions.forEach((t=>t.remove()))}destroy(){this.clearRegions(),super.destroy(),this.regionsContainer.remove()}}return r}));
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
3
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1024" height="1024" xml:space="preserve" id="moduleCanvas">
|
4
|
+
<path id="moduleCanvas-bezier" stroke="none" fill="rgb(255, 255, 255)" d="M 896,85.33 L 597.33,85.33 597.33,85.33 C 573.77,85.33 554.67,104.44 554.67,128 L 554.67,426.67 554.67,426.67 C 554.67,450.23 573.77,469.33 597.33,469.33 L 896,469.33 896,469.33 C 919.56,469.33 938.67,450.23 938.67,426.67 L 938.67,128 938.67,128 C 938.67,104.44 919.56,85.33 896,85.33 Z M 853.33,384 L 640,384 640,170.67 853.33,170.67 853.33,384 Z M 853.33,384" />
|
5
|
+
<path id="moduleCanvas-bezier2" stroke="none" fill="rgb(255, 255, 255)" d="M 810.67,512 L 512,512 512,213.33 512,213.33 C 512,189.77 492.9,170.67 469.33,170.67 L 128,170.67 128,170.67 C 104.44,170.67 85.33,189.77 85.33,213.33 L 85.33,896 85.33,896 C 85.33,919.56 104.44,938.67 128,938.67 L 810.67,938.67 810.67,938.67 C 834.23,938.67 853.33,919.56 853.33,896 L 853.33,554.67 853.33,554.67 C 853.33,531.1 834.23,512 810.67,512 Z M 170.67,256 L 426.67,256 426.67,512 170.67,512 170.67,256 Z M 170.67,597.33 L 426.67,597.33 426.67,853.33 170.67,853.33 170.67,597.33 Z M 768,853.33 L 512,853.33 512,597.33 768,597.33 768,853.33 Z M 768,853.33" />
|
6
|
+
</svg>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atome
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.7.1.
|
4
|
+
version: 0.5.7.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean-Eric Godard
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: artoo
|
@@ -623,6 +623,7 @@ files:
|
|
623
623
|
- vendor/assets/application/examples/remove.rb
|
624
624
|
- vendor/assets/application/examples/repeat.rb
|
625
625
|
- vendor/assets/application/examples/resize.rb
|
626
|
+
- vendor/assets/application/examples/rotate.rb
|
626
627
|
- vendor/assets/application/examples/scroll.rb
|
627
628
|
- vendor/assets/application/examples/security.rb
|
628
629
|
- vendor/assets/application/examples/select_text.rb
|
@@ -645,6 +646,7 @@ files:
|
|
645
646
|
- vendor/assets/application/examples/terminal.rb
|
646
647
|
- vendor/assets/application/examples/test.rb
|
647
648
|
- vendor/assets/application/examples/text.rb
|
649
|
+
- vendor/assets/application/examples/text_align.rb
|
648
650
|
- vendor/assets/application/examples/tick.rb
|
649
651
|
- vendor/assets/application/examples/tools.rb
|
650
652
|
- vendor/assets/application/examples/touch.rb
|
@@ -724,6 +726,7 @@ files:
|
|
724
726
|
- vendor/assets/src/js/third_parties/three.min.js
|
725
727
|
- vendor/assets/src/js/third_parties/w3color.js
|
726
728
|
- vendor/assets/src/js/third_parties/wad.min.js
|
729
|
+
- vendor/assets/src/js/third_parties/wavesurfer.min.js
|
727
730
|
- vendor/assets/src/js/third_parties/zim.min.js
|
728
731
|
- vendor/assets/src/medias/audios/audio_missing.wav
|
729
732
|
- vendor/assets/src/medias/audios/clap.wav
|
@@ -793,6 +796,7 @@ files:
|
|
793
796
|
- vendor/assets/src/medias/images/icons/midi_in.svg
|
794
797
|
- vendor/assets/src/medias/images/icons/midi_out.svg
|
795
798
|
- vendor/assets/src/medias/images/icons/mixer.svg
|
799
|
+
- vendor/assets/src/medias/images/icons/module.svg
|
796
800
|
- vendor/assets/src/medias/images/icons/modules.svg
|
797
801
|
- vendor/assets/src/medias/images/icons/new.svg
|
798
802
|
- vendor/assets/src/medias/images/icons/panel.svg
|