atome 0.5.7.3.0 → 0.5.7.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/atome/genesis/particles/event.rb +0 -2
- data/lib/atome/genesis/particles/material.rb +4 -0
- data/lib/atome/version.rb +1 -1
- data/lib/molecules/intuition/tools.rb +179 -26
- data/lib/molecules/intuition/utilities.rb +13 -10
- data/lib/renderers/html/html.rb +60 -45
- data/vendor/assets/application/examples/delete.rb +7 -2
- data/vendor/assets/application/examples/drag.rb +1 -3
- data/vendor/assets/application/examples/remove.rb +62 -52
- data/vendor/assets/application/examples/test.rb +80 -24
- data/vendor/assets/application/examples/touch.rb +6 -0
- data/vendor/assets/src/css/style.css +7 -0
- data/vendor/assets/src/js/third_parties/interact.min.js +3 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bda2b32c6739ba09c874bfdda703d1e64a3e01856b3f80fa01aba15866628335
|
4
|
+
data.tar.gz: 8ce5a6571be7d57c82aa64a345997f881a35c80ad12a3ec77b9ecc6a6fe00d47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e5d67579d27b6fe58b41e63a1b6ac4811b3d47e5cae67f005c234d835760721ddf6d5591594a011b660a719b4a0873b3f5c8eb7840e7a4886dd6cbcc31f2e5b
|
7
|
+
data.tar.gz: 4f01d01a81f832cd14741c3a97ba93b82ee717821971b42aaf9d72f6820975c8b46a0adea51cf679cf114dd80678cd55ef4371b18a4b23fcb18a9e0f48dc0849
|
data/lib/atome/version.rb
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
def truncate_string(string, max_length)
|
4
|
+
string.length > max_length ? string.slice(0, max_length) + "." : string
|
5
|
+
end
|
6
|
+
|
3
7
|
size = 33
|
4
8
|
smooth = 3
|
9
|
+
margin = 3
|
10
|
+
text_color = { alpha: 0.3, red: 1, green: 1, blue: 1 }
|
5
11
|
shadow({
|
6
12
|
id: :tool_shade,
|
7
13
|
left: 3, top: 3, blur: 3,
|
@@ -15,10 +21,13 @@ border({ id: :tool_box_border, thickness: 1, red: 1, green: 1, blue: 1, alpha: 0
|
|
15
21
|
element({ aid: :toolbox_style, id: :toolbox_style, data: {
|
16
22
|
color: :gray,
|
17
23
|
size: size,
|
18
|
-
|
24
|
+
margin: margin,
|
25
|
+
smooth: smooth,
|
26
|
+
text_color: text_color,
|
19
27
|
} })
|
20
28
|
|
21
29
|
class Atome
|
30
|
+
|
22
31
|
def toolbox(tool_list)
|
23
32
|
@toolbox = tool_list[:tools]
|
24
33
|
tool_list[:tools].each_with_index do |root_tool, index|
|
@@ -53,12 +62,16 @@ class Atome
|
|
53
62
|
y = event[:clientY]
|
54
63
|
elements = JS.global[:document].elementsFromPoint(x, y)
|
55
64
|
elements.to_a.each do |atome_touched|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
65
|
+
unless atome_touched.to_s == 'html'
|
66
|
+
id_found = atome_touched[:id].to_s
|
67
|
+
atome_found = grab(id_found)
|
68
|
+
# unless (atome_found && atome_found.tag[:system])
|
69
|
+
if atome_found && !atome_found.tag[:system]
|
70
|
+
Universe.active_tools.each do |tool|
|
71
|
+
apply_tool(tool, atome_found, event)
|
72
|
+
end
|
61
73
|
end
|
74
|
+
|
62
75
|
break
|
63
76
|
end
|
64
77
|
end
|
@@ -150,10 +163,20 @@ class Atome
|
|
150
163
|
tool_actions[:action] = { noop: true }
|
151
164
|
current_tool.data = tool_actions
|
152
165
|
end
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
166
|
+
tool_name = tool.to_s.sub('_tool', '')
|
167
|
+
tools_scheme = Universe.tools[tool_name.to_sym]
|
168
|
+
puts "1 - here slider treat either the target atome types or current atome"
|
169
|
+
puts "2 - need to created a list instead of choosing the last atome found of it's kind"
|
170
|
+
|
171
|
+
target = if tools_scheme[:target]
|
172
|
+
grab(atome_touched.send(tools_scheme[:target]).last)
|
173
|
+
else
|
174
|
+
atome_touched
|
175
|
+
end
|
176
|
+
tools_scheme[:particles]&.each do |particle_f, value_f|
|
177
|
+
target.send(particle_f, value_f)
|
178
|
+
end
|
179
|
+
send(method_found, current_tool, tool_actions, target, a_event)
|
157
180
|
end
|
158
181
|
|
159
182
|
end
|
@@ -178,9 +201,8 @@ class Atome
|
|
178
201
|
alterations = tool_scheme[:alteration] ? tool_scheme[:alteration].keys : []
|
179
202
|
creations = tool_scheme[:creation] ? tool_scheme[:creation].keys : []
|
180
203
|
prev_auth = Universe.allow_localstorage ||= []
|
181
|
-
events_allow = [
|
204
|
+
events_allow = %i[top left right bottom width height]
|
182
205
|
storage_allowed = events_allow.concat(alterations).concat(creations).concat(prev_auth).uniq
|
183
|
-
# alert "#{events_allow}, \n#{alterations} , \n#{creations}, \n #{prev_auth}, \n\n\n#{storage_allowed}"
|
184
206
|
|
185
207
|
Universe.allow_localstorage = storage_allowed
|
186
208
|
# we set edit mode to true (this allow to prevent user atome to respond from click)
|
@@ -191,7 +213,9 @@ class Atome
|
|
191
213
|
tool.data[:created] = []
|
192
214
|
tool.data[:prev_states] = {}
|
193
215
|
# generic behavior
|
194
|
-
tool.apply(:active_tool_col)
|
216
|
+
# tool.apply(:active_tool_col)
|
217
|
+
grab("#{tool_name}_icon").color(:white)
|
218
|
+
grab("#{tool_name}_label").color(:white)
|
195
219
|
Universe.active_tools << tool_name
|
196
220
|
# activation code
|
197
221
|
activation_code = tool_scheme[:activation]
|
@@ -237,7 +261,8 @@ class Atome
|
|
237
261
|
# we delete the attached toolbox if it exist
|
238
262
|
toolbox_tool.delete({ force: true })
|
239
263
|
end
|
240
|
-
|
264
|
+
grab("#{tool_name}_icon").color(grab(:toolbox_style).data[:text_color])
|
265
|
+
grab("#{tool_name}_label").color(grab(:toolbox_style).data[:text_color])
|
241
266
|
# when closing delete tools action from tool_actions_to_exec
|
242
267
|
Universe.active_tools.delete(tool_name)
|
243
268
|
# we check if all tools are inactive if so we set edit_mode to false
|
@@ -273,7 +298,9 @@ class Atome
|
|
273
298
|
grab(:intuition).storage[:tool_open] ||= []
|
274
299
|
grab(:intuition).storage[:tool_open] << tool_name
|
275
300
|
size = grab(:toolbox_style).data[:size]
|
301
|
+
margin = grab(:toolbox_style).data[:margin]
|
276
302
|
smooth = grab(:toolbox_style).data[:smooth]
|
303
|
+
text_color = grab(:toolbox_style).data[:text_color]
|
277
304
|
case orientation_wanted
|
278
305
|
when :sn
|
279
306
|
top = :auto
|
@@ -304,12 +331,13 @@ class Atome
|
|
304
331
|
# orientation: orientation_wanted,
|
305
332
|
top: top,
|
306
333
|
bottom: bottom,
|
334
|
+
depth: 0,
|
307
335
|
left: left,
|
308
336
|
right: right,
|
309
337
|
width: size,
|
310
338
|
height: size,
|
311
339
|
smooth: smooth,
|
312
|
-
apply: [
|
340
|
+
apply: %i[inactive_tool_col tool_box_border tool_shade],
|
313
341
|
state: :closed,
|
314
342
|
data: { method: method,
|
315
343
|
action: action,
|
@@ -328,24 +356,149 @@ class Atome
|
|
328
356
|
icon = tool.vector({ tag: { system: true }, left: 9, top: :auto, bottom: 9, width: 18, height: 18, id: "#{tool_name}_icon",
|
329
357
|
data: { path: { d: edition, id: "p1_#{tool_name}_icon", stroke: :black, 'stroke-width' => 37, fill: :white } } })
|
330
358
|
|
331
|
-
icon.color(
|
359
|
+
icon.color(text_color)
|
360
|
+
|
361
|
+
tool.text({ tag: { system: true }, data: truncate_string(label, 5), component: { size: 9 }, center: { x: 0 }, top: :auto, bottom: 0,
|
362
|
+
color: text_color, id: "#{tool_name}_label", width: size, position: :absolute })
|
332
363
|
|
333
|
-
tool.text({ tag: { system: true }, data: label, component: { size: 9 }, color: :grey, id: "#{tool_name}_label" })
|
334
364
|
code_for_zone = tool_scheme[:zone]
|
335
365
|
tool.instance_exec(tool, &code_for_zone) if code_for_zone.is_a? Proc
|
336
366
|
tool.active(false)
|
337
|
-
tool.touch(
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
367
|
+
tool.touch(:long) do
|
368
|
+
tool.instance_variable_set('@prevent_action', true)
|
369
|
+
if tool.instance_variable_get('@tool_open') == true
|
370
|
+
tool.instance_variable_set('@tool_open', false)
|
371
|
+
tool_scheme[:particles].each do |particle, value|
|
372
|
+
grab("tool_particle_#{particle}").delete({ force: true })
|
373
|
+
end
|
374
|
+
tool.width(size)
|
344
375
|
else
|
345
|
-
tool.
|
346
|
-
|
376
|
+
tool.instance_variable_set('@tool_open', true)
|
377
|
+
|
378
|
+
tool_scheme[:particles].each_with_index do |(particle_name, _value_), ind|
|
379
|
+
|
380
|
+
particle = tool.box({ id: "tool_particle_#{particle_name}", tag: { system: true }, depth: 1, smooth: smooth,
|
381
|
+
apply: %i[inactive_tool_col tool_box_border tool_shade],
|
382
|
+
width: size, height: size, left: ind * (size + margin) + size })
|
383
|
+
particle_label = particle.text({
|
384
|
+
id: "tool_particle_name_#{particle_name}",
|
385
|
+
tag: { system: true },
|
386
|
+
data: truncate_string(particle_name, 5),
|
387
|
+
center: { x: 0 },
|
388
|
+
position: :absolute,
|
389
|
+
component: { size: 9 },
|
390
|
+
color: text_color,
|
391
|
+
top: :auto,
|
392
|
+
}
|
393
|
+
|
394
|
+
)
|
395
|
+
label_value = particle.text({
|
396
|
+
id: "tool_particle_value_#{particle_name}",
|
397
|
+
data: 0.00,
|
398
|
+
tag: { system: true },
|
399
|
+
center: { x: 0 },
|
400
|
+
position: :absolute,
|
401
|
+
component: { size: 9 },
|
402
|
+
color: text_color,
|
403
|
+
top: margin,
|
404
|
+
|
405
|
+
})
|
406
|
+
particle_label.center({ x: 0 })
|
407
|
+
particle_label.top(:auto)
|
408
|
+
particle_label.bottom(0)
|
409
|
+
particle.touch(true) do
|
410
|
+
puts "1 ======> opening !!!#{particle_name}"
|
411
|
+
tool.instance_variable_set('@prevent_action', true)
|
412
|
+
slider_id = "particle_slider_#{particle_name}"
|
413
|
+
if particle.instance_variable_get('@active')
|
414
|
+
grab(slider_id).delete({ force: true })
|
415
|
+
particle.instance_variable_set('@active', false)
|
416
|
+
# particle.top(:auto)
|
417
|
+
# particle.top(:bottom)
|
418
|
+
particle.height(size)
|
419
|
+
particle.top(0)
|
420
|
+
else
|
421
|
+
particle.height(139 + size / 2)
|
422
|
+
particle.top(-139 + size)
|
423
|
+
# particle.top(:auto)
|
424
|
+
# particle.top(:bottom)
|
425
|
+
# particle.color(:green)
|
426
|
+
slider_id = "particle_slider_#{particle_name}"
|
427
|
+
slider_f = particle.slider({ orientation: :vertical,
|
428
|
+
id: slider_id,
|
429
|
+
range: { color: { alpha: 0 } },
|
430
|
+
value: 55,
|
431
|
+
depth: 2,
|
432
|
+
center: { x: 0 },
|
433
|
+
width: 18, height: 123, smooth: 1,
|
434
|
+
left: 0,
|
435
|
+
top: size / 2,
|
436
|
+
color: { alpha: 0 },
|
437
|
+
cursor:
|
438
|
+
{ color: { alpha: 1, red: 0.9, green: 0.9, blue: 0.0 },
|
439
|
+
width: 18, height: 12, smooth: 3 } }) do |value|
|
440
|
+
# Slider actions below:
|
441
|
+
if grab(slider_id).instance_variable_get('@initialised')
|
442
|
+
Atome.selection.each do |atome_id_to_treat|
|
443
|
+
|
444
|
+
# puts "-------> #{tool_scheme[:particles][particle_name]} , #{value }"
|
445
|
+
tool_scheme[:particles][particle_name] = value.to_f / 100
|
446
|
+
# tools_scheme[:particles]
|
447
|
+
atome_found = grab(atome_id_to_treat)
|
448
|
+
target = grab(atome_found.color.last)
|
449
|
+
|
450
|
+
target.send(particle_name, value.to_f / 100)
|
451
|
+
label_value.data(value.to_f / 100)
|
452
|
+
# puts "+++++++> #{tool_scheme[:particles]} }"
|
453
|
+
end
|
454
|
+
end
|
455
|
+
end
|
456
|
+
puts "2 ======> opening !!!#{particle_name}"
|
457
|
+
|
458
|
+
Atome.selection.each do |atome_id_to_treat|
|
459
|
+
atome_found = grab(atome_id_to_treat)
|
460
|
+
puts "here slider treat either the target atome types or current atome"
|
461
|
+
puts "need to created a list instead of choosing the last atome found of it's kind"
|
462
|
+
target = if tool_scheme[:target]
|
463
|
+
grab(atome_found.send(tool_scheme[:target]).last)
|
464
|
+
else
|
465
|
+
atome_found
|
466
|
+
end
|
467
|
+
value_found = target.send(particle_name)
|
468
|
+
slider_f.value(value_found * 100)
|
469
|
+
end
|
470
|
+
slider_f.instance_variable_set('@initialised', true)
|
471
|
+
particle.instance_variable_set('@active', true)
|
472
|
+
end
|
473
|
+
|
474
|
+
end
|
475
|
+
end if tool_scheme[:particles]
|
476
|
+
# tool.width(((size + margin) * (tool_scheme[:particles].length + 1)))
|
347
477
|
end
|
478
|
+
|
479
|
+
end
|
480
|
+
tool.touch(:down) do
|
481
|
+
tool.depth(999)
|
348
482
|
end
|
483
|
+
tool.touch(true) do
|
484
|
+
|
485
|
+
# puts "==> prevent : #{tool.instance_variable_get('@prevent_action')}"
|
486
|
+
unless tool.instance_variable_get('@prevent_action')
|
487
|
+
# we add all specific tool actions to @tools_actions_to_exec hash
|
488
|
+
# we set allow_tool_operations to false to ignore tool operation when clicking on a tool
|
489
|
+
Universe.allow_tool_operations = false
|
490
|
+
# we create the creation_layer if not already exist
|
491
|
+
if tool.active == false # first click
|
492
|
+
tool.activate_tool
|
493
|
+
else
|
494
|
+
tool.deactivate_tool
|
495
|
+
tick[tool_name] = 0
|
496
|
+
end
|
497
|
+
end
|
498
|
+
puts 'reactivation'
|
499
|
+
tool.instance_variable_set('@prevent_action', false)
|
500
|
+
end
|
501
|
+
|
349
502
|
end
|
350
503
|
|
351
504
|
end
|
@@ -154,12 +154,13 @@ new({ molecule: :slider }) do |params, bloc|
|
|
154
154
|
new_id = params.delete(:id) || identity_generator
|
155
155
|
|
156
156
|
default_smooth = 9
|
157
|
-
default_slider_particles = { id: new_id, color: color_found, width: 333, height: 33, left: 0, top: 0,
|
158
|
-
|
157
|
+
default_slider_particles = { id: new_id, color: color_found, width: 333, height: 33, left: 0, top: 0,
|
158
|
+
smooth: default_smooth, tag: { system: true } }
|
159
|
+
default_cursor_particles = { color: color_found, width: 29, height: 29, left: 0, smooth: '100%', tag: { system: true } }
|
159
160
|
cursor_found = params.delete(:cursor)
|
160
161
|
slider_particle = default_slider_particles.merge(params)
|
161
162
|
slider = box(slider_particle)
|
162
|
-
|
163
|
+
slider.remove(:box_color)
|
163
164
|
slider_shadow = slider.shadow({
|
164
165
|
id: :s2,
|
165
166
|
left: 3, top: 3, blur: 9,
|
@@ -167,8 +168,8 @@ new({ molecule: :slider }) do |params, bloc|
|
|
167
168
|
red: 0, green: 0, blue: 0, alpha: 0.7
|
168
169
|
})
|
169
170
|
|
170
|
-
range = slider.box({ id: "#{slider.id}_range", top: :auto, bottom: 0 })
|
171
|
-
|
171
|
+
range = slider.box({ id: "#{slider.id}_range", top: :auto, bottom: 0,tag: { system: true } })
|
172
|
+
range.remove(:box_color)
|
172
173
|
if range_found
|
173
174
|
range.apply(slider_shadow.id,)
|
174
175
|
range_found.each do |part, val|
|
@@ -179,6 +180,7 @@ new({ molecule: :slider }) do |params, bloc|
|
|
179
180
|
end
|
180
181
|
cursor_particle = default_cursor_particles.merge(cursor_found).merge({ id: "#{slider.id}_cursor" })
|
181
182
|
cursor = slider.box(cursor_particle)
|
183
|
+
cursor.remove(:box_color)
|
182
184
|
cursor_left = (slider_particle[:width] - cursor_particle[:width]) / 2.0
|
183
185
|
cursor_top = (slider_particle[:height] - cursor_particle[:height]) / 2.0
|
184
186
|
|
@@ -305,9 +307,9 @@ new(molecule: :button) do |params, bloc|
|
|
305
307
|
button = box(
|
306
308
|
{ renderers: renderer_found, id: new_id, type: :shape, color: back_col,
|
307
309
|
left: 0, top: 0, data: '', attach: attach_to,
|
308
|
-
smooth: 3, overflow: :hidden,
|
310
|
+
smooth: 3, overflow: :hidden,tag: { system: true }
|
309
311
|
})
|
310
|
-
|
312
|
+
button.remove(:box_color)
|
311
313
|
button.touch(:down) do
|
312
314
|
button.tick(:button)
|
313
315
|
bloc.call((button.tick[:button] - 1) % states)
|
@@ -362,7 +364,7 @@ class Atome
|
|
362
364
|
end
|
363
365
|
|
364
366
|
new(molecule: :matrix) do |params, &bloc|
|
365
|
-
params
|
367
|
+
params ||= {}
|
366
368
|
# We test if self is main if so we attach the matrix to the view
|
367
369
|
parent_found = if self == self
|
368
370
|
grab(:view)
|
@@ -391,7 +393,7 @@ new(molecule: :matrix) do |params, &bloc|
|
|
391
393
|
view_width = parent_found.to_px(:width)
|
392
394
|
view_height = parent_found.to_px(:height)
|
393
395
|
matrix_back = box({ id: "#{id}_background", width: size, height: size, color: { alpha: 0 } })
|
394
|
-
|
396
|
+
matrix_back.remove(:box_color)
|
395
397
|
if view_width > view_height
|
396
398
|
full_size = view_height * size_coefficient
|
397
399
|
available_width = full_size - total_spacing_x
|
@@ -427,12 +429,13 @@ new(molecule: :matrix) do |params, &bloc|
|
|
427
429
|
end
|
428
430
|
new(molecule: :page) do |params, &bloc|
|
429
431
|
b = box({ color: :red, left: 99, drag: true })
|
432
|
+
b.remove(:box_color)
|
430
433
|
b.text(params)
|
431
434
|
end
|
432
435
|
new(molecule: :application) do |params, &bloc|
|
433
436
|
|
434
437
|
main_page = box({ drag: true, width: :auto, height: :auto, top: 0, bottom: 0, left: 0, right: 0 })
|
435
|
-
|
438
|
+
main_page.remove(:box_color)
|
436
439
|
main_page
|
437
440
|
|
438
441
|
# def new(params, &bloc)
|
data/lib/renderers/html/html.rb
CHANGED
@@ -1139,70 +1139,78 @@ class HTML
|
|
1139
1139
|
|
1140
1140
|
def touch_down(_option)
|
1141
1141
|
@element[:style][:cursor] = 'pointer'
|
1142
|
-
|
1143
1142
|
@touch_down = @original_atome.instance_variable_get('@touch_code')[:down]
|
1144
1143
|
interact = JS.eval("return interact('##{@id}')")
|
1145
|
-
unless @touch_removed[:down]
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
end
|
1144
|
+
# unless @touch_removed[:down]
|
1145
|
+
interact.on('down') do |native_event|
|
1146
|
+
event = Native(native_event)
|
1147
|
+
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
1148
|
+
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
1149
|
+
# group etc..
|
1150
|
+
# @touch_down.call(event) if @touch_down.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
|
1151
|
+
@touch_down.call(event) if event_validation(@touch_down)
|
1152
|
+
# end
|
1153
|
+
# end
|
1155
1154
|
end
|
1156
1155
|
end
|
1157
1156
|
|
1158
1157
|
def touch_tap(_option)
|
1159
1158
|
@element[:style][:cursor] = 'pointer'
|
1160
1159
|
interact = JS.eval("return interact('##{@id}')")
|
1161
|
-
touch_tap = @original_atome.instance_variable_get('@touch_code')[:tap]
|
1160
|
+
@touch_tap = @original_atome.instance_variable_get('@touch_code')[:tap]
|
1162
1161
|
# unless @touch_removed[:tap]
|
1163
1162
|
interact.on('tap') do |native_event|
|
1163
|
+
|
1164
1164
|
event = Native(native_event)
|
1165
1165
|
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
1166
|
-
# and it's lead to a problem of context and force the use of grab(:view) when
|
1166
|
+
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
1167
1167
|
# group etc..
|
1168
|
-
# @
|
1169
|
-
|
1168
|
+
# @touch_up.call(event) if @touch_up.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
|
1169
|
+
# event = Native(native_event)
|
1170
|
+
# ########## old code :
|
1171
|
+
@touch_tap.call(event) if event_validation(@touch_tap)
|
1172
|
+
# ########## new code:
|
1173
|
+
# proc_content = @touch_tap.call(event) if event_validation(@touch_tap)
|
1174
|
+
# if proc_content.instance_of? Hash
|
1175
|
+
# proc_content.each do |k, v|
|
1176
|
+
# @original_atome.send(k, v)
|
1177
|
+
# end
|
1178
|
+
# end
|
1170
1179
|
end
|
1171
1180
|
# end
|
1172
|
-
|
1173
1181
|
end
|
1174
1182
|
|
1175
1183
|
def touch_up(_option)
|
1176
1184
|
@element[:style][:cursor] = 'pointer'
|
1177
1185
|
interact = JS.eval("return interact('##{@id}')")
|
1178
1186
|
@touch_up = @original_atome.instance_variable_get('@touch_code')[:up]
|
1179
|
-
unless @touch_removed[:up]
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
end
|
1188
|
-
|
1187
|
+
# unless @touch_removed[:up]
|
1188
|
+
interact.on('up') do |native_event|
|
1189
|
+
event = Native(native_event)
|
1190
|
+
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
1191
|
+
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
1192
|
+
# group etc..
|
1193
|
+
# @touch_up.call(event) if @touch_up.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
|
1194
|
+
@touch_up.call(event) if event_validation(@touch_up)
|
1189
1195
|
end
|
1196
|
+
|
1197
|
+
# end
|
1190
1198
|
end
|
1191
1199
|
|
1192
1200
|
def touch_double(_option)
|
1193
1201
|
@element[:style][:cursor] = 'pointer'
|
1194
1202
|
interact = JS.eval("return interact('##{@id}')")
|
1195
1203
|
@touch_double = @original_atome.instance_variable_get('@touch_code')[:double]
|
1196
|
-
unless @touch_removed[:double]
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
+
# unless @touch_removed[:double]
|
1205
|
+
interact.on('doubletap') do |native_event|
|
1206
|
+
event = Native(native_event)
|
1207
|
+
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
1208
|
+
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
1209
|
+
# group etc..
|
1210
|
+
# @touch_double.call(event) if @touch_double.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
|
1211
|
+
@touch_double.call(event) if event_validation(@touch_double)
|
1204
1212
|
|
1205
|
-
end
|
1213
|
+
# end
|
1206
1214
|
end
|
1207
1215
|
|
1208
1216
|
end
|
@@ -1211,18 +1219,18 @@ class HTML
|
|
1211
1219
|
@element[:style][:cursor] = 'pointer'
|
1212
1220
|
@touch_long = @original_atome.instance_variable_get('@touch_code')[:long]
|
1213
1221
|
interact = JS.eval("return interact('##{@id}')")
|
1214
|
-
unless @touch_removed[:long]
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1222
|
+
# unless @touch_removed[:long]
|
1223
|
+
interact.on('hold') do |native_event|
|
1224
|
+
event = Native(native_event)
|
1225
|
+
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
1226
|
+
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
1227
|
+
# group etc..
|
1228
|
+
@touch_long.call(event) if event_validation(@touch_long)
|
1229
|
+
# @touch_long.call(event) if @touch_long.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
|
1230
|
+
# @touch_double.call(event) if event_validation(@touch_double)
|
1223
1231
|
|
1224
|
-
end
|
1225
1232
|
end
|
1233
|
+
# end
|
1226
1234
|
end
|
1227
1235
|
|
1228
1236
|
def touch_remove(option)
|
@@ -1240,6 +1248,13 @@ class HTML
|
|
1240
1248
|
when :tap
|
1241
1249
|
@touch_removed[:tap] = true
|
1242
1250
|
@touch_tap = ''
|
1251
|
+
@touch_removed[:touch] = true
|
1252
|
+
@touch_touch = ''
|
1253
|
+
when :touch
|
1254
|
+
@touch_removed[:tap] = true
|
1255
|
+
@touch_tap = ''
|
1256
|
+
@touch_removed[:touch] = true
|
1257
|
+
@touch_touch = ''
|
1243
1258
|
when :up
|
1244
1259
|
@touch_removed[:up] = true
|
1245
1260
|
@touch_up = ''
|
@@ -4,6 +4,7 @@ b = box()
|
|
4
4
|
b.text('click me')
|
5
5
|
orange=''
|
6
6
|
b.touch(true) do
|
7
|
+
|
7
8
|
c = grab(:view).circle({id: :circling, left: 222, color: :orange, blur: 1.9 })
|
8
9
|
orange=c.box({id: :boxing,color: {id: :orange_col, red: 1, blue: 0.2 }, width: 33, height: 33, left: 123})
|
9
10
|
orange.shadow({
|
@@ -23,10 +24,14 @@ b.touch(true) do
|
|
23
24
|
end
|
24
25
|
end
|
25
26
|
|
26
|
-
c.touch(
|
27
|
-
|
27
|
+
c.touch(:down) do
|
28
|
+
puts '1?'
|
29
|
+
grab(:circling).delete({ recursive: true }) if grab(:circling)
|
28
30
|
end
|
29
31
|
# alert orange.apply
|
32
|
+
wait 4 do
|
33
|
+
grab(:circling).delete({ recursive: true })if grab(:circling)
|
34
|
+
end
|
30
35
|
end
|
31
36
|
|
32
37
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
a=box({width: 666, height: 777, color: :orange})
|
3
4
|
b = box({ left: 666, color: :blue, smooth: 6, id: :the_box2, depth: 1 , top: 66})
|
4
5
|
cc=circle({color: :red, left: 0, top: 0})
|
@@ -16,8 +17,6 @@ b.drag(:stop) do
|
|
16
17
|
clone.delete(true)
|
17
18
|
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
20
|
b.drag(:locked) do |event|
|
22
21
|
dx = event[:dx]
|
23
22
|
dy = event[:dy]
|
@@ -29,7 +28,6 @@ b.drag(:locked) do |event|
|
|
29
28
|
puts "y: #{y}"
|
30
29
|
end
|
31
30
|
cc.drag({ restrict: {max:{ left: 240, top: 190}} }) do |event|
|
32
|
-
|
33
31
|
end
|
34
32
|
|
35
33
|
|