atome 0.5.7.4.3 → 0.5.7.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/atome/extensions/atome.rb +6 -1
- data/lib/atome/genesis/particles/property.rb +4 -4
- data/lib/atome/utilities/utilities.rb +69 -15
- data/lib/atome/version.rb +1 -1
- data/lib/molecules/intuition/tools.rb +99 -25
- data/lib/molecules/intuition/utilities.rb +2 -13
- data/lib/renderers/html/atome_html.rb +4 -0
- data/lib/renderers/html/html.rb +8 -0
- data/vendor/assets/application/examples/applications.rb +1 -1
- data/vendor/assets/application/examples/selected.rb +53 -53
- data/vendor/assets/application/examples/to_percent.rb +9 -0
- data/vendor/assets/application/examples/tools.rb +88 -12
- data/vendor/assets/src/js/atome/atome.js +18 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5696cf0c628b8e6986d2ddff3b4494bdbfaed55ca0acf2f880f0d420d6738825
|
4
|
+
data.tar.gz: ec98989c2130c4616ce68ae3820a2b2c13fb174f9155ba0196539a35d13537a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d2530c93180e30d715a73f1e5f0906634826c286c5a377e7e1d4cbf87d1370f4b41a13ea210df29dd8597fa9d3aa3ca0d843ae1921da3a7ebfec098aa59a803
|
7
|
+
data.tar.gz: 560f821e10b447a07dc82479bef098b2c995f074c0d5eb75372aac6b307b1040fcc042fcf0096c6539be0c79a56d24856f08d2b99ba7ee76db7835f58bc579a0
|
@@ -69,6 +69,10 @@ end
|
|
69
69
|
class Object
|
70
70
|
include ObjectExtension
|
71
71
|
|
72
|
+
def truncate_string(string, max_length)
|
73
|
+
string.length > max_length ? string.slice(0, max_length) + '.' : string
|
74
|
+
end
|
75
|
+
|
72
76
|
|
73
77
|
def remove_key_pair_but(hash, keys_to_keep)
|
74
78
|
hash.dup.delete_if do |key, value|
|
@@ -137,7 +141,8 @@ class Object
|
|
137
141
|
|
138
142
|
# the method below generate Atome method creation at Object level
|
139
143
|
def atome_method_for_object(element)
|
140
|
-
|
144
|
+
|
145
|
+
Object.define_method element do |params=nil, &user_proc|
|
141
146
|
default_parent = Essentials.default_params[element][:attach] || :view
|
142
147
|
grab(default_parent).send(element, params, &user_proc)
|
143
148
|
end
|
@@ -20,7 +20,7 @@ new({ after: :red }) do |params|
|
|
20
20
|
a = affect.dup # FIXME we have to dup else some items in the array array other duplicated
|
21
21
|
a.each do |atome_to_refresh|
|
22
22
|
grab(atome_to_refresh).apply(id)
|
23
|
-
end
|
23
|
+
end if a
|
24
24
|
params
|
25
25
|
end
|
26
26
|
|
@@ -34,7 +34,7 @@ new({ after: :green }) do |params|
|
|
34
34
|
a = affect.dup # FIXME we have to dup else some items in the array array other duplicated
|
35
35
|
a.each do |atome_to_refresh|
|
36
36
|
grab(atome_to_refresh).apply(id)
|
37
|
-
end
|
37
|
+
end if a
|
38
38
|
params
|
39
39
|
end
|
40
40
|
|
@@ -48,7 +48,7 @@ new({ after: :blue }) do |params|
|
|
48
48
|
a = affect.dup # FIXME we have to dup else some items in the array array other duplicated
|
49
49
|
a.each do |atome_to_refresh|
|
50
50
|
grab(atome_to_refresh).apply(id)
|
51
|
-
end
|
51
|
+
end if a
|
52
52
|
params
|
53
53
|
end
|
54
54
|
new({ particle: :alpha, category: :property, type: :string }) do
|
@@ -60,7 +60,7 @@ new({ after: :alpha }) do |params|
|
|
60
60
|
a = affect.dup # FIXME we have to dup else some items in the array array other duplicated
|
61
61
|
a.each do |atome_to_refresh|
|
62
62
|
grab(atome_to_refresh).apply(id)
|
63
|
-
end
|
63
|
+
end if a
|
64
64
|
params
|
65
65
|
end
|
66
66
|
new({ particle: :diffusion, category: :property, type: :string }) do
|
@@ -2,24 +2,19 @@
|
|
2
2
|
|
3
3
|
# toolbox method here
|
4
4
|
require 'json'
|
5
|
-
|
5
|
+
# def is_descendant(ancestor, descendant)
|
6
|
+
# JS.eval("return isDescendant('#{ancestor}', '#{descendant}')")
|
7
|
+
# end
|
6
8
|
class Atome
|
7
9
|
class << self
|
8
10
|
attr_accessor :initialized
|
9
11
|
|
12
|
+
# def descendant_of?(ancestor)
|
13
|
+
# is_descendant(ancestor, id)
|
14
|
+
# end
|
15
|
+
|
10
16
|
def sanitize_data_for_json(data)
|
11
|
-
data
|
12
|
-
# case data
|
13
|
-
# when String
|
14
|
-
# data.gsub('"', '\\"')
|
15
|
-
# when Hash
|
16
|
-
# data.transform_values { |value| sanitize_data(value) }
|
17
|
-
# when Array
|
18
|
-
# data.map { |value| sanitize_data(value) }
|
19
|
-
# else
|
20
|
-
# data
|
21
|
-
# end
|
22
|
-
data
|
17
|
+
data.gsub('"', '\\"')
|
23
18
|
end
|
24
19
|
|
25
20
|
def send_localstorage_content
|
@@ -117,10 +112,69 @@ class Atome
|
|
117
112
|
|
118
113
|
@initialized = {}
|
119
114
|
|
115
|
+
def recursive(_val)
|
116
|
+
# dummy method
|
117
|
+
end
|
120
118
|
|
121
|
-
|
122
|
-
|
119
|
+
# def sub_block(sub_params, spacing_found = 3)
|
120
|
+
# total_width = 0
|
121
|
+
# sub_params.each_value do |sub_content|
|
122
|
+
# sub_width = sub_content["width"].to_i
|
123
|
+
# total_width += sub_width + spacing_found
|
124
|
+
# end
|
125
|
+
# left_offset = spacing_found
|
126
|
+
# sub_params.each do |(sub_id, sub_content)|
|
127
|
+
# sub_created = box({ id: sub_id, height: '100%'})
|
128
|
+
# sub_created.set(sub_content)
|
129
|
+
# sub_width = sub_created.to_px(:width)
|
130
|
+
# left_offset += sub_width + spacing_found
|
131
|
+
# sub_created.width(sub_width)
|
132
|
+
# sub_created.left(left_offset - sub_width - spacing_found)
|
133
|
+
# sub_created.width(sub_created.to_percent(:width))
|
134
|
+
# sub_created.left(sub_created.to_percent(:left))
|
135
|
+
# end
|
136
|
+
# end
|
137
|
+
|
138
|
+
# def sub_block(sub_params, spacing_found = 3)
|
139
|
+
# num_blocks = sub_params.size
|
140
|
+
# parent_width = to_px(:width) # Supposons que la largeur du parent est en pixels
|
141
|
+
# total_spacing = (num_blocks + 1) * spacing_found
|
142
|
+
# available_width = parent_width - total_spacing
|
143
|
+
# block_width = available_width / num_blocks
|
144
|
+
# left_offset = spacing_found
|
145
|
+
# sub_params.each do |sub_id, sub_content|
|
146
|
+
# alert sub_content[:width]
|
147
|
+
# sub_created = box({ id: sub_id, height: '100%', left: left_offset })
|
148
|
+
# sub_content["width"] = block_width
|
149
|
+
# sub_created.set(sub_content)
|
150
|
+
# sub_created.width(block_width)
|
151
|
+
# left_offset += block_width + spacing_found
|
152
|
+
# sub_created.width(sub_created.to_percent(:width))
|
153
|
+
# sub_created.left(sub_created.to_percent(:left))
|
154
|
+
# end
|
155
|
+
# end
|
156
|
+
|
157
|
+
def sub_block(sub_params, spacing_found = 3)
|
158
|
+
num_blocks = sub_params.size
|
159
|
+
parent_width = to_px(:width) # Supposons que la largeur du parent est en pixels
|
160
|
+
total_ratios = sub_params.values.sum { |sub_content| sub_content[:width] }
|
161
|
+
total_spacing = (num_blocks + 1) * spacing_found
|
162
|
+
available_width = parent_width - total_spacing
|
163
|
+
left_offset = spacing_found
|
164
|
+
sub_params.each do |sub_id, sub_content|
|
165
|
+
ratio = sub_content[:width]
|
166
|
+
block_width = (available_width * ratio) / total_ratios
|
167
|
+
sub_created = box({ id: sub_id, height: '100%', left: left_offset })
|
168
|
+
sub_content["width"] = block_width
|
169
|
+
sub_created.set(sub_content)
|
170
|
+
sub_created.width(block_width)
|
171
|
+
left_offset += block_width + spacing_found
|
172
|
+
sub_created.width(sub_created.to_percent(:width))
|
173
|
+
sub_created.left(sub_created.to_percent(:left))
|
123
174
|
end
|
175
|
+
end
|
176
|
+
|
177
|
+
|
124
178
|
|
125
179
|
def help(particle, &doc)
|
126
180
|
if doc
|
data/lib/atome/version.rb
CHANGED
@@ -1,9 +1,5 @@
|
|
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
|
-
|
7
3
|
size = 33
|
8
4
|
smooth = 3
|
9
5
|
margin = 3
|
@@ -62,17 +58,19 @@ class Atome
|
|
62
58
|
y = event[:clientY]
|
63
59
|
elements = JS.global[:document].elementsFromPoint(x, y)
|
64
60
|
elements.to_a.each do |atome_touched|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
61
|
+
id_found = atome_touched[:id]
|
62
|
+
id_found = id_found.to_s.to_sym # keep .to_s to because ruby wasm try may to_sym on on symbol
|
63
|
+
atome_found = grab(id_found)
|
64
|
+
|
65
|
+
is_descendant_of_intuition = atome_found.descendant_of?(:intuition).to_s if atome_found
|
66
|
+
# # the condition below is use to exclude the treatment any object in the intuition layer
|
67
|
+
unless is_descendant_of_intuition == 'true'
|
68
|
+
|
70
69
|
Universe.active_tools.each do |tool|
|
71
70
|
apply_tool(tool, atome_found, event)
|
72
71
|
end
|
73
|
-
|
74
|
-
break
|
75
72
|
end
|
73
|
+
break
|
76
74
|
end
|
77
75
|
else
|
78
76
|
Universe.allow_tool_operations = true
|
@@ -89,11 +87,42 @@ class Atome
|
|
89
87
|
end
|
90
88
|
|
91
89
|
def start_click_analysis
|
92
|
-
# here we capture any touch when
|
90
|
+
# here we capture any touch when using tool
|
93
91
|
@click_analysis_active = false
|
94
|
-
|
95
|
-
|
92
|
+
|
93
|
+
click_timeout = nil
|
94
|
+
double_click_delay = 150
|
95
|
+
|
96
|
+
JS.global[:document].addEventListener('click') do |native_event|
|
97
|
+
if @click_analysis
|
98
|
+
if click_timeout
|
99
|
+
wait(:kill, click_timeout)
|
100
|
+
click_timeout = nil
|
101
|
+
selected_items = grab(Universe.current_user).selection.collect
|
102
|
+
if selected_items.length > 0
|
103
|
+
dup_selected_items = selected_items.dup
|
104
|
+
dup_selected_items.each do |atome_id_selected|
|
105
|
+
atome_selected = grab(atome_id_selected)
|
106
|
+
atome_selected.selected(false)
|
107
|
+
end
|
108
|
+
else
|
109
|
+
atomes_in_view= grab(:view).fasten
|
110
|
+
atomes_in_view.each do |atome_id_found|
|
111
|
+
grab(atome_id_found).selected(true)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
|
116
|
+
else
|
117
|
+
click_timeout = wait(double_click_delay / 1000.0) do
|
118
|
+
click_timeout = nil
|
119
|
+
Atome.instance_exec(native_event, &@click_analysis) if @click_analysis.is_a?(Proc)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
96
124
|
end
|
125
|
+
|
97
126
|
end
|
98
127
|
|
99
128
|
def alteration(current_tool, tool_actions, atome_touched, a_event)
|
@@ -152,7 +181,6 @@ class Atome
|
|
152
181
|
end
|
153
182
|
|
154
183
|
def apply_tool(tool, atome_touched, a_event)
|
155
|
-
|
156
184
|
current_tool = grab(tool)
|
157
185
|
tool_actions = current_tool.data
|
158
186
|
method_found = tool_actions[:method]
|
@@ -169,10 +197,34 @@ class Atome
|
|
169
197
|
else
|
170
198
|
atome_touched
|
171
199
|
end
|
172
|
-
|
200
|
+
if target && method_found == :alteration && target.tag[:system]
|
201
|
+
# in this case (on target touch )we are targeting a system object non alterable so we create an a new atome
|
202
|
+
# Ex: if we are on a system color we create a new color that can be altered
|
203
|
+
tools_scheme[:particles]&.each do |particle_f, value_f|
|
204
|
+
# if target.type
|
205
|
+
type_to_create = target.type
|
206
|
+
if type_to_create
|
207
|
+
target = atome_touched.send(type_to_create, { particle_f => value_f })
|
208
|
+
tools_scheme[:particles]&.each do |particle_f, value_f|
|
209
|
+
target.send(particle_f, value_f)
|
210
|
+
end
|
211
|
+
end
|
212
|
+
# end
|
173
213
|
|
214
|
+
end
|
215
|
+
else
|
216
|
+
|
217
|
+
# below code trigger when activating the current tool :
|
174
218
|
tools_scheme[:particles]&.each do |particle_f, value_f|
|
175
|
-
|
219
|
+
|
220
|
+
is_descendant_of_intuition = target.descendant_of?(:intuition).to_s
|
221
|
+
atome_descendant_of_intuition = atome_touched.descendant_of?(:intuition).to_s
|
222
|
+
# the condition below is use to exclude the treatment any object in the intuition layer
|
223
|
+
# puts "1 target is : #{target.id}, atome_touched is : #{atome_touched}"
|
224
|
+
unless is_descendant_of_intuition == 'true' || atome_descendant_of_intuition == 'true'
|
225
|
+
# puts "2 target is : #{target.id}, atome_touched is : #{atome_touched}"
|
226
|
+
target.send(particle_f, value_f)
|
227
|
+
end
|
176
228
|
end
|
177
229
|
send(method_found, current_tool, tool_actions, target, a_event)
|
178
230
|
end
|
@@ -365,7 +417,7 @@ class Atome
|
|
365
417
|
tool.instance_variable_set('@tool_open', false)
|
366
418
|
tool_scheme[:particles].each_key do |particle|
|
367
419
|
grab("tool_particle_#{particle}").delete({ force: true })
|
368
|
-
end
|
420
|
+
end if tool_scheme[:particles]
|
369
421
|
tool.width(size)
|
370
422
|
else
|
371
423
|
tool.instance_variable_set('@tool_open', true)
|
@@ -402,7 +454,7 @@ class Atome
|
|
402
454
|
particle_label.top(:auto)
|
403
455
|
particle_label.bottom(0)
|
404
456
|
particle.touch(true) do
|
405
|
-
puts "1 ======> opening !!!#{particle_name}"
|
457
|
+
# puts "1 ======> opening !!!#{particle_name}"
|
406
458
|
tool.instance_variable_set('@prevent_action', true)
|
407
459
|
slider_id = "particle_slider_#{particle_name}"
|
408
460
|
if particle.instance_variable_get('@active')
|
@@ -430,21 +482,22 @@ class Atome
|
|
430
482
|
# Slider actions below:
|
431
483
|
if grab(slider_id).instance_variable_get('@initialised')
|
432
484
|
Atome.selection.each do |atome_id_to_treat|
|
433
|
-
|
434
485
|
tool_scheme[:particles][particle_name] = value.to_f / 100
|
435
486
|
atome_found = grab(atome_id_to_treat)
|
436
487
|
target = grab(atome_found.color.last)
|
437
|
-
|
438
|
-
|
488
|
+
if tool.active
|
489
|
+
target.send(particle_name, value.to_f / 100)
|
490
|
+
end
|
439
491
|
label_value.data(value.to_f / 100)
|
440
492
|
end
|
493
|
+
|
441
494
|
end
|
442
495
|
end
|
443
496
|
|
444
497
|
Atome.selection.each do |atome_id_to_treat|
|
445
498
|
atome_found = grab(atome_id_to_treat)
|
446
|
-
puts 'here slider treat either the target atome types or current atome'
|
447
|
-
puts "need to created a list instead of choosing the last atome found of it's kind"
|
499
|
+
# puts 'here slider treat either the target atome types or current atome'
|
500
|
+
# puts "need to created a list instead of choosing the last atome found of it's kind"
|
448
501
|
target = if tool_scheme[:target]
|
449
502
|
grab(atome_found.send(tool_scheme[:target]).last)
|
450
503
|
else
|
@@ -465,6 +518,27 @@ class Atome
|
|
465
518
|
tool.touch(:down) do
|
466
519
|
tool.depth(999)
|
467
520
|
end
|
521
|
+
tool.touch(:double) do
|
522
|
+
tool_to_deactivate = Universe.active_tools.dup
|
523
|
+
tool_to_deactivate.each do |atome_id_found|
|
524
|
+
|
525
|
+
atome_found = grab(atome_id_found)
|
526
|
+
puts "deactivate #{atome_id_found}"
|
527
|
+
atome_found.deactivate_tool
|
528
|
+
# if atome_found.activated
|
529
|
+
# # atome_found.deactivate_tool
|
530
|
+
# end
|
531
|
+
# puts "#{atome_found}, #{atome_found.class}"
|
532
|
+
end
|
533
|
+
# Universe.tools.each do |tool_id_found, _tool_content|
|
534
|
+
# # tool_found=grab(tool_id_found)
|
535
|
+
# puts tool_id_found
|
536
|
+
# # if tool_found.activated
|
537
|
+
# # tool.deactivate_tool
|
538
|
+
# # end
|
539
|
+
# end
|
540
|
+
tool.activate_tool
|
541
|
+
end
|
468
542
|
tool.touch(true) do
|
469
543
|
unless tool.instance_variable_get('@prevent_action')
|
470
544
|
# we add all specific tool actions to @tools_actions_to_exec hash
|
@@ -482,4 +556,4 @@ class Atome
|
|
482
556
|
end
|
483
557
|
end
|
484
558
|
|
485
|
-
end
|
559
|
+
end
|
@@ -505,7 +505,6 @@ new(molecule: :application) do |params, &bloc|
|
|
505
505
|
|
506
506
|
menu = buttons({
|
507
507
|
id: "#{id_f}_menu",
|
508
|
-
# left: 66,
|
509
508
|
depth: 9999,
|
510
509
|
attach: id_f,
|
511
510
|
inactive: { text: { color: :gray }, width: 66, height: 12, spacing: 3, disposition: :horizontal,
|
@@ -601,23 +600,14 @@ new(molecule: :show) do |page_id, &bloc|
|
|
601
600
|
# now looking for associated blocks
|
602
601
|
blocks_found = params[:blocks]
|
603
602
|
@prev_bloc_height = 0
|
604
|
-
blocks_found&.each do |bloc_id, bloc_content|
|
605
603
|
|
604
|
+
blocks_found&.each do |bloc_id, bloc_content|
|
606
605
|
new_bloc = new_page.box({ id: bloc_id, role: :block, width: '100%', height: 99, top: spacing + @prev_bloc_height, bottom: 0, left: 0, right: 0, spacing: spacing })
|
607
|
-
|
608
606
|
new_bloc.define_singleton_method(:subs) do |sub_params|
|
609
|
-
@prev_sub_width = 0
|
610
|
-
sub_params.each do |sub_id, sub_content|
|
611
|
-
sub_created = new_bloc.box({ id: sub_id, height: '100%', left: @prev_sub_width })
|
612
|
-
sub_created.set(sub_content)
|
613
|
-
@prev_sub_width = @prev_sub_width + sub_created.to_px(:width) + spacing
|
614
|
-
sub_created.width(sub_created.to_percent(:width))
|
615
|
-
sub_created.left(sub_created.to_percent(:left))
|
616
|
-
end
|
617
607
|
|
608
|
+
new_bloc.sub_block(sub_params, 3)
|
618
609
|
end
|
619
610
|
new_bloc.set(bloc_content)
|
620
|
-
|
621
611
|
@prev_bloc_height = @prev_bloc_height + new_bloc.height + spacing
|
622
612
|
end
|
623
613
|
|
@@ -716,5 +706,4 @@ new(molecule: :buttons) do |params, &bloc|
|
|
716
706
|
main.create_new_button(item_id, index, label, code)
|
717
707
|
end
|
718
708
|
main
|
719
|
-
|
720
709
|
end
|
data/lib/renderers/html/html.rb
CHANGED
@@ -4,6 +4,8 @@
|
|
4
4
|
|
5
5
|
class HTML
|
6
6
|
|
7
|
+
|
8
|
+
|
7
9
|
def self.locate(selector, base_element = JS.global[:document][:body])
|
8
10
|
return base_element if selector.empty?
|
9
11
|
|
@@ -22,6 +24,10 @@ class HTML
|
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
27
|
+
def self.is_descendant(ancestor, descendant)
|
28
|
+
JS.eval("return isDescendant('#{ancestor}', '#{descendant}')")
|
29
|
+
end
|
30
|
+
|
25
31
|
def initialize(id_found, current_atome)
|
26
32
|
|
27
33
|
@element = JS.global[:document].getElementById(id_found.to_s)
|
@@ -35,6 +41,8 @@ class HTML
|
|
35
41
|
@element
|
36
42
|
end
|
37
43
|
|
44
|
+
|
45
|
+
|
38
46
|
def hypertext(params)
|
39
47
|
current_div = JS.global[:document].getElementById(@id.to_s)
|
40
48
|
current_div[:innerHTML] = params
|
@@ -56,7 +56,7 @@ puts " menus_found => #{menus_found}"
|
|
56
56
|
|
57
57
|
bloc_to_add= {height: 156, color: :green}
|
58
58
|
bloc_to_add2= {height: 99, color: :blue}
|
59
|
-
bloc_to_add3= {height: 333, color: :orange, subs:{contact: {width:
|
59
|
+
bloc_to_add3= {height: 333, color: :orange, subs:{contact: {width: 1, color: :black}, project: {width: 1}, calendar: {width: 0.5, color: :green}}}
|
60
60
|
a.insert({page3: {block1: bloc_to_add , block2: bloc_to_add2, block3: bloc_to_add3}})
|
61
61
|
|
62
62
|
|
@@ -1,56 +1,56 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
#
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
#
|
15
|
-
#
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
image({ path: "./medias/images/logos/vie.svg", left: :auto, right: 3, top: 0 , size: 30})
|
3
|
+
t = text({ data: 'touch me to select all', id: :the_text })
|
4
|
+
b = box({ left: 12, id: :the_box })
|
5
|
+
c = circle({ left: 230, id: :the_circle, color: { blue: 1, id: :c1 } })
|
6
|
+
c.color({ green: 1, id: :c2 })
|
7
|
+
# to change default selection style
|
8
|
+
Universe.default_selection_style = { border: { thickness: 3, red: 1, green: 0, blue: 1, alpha: 1, pattern: :dotted } }
|
9
|
+
|
10
|
+
c.touch(true) do
|
11
|
+
if c.selected
|
12
|
+
c.selected(false)
|
13
|
+
else
|
14
|
+
# c.selected(true)
|
15
|
+
# example of custom selection style
|
16
|
+
c.selected({ shadow: { id: :titi,
|
17
|
+
left: 9, top: 3, blur: 9,
|
18
|
+
invert: false,
|
19
|
+
red: 0, green: 0, blue: 0, alpha: 1
|
20
|
+
}, border: { id: :toto, thickness: 5, red: 1, green: 1, blue: 1, alpha: 1,
|
21
|
+
pattern: :dotted, inside: true }
|
22
|
+
})
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
image({ path: 'medias/images/red_planet.png', id: :the__red_planet, top: 233 })
|
27
|
+
|
28
|
+
t.touch(true) do
|
29
|
+
puts "1 current_user - #{grab(Universe.current_user).selection}"
|
30
|
+
puts "1 - b selected : #{b.selected}"
|
31
|
+
grab(:view).fasten.each do |atome_found|
|
32
|
+
grab(atome_found).selected(true)
|
33
|
+
end
|
34
|
+
puts "2 - current_user : #{grab(Universe.current_user).selection}"
|
35
|
+
puts "2 - b selected : #{b.selected}"
|
36
|
+
selected_items = grab(Universe.current_user).selection # we create a group
|
37
|
+
|
38
|
+
selected_items.each do |atome_id_selected|
|
39
|
+
atome_selected = grab(atome_id_selected)
|
40
|
+
atome_selected.width = rand(333)
|
41
|
+
atome_selected.height = rand(333)
|
42
|
+
|
43
|
+
end
|
44
|
+
b.selected(false)
|
45
|
+
puts "3 current_user- #{grab(Universe.current_user).selection}"
|
46
|
+
puts "3 - b selected : #{b.selected}"
|
47
|
+
|
48
|
+
grab(Universe.current_user).selection.color(:red)
|
49
|
+
grab(Universe.current_user).selection.each do |el|
|
50
|
+
puts el
|
51
|
+
end
|
52
|
+
puts grab(Universe.current_user).selection.collect
|
53
|
+
end
|
54
|
+
|
55
|
+
# image({ path: "./medias/images/logos/vie.svg", left: :auto, right: 3, top: 0 , size: 30})
|
56
56
|
|
@@ -1,6 +1,36 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
|
4
|
+
# new({ tool: :color2 }) do
|
5
|
+
# active_code = lambda {
|
6
|
+
# puts 'color activated1'
|
7
|
+
# }
|
8
|
+
# color_code2=lambda {
|
9
|
+
# puts "object id is : #{id}"
|
10
|
+
# # color(:green)
|
11
|
+
# }
|
12
|
+
# inactive_code = lambda { |data|
|
13
|
+
# data[:treated].each do |atome_f|
|
14
|
+
# # atome_f.drag(false)
|
15
|
+
# # atome_f.color(:green)
|
16
|
+
# end
|
17
|
+
# }
|
18
|
+
#
|
19
|
+
# { activation: active_code,
|
20
|
+
# alteration: { event: color_code2 },
|
21
|
+
# inactivation: inactive_code,
|
22
|
+
# target: :color,
|
23
|
+
# particles: { red: 0, green: 0.5, blue: 1, alpha: 1 }
|
24
|
+
# }
|
25
|
+
# end
|
26
|
+
|
27
|
+
new({ tool: :toolbox1 }) do
|
28
|
+
active_code = lambda {
|
29
|
+
toolbox({ tools: [:combined], toolbox: { orientation: :ew, left: 90, bottom: 9, spacing: 9 } })
|
30
|
+
}
|
31
|
+
{ activation: active_code }
|
32
|
+
end
|
33
|
+
|
4
34
|
|
5
35
|
new({ tool: :combined }) do |params|
|
6
36
|
|
@@ -9,7 +39,7 @@ new({ tool: :combined }) do |params|
|
|
9
39
|
}
|
10
40
|
|
11
41
|
inactive_code = lambda { |param|
|
12
|
-
puts :
|
42
|
+
puts :alteration_tool_code_inactivated1
|
13
43
|
}
|
14
44
|
pre_code = lambda { |params|
|
15
45
|
puts "pre_creation_code,atome_touched: #{:params}"
|
@@ -36,7 +66,45 @@ new({ tool: :combined }) do |params|
|
|
36
66
|
post: post_code,
|
37
67
|
zone: zone_spe,
|
38
68
|
icon: :color,
|
39
|
-
int8: { french: :couleur, english: :
|
69
|
+
int8: { french: :couleur, english: :combined, german: :colorad } }
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
new({ tool: :rotate }) do |params|
|
74
|
+
|
75
|
+
active_code = lambda {
|
76
|
+
puts :alteration_tool_code_activated
|
77
|
+
}
|
78
|
+
|
79
|
+
inactive_code = lambda { |param|
|
80
|
+
puts :alteration_tool_code_inactivated2
|
81
|
+
}
|
82
|
+
pre_code = lambda { |params|
|
83
|
+
puts "pre_creation_code,atome_touched: #{:params}"
|
84
|
+
|
85
|
+
}
|
86
|
+
post_code = lambda { |params|
|
87
|
+
puts "post_creation_code,atome_touched: #{:params}"
|
88
|
+
|
89
|
+
}
|
90
|
+
|
91
|
+
zone_spe = lambda { |current_tool|
|
92
|
+
# puts "current tool is : #{:current_tool} now creating specific zone"
|
93
|
+
# b = box({ width: 33, height: 12 })
|
94
|
+
# b.text({ data: :all })
|
95
|
+
|
96
|
+
}
|
97
|
+
|
98
|
+
{
|
99
|
+
activation: active_code,
|
100
|
+
inactivation: inactive_code,
|
101
|
+
# alteration: { width: 22, blur: 3 },
|
102
|
+
alteration: { rotate: 22 },
|
103
|
+
pre: pre_code,
|
104
|
+
post: post_code,
|
105
|
+
zone: zone_spe,
|
106
|
+
icon: :color,
|
107
|
+
int8: { french: :couleur, english: :rotate, german: :colorad } }
|
40
108
|
|
41
109
|
end
|
42
110
|
|
@@ -180,13 +248,6 @@ new({ tool: :select }) do
|
|
180
248
|
|
181
249
|
end
|
182
250
|
|
183
|
-
new({ tool: :toolbox1 }) do
|
184
|
-
active_code = lambda {
|
185
|
-
toolbox({ tools: [:combined], toolbox: { orientation: :ew, left: 90, bottom: 9, spacing: 9 } })
|
186
|
-
}
|
187
|
-
{ activation: active_code }
|
188
|
-
end
|
189
|
-
|
190
251
|
new({ tool: :color }) do
|
191
252
|
active_code = lambda {
|
192
253
|
puts 'color activated1'
|
@@ -228,16 +289,20 @@ new({ tool: :crash_test }) do
|
|
228
289
|
end
|
229
290
|
|
230
291
|
# Universe.tools_root= {tools: [:blur, :box, :test, :toolbox1],toolbox: { orientation: :ew, left:90 , bottom: 9, spacing: 9} }
|
231
|
-
Universe.tools_root = {id: :root_tools, tools: [:select,:crash_test, :box, :drag, :touch,:color, :move, :toolbox1], toolbox: { orientation: :ew, left: 9, bottom: 9, spacing: 9 } }
|
292
|
+
Universe.tools_root = {id: :root_tools, tools: [:select,:crash_test, :box, :drag, :touch,:color, :move, :toolbox1, :rotate], toolbox: { orientation: :ew, left: 9, bottom: 9, spacing: 9 } }
|
232
293
|
puts "above we added an id because each tool may be in many toolbox and have an uniq ID"
|
233
294
|
Atome.init_intuition
|
234
295
|
|
235
|
-
b = box({ id: :
|
296
|
+
b = box({ id: :the_test_box, selected: false, color: :blue })
|
236
297
|
c=circle({ left: 90, id: :the_test_circle, selected: false })
|
237
298
|
c.drag(true) do
|
238
299
|
puts "moving"
|
239
300
|
end
|
301
|
+
|
302
|
+
|
240
303
|
b.touch(true) do
|
304
|
+
# alert b.descendant_of?(:view)
|
305
|
+
# alert "#{b.descendant_of?(:intuition)}, then dont treat!"
|
241
306
|
if b.width == 170
|
242
307
|
b.width(55)
|
243
308
|
else
|
@@ -245,4 +310,15 @@ b.touch(true) do
|
|
245
310
|
end
|
246
311
|
|
247
312
|
end
|
248
|
-
|
313
|
+
text({left: 333, data: :hello})
|
314
|
+
circle({left: 333,top: 333})
|
315
|
+
|
316
|
+
# wait 2 do
|
317
|
+
# b= grab('color_tool_icon')
|
318
|
+
# grab('color_tool_icon').color(:red)
|
319
|
+
#
|
320
|
+
# puts b.descendant_of?(:view)
|
321
|
+
# puts "#{b.descendant_of?(:intuition)}, then dont treat!"
|
322
|
+
#
|
323
|
+
# end
|
324
|
+
puts 'add tool preview , and maybe allow tool details to be moved'
|
@@ -504,3 +504,21 @@ function record_content(blob) {
|
|
504
504
|
}
|
505
505
|
|
506
506
|
|
507
|
+
function isDescendant(parentId, childId) {
|
508
|
+
var parent = document.getElementById(parentId);
|
509
|
+
var child = document.getElementById(childId);
|
510
|
+
|
511
|
+
let node = child;
|
512
|
+
while (node !== null) {
|
513
|
+
if (node === parent) {
|
514
|
+
return true;
|
515
|
+
}
|
516
|
+
node = node.parentNode;
|
517
|
+
}
|
518
|
+
return false;
|
519
|
+
|
520
|
+
}
|
521
|
+
|
522
|
+
// alert(isDescendant('intuition', 'the_test_box'));
|
523
|
+
// alert(isDescendant('view', 'the_test_box'));
|
524
|
+
|
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.4.
|
4
|
+
version: 0.5.7.4.6
|
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-06-
|
11
|
+
date: 2024-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eventmachine
|
@@ -656,6 +656,7 @@ files:
|
|
656
656
|
- vendor/assets/application/examples/text.rb
|
657
657
|
- vendor/assets/application/examples/text_align.rb
|
658
658
|
- vendor/assets/application/examples/tick.rb
|
659
|
+
- vendor/assets/application/examples/to_percent.rb
|
659
660
|
- vendor/assets/application/examples/to_px.rb
|
660
661
|
- vendor/assets/application/examples/tools.rb
|
661
662
|
- vendor/assets/application/examples/touch.rb
|