atome 0.5.7.1.7 → 0.5.7.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/atome +27 -5
- data/lib/atome/genesis/particles/utility.rb +35 -9
- data/lib/atome/kernel/universe.rb +1 -1
- data/lib/atome/version.rb +1 -1
- data/lib/molecules/intuition/tools.rb +130 -138
- data/lib/renderers/html/html.rb +55 -67
- data/vendor/assets/application/examples/test.rb +73 -19
- data/vendor/assets/server/eDen.rb +19 -0
- metadata +3 -3
- /data/vendor/assets/application/examples/{scroll.rb → overflow.rb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63cd85893b4535b12f8f24da43d2d615234820584a74ae4e4f67c2c1da28068d
|
4
|
+
data.tar.gz: 8c0e70603aee556e09abb0867d0084ccea315d54334ddc6328bf54e8da254a59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f6d187398d27418a21ad283dc4184b0c047635665133fbd05790d49c2592d9213898a6396dfe943a38b68ccda327d205e08d168ef92d7212243a7e1e4b003a2
|
7
|
+
data.tar.gz: 686e3049efeef466841eb3979202d4be3ac753123e419d71a8fb3565159aad2e58ce66e9e28a1de6328243aed298a7480c0ce3504cbc1d00aa3ba80238a0ca5d
|
data/exe/atome
CHANGED
@@ -577,10 +577,32 @@ if ARGV.include?('update')
|
|
577
577
|
|
578
578
|
gem_name = 'atome'
|
579
579
|
local_gem_spec = Gem::Specification.find_by_name(gem_name) rescue nil
|
580
|
-
if local_gem_spec.nil?
|
581
|
-
|
580
|
+
# if local_gem_spec.nil?
|
581
|
+
# puts :case1
|
582
|
+
# puts " #{gem_name} gem is not install will install from distant server"
|
583
|
+
# system("gem update #{gem_name}")
|
584
|
+
# else
|
585
|
+
# puts :case2
|
586
|
+
#
|
587
|
+
# available_versions = Gem::Specification.find_all_by_name(gem_name).map(&:version)
|
588
|
+
#
|
589
|
+
# latest_version = available_versions.max
|
590
|
+
#
|
591
|
+
# if latest_version > local_gem_spec.version
|
592
|
+
# puts "update availlable: #{local_gem_spec.version} -> #{latest_version}"
|
593
|
+
# system("gem update #{gem_name}")
|
594
|
+
# else
|
595
|
+
# puts "No update necessary '#{gem_name}'. current version : #{local_gem_spec.version}"
|
596
|
+
# end
|
597
|
+
# end
|
598
|
+
#########
|
599
|
+
# if local_gem_spec.nil?
|
600
|
+
# puts :case1
|
601
|
+
# puts " #{gem_name} gem is not install will install from distant server"
|
582
602
|
system("gem update #{gem_name}")
|
583
|
-
else
|
603
|
+
# else
|
604
|
+
# puts :case2
|
605
|
+
|
584
606
|
available_versions = Gem::Specification.find_all_by_name(gem_name).map(&:version)
|
585
607
|
|
586
608
|
latest_version = available_versions.max
|
@@ -591,9 +613,9 @@ if ARGV.include?('update')
|
|
591
613
|
else
|
592
614
|
puts "No update necessary '#{gem_name}'. current version : #{local_gem_spec.version}"
|
593
615
|
end
|
594
|
-
end
|
595
|
-
|
616
|
+
# end
|
596
617
|
|
618
|
+
########
|
597
619
|
# TODO: also update index.html and all other files except the application folder
|
598
620
|
# we check we are in atome app
|
599
621
|
if Dir.exist?("#{destination}/application") && !Dir.exist?("#{destination}/vendor")
|
@@ -8,8 +8,8 @@ new({ particle: :run, category: :utility, type: :boolean }) do |params|
|
|
8
8
|
end
|
9
9
|
# new({ particle: :broadcast })
|
10
10
|
|
11
|
-
def delete_recursive(atome_id)
|
12
|
-
return if grab(atome_id).tag && (grab(atome_id).tag[:persistent] || grab(atome_id).tag[:system])
|
11
|
+
def delete_recursive(atome_id, force=false)
|
12
|
+
return if grab(atome_id).tag && (grab(atome_id).tag[:persistent] || grab(atome_id).tag[:system]) unless force
|
13
13
|
|
14
14
|
parent_id_found = grab(atome_id).attach
|
15
15
|
parent_found = grab(parent_id_found)
|
@@ -17,11 +17,11 @@ def delete_recursive(atome_id)
|
|
17
17
|
new_array.delete(atome_id)
|
18
18
|
parent_found.instance_variable_set('@attached', new_array)
|
19
19
|
grab(atome_id).attached.each do |atome_id_found|
|
20
|
-
delete_recursive(atome_id_found)
|
20
|
+
delete_recursive(atome_id_found, force)
|
21
21
|
end
|
22
22
|
grab(atome_id).render(:delete, { :recursive => true })
|
23
23
|
grab(atome_id).touch(:remove)
|
24
|
-
Universe.delete(atome_id)
|
24
|
+
Universe.delete(grab(atome_id).aid)
|
25
25
|
end
|
26
26
|
|
27
27
|
new({ particle: :delete, category: :utility, type: :boolean, render: false }) do |params|
|
@@ -48,6 +48,24 @@ new({ particle: :delete, category: :utility, type: :boolean, render: false }) do
|
|
48
48
|
end
|
49
49
|
Universe.delete(@aid)
|
50
50
|
end
|
51
|
+
# elsif params == :force
|
52
|
+
# cells.delete(true)
|
53
|
+
# group.delete(true)
|
54
|
+
# # now we detach the atome from it's parent
|
55
|
+
# # now we init rendering
|
56
|
+
# render(:delete, params)
|
57
|
+
# # the machine delete the current atome from the universe
|
58
|
+
# id_found = @id.to_sym
|
59
|
+
# if @attach
|
60
|
+
# parent_found = grab(@attach)
|
61
|
+
# parent_found.attached.delete(id_found)
|
62
|
+
# end
|
63
|
+
# @affect&.each do |affected_atome|
|
64
|
+
# affected_found = grab(affected_atome)
|
65
|
+
# affected_found.apply.delete(id_found)
|
66
|
+
# affected_found.refresh
|
67
|
+
# end
|
68
|
+
# Universe.delete(@aid)
|
51
69
|
elsif params.instance_of? Hash
|
52
70
|
# if we are on a matrix we delete cells found & group found
|
53
71
|
cells.delete(true)
|
@@ -57,14 +75,22 @@ new({ particle: :delete, category: :utility, type: :boolean, render: false }) do
|
|
57
75
|
attached.each do |atttached_atomes|
|
58
76
|
delete_recursive(atttached_atomes)
|
59
77
|
end
|
60
|
-
# group.each do |el|
|
61
|
-
# delete_recursive(el)
|
62
|
-
# end
|
63
|
-
|
64
78
|
touch(:remove)
|
65
79
|
render(:delete, params)
|
66
|
-
Universe.delete(@
|
80
|
+
Universe.delete(@aid)
|
81
|
+
end
|
82
|
+
elsif params[:force]
|
83
|
+
attached.each do |atttached_atomes|
|
84
|
+
# alert "attached : #{attached}"
|
85
|
+
delete_recursive(atttached_atomes, true)
|
67
86
|
end
|
87
|
+
touch(:remove)
|
88
|
+
render(:delete, params)
|
89
|
+
# alert "Universe : #{Universe.atomes[@aid]}"
|
90
|
+
# alert "length = #{Universe.atomes.length}"
|
91
|
+
Universe.delete(@aid)
|
92
|
+
# alert "Universe : #{Universe.atomes.length}"
|
93
|
+
|
68
94
|
else
|
69
95
|
# the machine try to find the sub particle id and remove it eg a.delete(monitor: :my_monitor) remove the monitor
|
70
96
|
# with id my_monitor
|
@@ -280,7 +280,7 @@ class Universe
|
|
280
280
|
if @allow_localstorage.include? element
|
281
281
|
JS.global[:localStorage].setItem(operation_timing, "{ #{id} => { #{operation} => { #{element} => #{params} } }, sync: false }")
|
282
282
|
@history[@history.length] = { operation_timing => { id => { operation => { element => params } }, sync: false, time: Time.now } }
|
283
|
-
puts "===> { #{id} => { #{operation} => { #{element} => #{params} } }, sync: false }"
|
283
|
+
# puts "===> { #{id} => { #{operation} => { #{element} => #{params} } }, sync: false }"
|
284
284
|
end
|
285
285
|
|
286
286
|
|
data/lib/atome/version.rb
CHANGED
@@ -8,9 +8,8 @@ shadow({
|
|
8
8
|
invert: false,
|
9
9
|
red: 0, green: 0, blue: 0, alpha: 0.6
|
10
10
|
})
|
11
|
-
|
12
|
-
color({ id: :
|
13
|
-
color({ id: :tool_active_color, red: 1, green: 1, blue: 1, alpha: 0.3 })
|
11
|
+
color({ id: :active_tool_col, alpha: 1, red: 1, green: 1, blue: 1 })
|
12
|
+
color({ id: :inactive_tool_col, alpha: 0.1 })
|
14
13
|
border({ id: :tool_box_border, thickness: 1, red: 1, green: 1, blue: 1, alpha: 0.06, pattern: :solid, inside: true })
|
15
14
|
# Tool's style object container below
|
16
15
|
element({ aid: :toolbox_style, id: :toolbox_style, data: {
|
@@ -20,13 +19,21 @@ element({ aid: :toolbox_style, id: :toolbox_style, data: {
|
|
20
19
|
} })
|
21
20
|
|
22
21
|
class Atome
|
22
|
+
def toolbox(tool_list)
|
23
|
+
@toolbox = tool_list[:tools]
|
24
|
+
tool_list[:tools].each_with_index do |root_tool, index|
|
25
|
+
tools_scheme = Universe.tools[root_tool]
|
26
|
+
build_tool({ name: root_tool, scheme: tools_scheme, index: index, toolbox: tool_list[:toolbox] })
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
23
30
|
class << self
|
24
31
|
def init_intuition
|
25
32
|
Atome.start_click_analysis
|
26
33
|
toolbox_root = Universe.tools_root
|
27
34
|
toolbox_root[:tools].each_with_index do |root_tool, index|
|
28
35
|
tools_scheme = Universe.tools[root_tool]
|
29
|
-
A.build_tool({ name: root_tool, scheme: tools_scheme, index: index
|
36
|
+
A.build_tool({ name: root_tool, scheme: tools_scheme, index: index, toolbox: toolbox_root[:toolbox] })
|
30
37
|
end
|
31
38
|
end
|
32
39
|
|
@@ -35,7 +42,6 @@ class Atome
|
|
35
42
|
end
|
36
43
|
|
37
44
|
def activate_click_analysis
|
38
|
-
|
39
45
|
# the condition below avoid touchdown analysis accumulation
|
40
46
|
unless @click_analysis_active
|
41
47
|
# this method analyse all object under the touchdown to find the first user objet and return it's id
|
@@ -50,8 +56,6 @@ class Atome
|
|
50
56
|
id_found = atome_touched[:id].to_s
|
51
57
|
atome_found = grab(id_found)
|
52
58
|
unless atome_found && atome_found.tag[:system]
|
53
|
-
|
54
|
-
# if atome_found
|
55
59
|
Universe.active_tools.each do |tool|
|
56
60
|
apply_tool(tool, atome_found, event)
|
57
61
|
end
|
@@ -83,24 +87,18 @@ class Atome
|
|
83
87
|
if atome_touched
|
84
88
|
storage_allowed = Universe.allow_localstorage
|
85
89
|
action_found = tool_actions[:action]
|
86
|
-
pre = tool_actions[:pre]
|
87
90
|
post = tool_actions[:post]
|
88
91
|
params = { current_tool: current_tool, atome_touched: atome_touched, event: a_event }
|
89
92
|
action_found.each do |part, val|
|
90
93
|
Universe.allow_localstorage = false
|
91
|
-
#################################
|
92
|
-
touch_found = atome_touched.touch
|
93
|
-
touch_procs = atome_touched.instance_variable_get("@touch_code")
|
94
|
-
resize_found = atome_touched.resize
|
95
|
-
resize_procs = atome_touched.instance_variable_get("@resize_code")
|
96
|
-
current_tool.data[:prev_states][atome_touched] = { events: { touch: touch_found, resize: resize_found },
|
97
|
-
procs: { touch_code: touch_procs, resize_code: resize_procs } }
|
98
|
-
#################################
|
99
|
-
current_tool.instance_exec(params, &pre) if pre.is_a? Proc
|
100
94
|
Universe.allow_localstorage = storage_allowed
|
101
95
|
if current_tool.data[:allow_alteration]
|
102
|
-
|
103
|
-
|
96
|
+
if val.instance_of?(Proc)
|
97
|
+
atome_touched.instance_exec(&val)
|
98
|
+
else
|
99
|
+
atome_touched.send(part, val)
|
100
|
+
end
|
101
|
+
current_tool.data[:treated] << atome_touched if current_tool.data[:treated]
|
104
102
|
end
|
105
103
|
current_tool.instance_exec(params, &post) if post.is_a? Proc
|
106
104
|
end
|
@@ -124,11 +122,11 @@ class Atome
|
|
124
122
|
temp_val = particle.merge({ resize: true, drag: true, top: a_event[:pageY].to_i, left: a_event[:pageX].to_i })
|
125
123
|
if current_tool.data[:allow_creation]
|
126
124
|
# uncomment the line below if you want to attach to current atome
|
127
|
-
if atome_touched
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
125
|
+
new_atome = if atome_touched
|
126
|
+
atome_touched.send(atome, temp_val)
|
127
|
+
else
|
128
|
+
grab(:view).send(atome, temp_val)
|
129
|
+
end
|
132
130
|
# current_tool.data[:treated] << new_atome
|
133
131
|
current_tool.data[:created] << new_atome
|
134
132
|
params.delete(:atome_touched)
|
@@ -152,7 +150,9 @@ class Atome
|
|
152
150
|
tool_actions[:action] = { noop: true }
|
153
151
|
current_tool.data = tool_actions
|
154
152
|
end
|
155
|
-
|
153
|
+
# tool_actions.delete(:inactivation)
|
154
|
+
# alert "==> #{tool_actions[:inactivation]}"
|
155
|
+
# puts "==> #{method_found},\n==> #{current_tool.id} ,\nactions ==> #{tool_actions},\n==> #{atome_touched},\n==> #{a_event}"
|
156
156
|
send(method_found, current_tool, tool_actions, atome_touched, a_event)
|
157
157
|
end
|
158
158
|
|
@@ -164,13 +164,100 @@ class Atome
|
|
164
164
|
|
165
165
|
def set_action_on_touch(&action)
|
166
166
|
@touch_action = action
|
167
|
-
|
168
167
|
end
|
169
168
|
|
170
169
|
def remove_get_atome_on_touch
|
171
170
|
@touch_action = nil
|
172
171
|
end
|
173
172
|
|
173
|
+
def activate_tool
|
174
|
+
tool_name = id
|
175
|
+
tool_scheme = @tool_scheme
|
176
|
+
tool = self
|
177
|
+
|
178
|
+
alterations = tool_scheme[:alteration] ? tool_scheme[:alteration].keys : []
|
179
|
+
creations = tool_scheme[:creation] ? tool_scheme[:creation].keys : []
|
180
|
+
prev_auth = Universe.allow_localstorage ||= []
|
181
|
+
events_allow = [:top, :left, :right, :bottom, :width, :height]
|
182
|
+
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
|
+
|
185
|
+
Universe.allow_localstorage = storage_allowed
|
186
|
+
# we set edit mode to true (this allow to prevent user atome to respond from click)
|
187
|
+
|
188
|
+
Universe.edit_mode = true
|
189
|
+
# init the tool
|
190
|
+
tool.data[:treated] = []
|
191
|
+
tool.data[:created] = []
|
192
|
+
tool.data[:prev_states] = {}
|
193
|
+
# generic behavior
|
194
|
+
tool.apply(:active_tool_col)
|
195
|
+
Universe.active_tools << tool_name
|
196
|
+
# activation code
|
197
|
+
activation_code = tool_scheme[:activation]
|
198
|
+
tool.instance_exec(&activation_code) if activation_code.is_a? Proc
|
199
|
+
# below we the particles of selected atomes to feed tools values
|
200
|
+
# possibility 1 (pipette like):
|
201
|
+
# now we get the values from selected atomes
|
202
|
+
Atome.selection.each do |atome_id_to_treat|
|
203
|
+
tool.data[:action]&.each_key do |particle_req|
|
204
|
+
unless Universe.atome_preset
|
205
|
+
value_found = grab(atome_id_to_treat).send(particle_req)
|
206
|
+
if value_found
|
207
|
+
tool.data[:action][particle_req] = value_found
|
208
|
+
else
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
213
|
+
# possibility 2 (immediate apply):
|
214
|
+
allow_creation = tool.data[:allow_creation]
|
215
|
+
allow_alteration = tool.data[:allow_alteration]
|
216
|
+
unless tool_name.to_sym == :select_tool || !allow_creation || !allow_alteration
|
217
|
+
Atome.selection.each do |atome_id_to_treat|
|
218
|
+
atome_found = grab(atome_id_to_treat)
|
219
|
+
event = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 }
|
220
|
+
Atome.apply_tool(tool_name, atome_found, event)
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
# # activate tool analysis test
|
225
|
+
Atome.activate_click_analysis
|
226
|
+
tool.active(true)
|
227
|
+
end
|
228
|
+
|
229
|
+
def deactivate_tool
|
230
|
+
tool_name = id
|
231
|
+
tool_scheme = @tool_scheme
|
232
|
+
tool = self
|
233
|
+
tool.active(false)
|
234
|
+
tool.instance_variable_get("@toolbox")&.each do |sub_tool_id|
|
235
|
+
toolbox_tool = grab("#{sub_tool_id}_tool")
|
236
|
+
toolbox_tool.deactivate_tool
|
237
|
+
# we delete the attached toolbox if it exist
|
238
|
+
toolbox_tool.delete({ force: true })
|
239
|
+
end
|
240
|
+
|
241
|
+
# when closing delete tools action from tool_actions_to_exec
|
242
|
+
Universe.active_tools.delete(tool_name)
|
243
|
+
# we check if all tools are inactive if so we set edit_mode to false
|
244
|
+
if Universe.active_tools.length == 0
|
245
|
+
Atome.de_activate_click_analysis
|
246
|
+
Universe.edit_mode = false
|
247
|
+
Universe.allow_localstorage = false
|
248
|
+
end
|
249
|
+
|
250
|
+
inactivation_code = tool_scheme[:inactivation]
|
251
|
+
tool.instance_exec(tool.data, &inactivation_code) if inactivation_code.is_a? Proc
|
252
|
+
# generic behavior
|
253
|
+
# we remove touch and resize binding on newly created atomes
|
254
|
+
tool.apply(:inactive_tool_col)
|
255
|
+
tool.data[:created]&.each do |new_atome|
|
256
|
+
new_atome.drag(false)
|
257
|
+
new_atome.resize(:remove)
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
174
261
|
def build_tool(params)
|
175
262
|
# here is the main entry for tool creation
|
176
263
|
language ||= grab(:view).language
|
@@ -179,10 +266,10 @@ class Atome
|
|
179
266
|
tool_name = "#{params[:name]}_tool"
|
180
267
|
index = params[:index]
|
181
268
|
tool_scheme = params[:scheme]
|
182
|
-
|
269
|
+
# @tool_scheme=params[:scheme]
|
270
|
+
toolbox = params[:toolbox] || {}
|
183
271
|
orientation_wanted = tool_scheme[:orientation] || :sn
|
184
|
-
|
185
|
-
color({ id: :inactive_tool_col, alpha: 0.6 })
|
272
|
+
|
186
273
|
grab(:intuition).storage[:tool_open] ||= []
|
187
274
|
grab(:intuition).storage[:tool_open] << tool_name
|
188
275
|
size = grab(:toolbox_style).data[:size]
|
@@ -190,9 +277,9 @@ class Atome
|
|
190
277
|
case orientation_wanted
|
191
278
|
when :sn
|
192
279
|
top = :auto
|
193
|
-
bottom_offset=toolbox[:bottom] || 3
|
280
|
+
bottom_offset = toolbox[:bottom] || 3
|
194
281
|
spacing = toolbox[:spacing] || 3
|
195
|
-
bottom = index * (size + spacing)+bottom_offset
|
282
|
+
bottom = index * (size + spacing) + bottom_offset
|
196
283
|
left = toolbox[:left] || 3
|
197
284
|
right = :auto
|
198
285
|
when :ns
|
@@ -222,7 +309,7 @@ class Atome
|
|
222
309
|
width: size,
|
223
310
|
height: size,
|
224
311
|
smooth: smooth,
|
225
|
-
apply: [:
|
312
|
+
apply: [:inactive_tool_col, :tool_box_border, :tool_shade],
|
226
313
|
state: :closed,
|
227
314
|
data: { method: method,
|
228
315
|
action: action,
|
@@ -235,125 +322,30 @@ class Atome
|
|
235
322
|
}
|
236
323
|
|
237
324
|
})
|
325
|
+
|
326
|
+
tool.instance_variable_set("@tool_scheme", tool_scheme)
|
238
327
|
edition = "M257.7 752c2 0 4-0.2 6-0.5L431.9 722c2-0.4 3.9-1.3 5.3-2.8l423.9-423.9c3.9-3.9 3.9-10.2 0-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2c-1.9 11.1 1.5 21.9 9.4 29.8 6.6 6.4 14.9 9.9 23.8 9.9z m67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"
|
328
|
+
icon = tool.vector({ tag: { system: true }, left: 9, top: :auto, bottom: 9, width: 18, height: 18, id: "#{tool_name}_icon",
|
329
|
+
data: { path: { d: edition, id: "p1_#{tool_name}_icon", stroke: :black, 'stroke-width' => 37, fill: :white } } })
|
330
|
+
|
331
|
+
icon.color(:yellowgreen)
|
239
332
|
|
240
|
-
icon= tool.vector({ tag: { system: true }, left: 9, top: :auto, bottom: 9, width: 18, height: 18, id: "#{tool_name}_icon",
|
241
|
-
data: { path: { d: edition, id: :p1, stroke: :black, 'stroke-width' => 37, fill: :white } }})
|
242
|
-
# wait 2 do
|
243
|
-
# alert "#{tool_name}_icon"
|
244
|
-
# alert "current vector : #{grab("#{tool_name}_icon").id}"
|
245
|
-
grab("#{tool_name}_icon").color(:blue)
|
246
|
-
# icon.color(:red)
|
247
|
-
# end
|
248
|
-
# icon= tool_scheme[:icon] || params[:name]
|
249
|
-
# tool.image({path: "medias/images/icons/#{icon}.svg"})
|
250
333
|
tool.text({ tag: { system: true }, data: label, component: { size: 9 }, color: :grey, id: "#{tool_name}_label" })
|
251
334
|
code_for_zone = tool_scheme[:zone]
|
252
335
|
tool.instance_exec(tool, &code_for_zone) if code_for_zone.is_a? Proc
|
336
|
+
tool.active(false)
|
253
337
|
tool.touch(true) do
|
254
338
|
# we add all specific tool actions to @tools_actions_to_exec hash
|
255
339
|
# we set allow_tool_operations to false to ignore tool operation when clicking on a tool
|
256
340
|
Universe.allow_tool_operations = false
|
257
341
|
# we create the creation_layer if not already exist
|
258
|
-
|
259
|
-
|
260
|
-
if tick[tool_name] == 1 # first click
|
261
|
-
events_allow = [:top, :left, :right, :bottom, :width, :height]
|
262
|
-
alterations = tool_scheme[:alteration] ? tool_scheme[:alteration].keys : []
|
263
|
-
creations = tool_scheme[:creation] ? tool_scheme[:creation].keys : []
|
264
|
-
prev_auth = Universe.allow_localstorage ||= []
|
265
|
-
storage_allowed = events_allow.concat(alterations).concat(creations).concat(prev_auth).uniq
|
266
|
-
Universe.allow_localstorage = storage_allowed
|
267
|
-
# we set edit mode to true (this allow to prevent user atome to respond from click)
|
268
|
-
Universe.edit_mode = true
|
269
|
-
Universe.active_tools << tool_name
|
270
|
-
# init the tool
|
271
|
-
tool.data[:treated] = []
|
272
|
-
tool.data[:created] = []
|
273
|
-
tool.data[:prev_states] = {}
|
274
|
-
# generic behavior
|
275
|
-
tool.apply(:active_tool_col)
|
276
|
-
# activation code
|
277
|
-
activation_code = tool_scheme[:activation]
|
278
|
-
tool.instance_exec(&activation_code) if activation_code.is_a? Proc
|
279
|
-
# below we the particles of selected atomes to feed tools values
|
280
|
-
# possibility 1 (pipette like):
|
281
|
-
# now we get the values from selected atomes
|
282
|
-
Atome.selection.each do |atome_id_to_treat|
|
283
|
-
tool.data[:action].each do |particle_req, value_f|
|
284
|
-
unless Universe.atome_preset
|
285
|
-
value_found = grab(atome_id_to_treat).send(particle_req)
|
286
|
-
if value_found
|
287
|
-
tool.data[:action][particle_req] = value_found
|
288
|
-
else
|
289
|
-
end
|
290
|
-
end
|
291
|
-
end
|
292
|
-
end
|
293
|
-
# possibility 2 (immediate apply):
|
294
|
-
allow_creation = tool.data[:allow_creation]
|
295
|
-
allow_alteration = tool.data[:allow_alteration]
|
296
|
-
Atome.selection.each do |atome_id_to_treat|
|
297
|
-
atome_found = grab(atome_id_to_treat)
|
298
|
-
event = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 }
|
299
|
-
Atome.apply_tool(tool_name, atome_found, event)
|
300
|
-
end unless tool_name.to_sym == :select_tool || !allow_creation || !allow_alteration
|
301
|
-
|
302
|
-
# activate tool analysis test
|
303
|
-
Atome.activate_click_analysis
|
342
|
+
if tool.active == false # first click
|
343
|
+
tool.activate_tool
|
304
344
|
else
|
305
|
-
|
306
|
-
# when closing delete tools action from tool_actions_to_exec
|
307
|
-
Universe.active_tools.delete(tool_name)
|
308
|
-
# we check if all tools are inactive if so we set edit_mode to false
|
309
|
-
if Universe.active_tools.length == 0
|
310
|
-
Atome.de_activate_click_analysis
|
311
|
-
Universe.edit_mode = false
|
312
|
-
end
|
313
|
-
|
314
|
-
inactivation_code = tool_scheme[:inactivation]
|
315
|
-
tool.instance_exec(tool.data, &inactivation_code) if inactivation_code.is_a? Proc
|
316
|
-
# end if tool_content && tool_content[:inactive]
|
317
|
-
|
318
|
-
# generic behavior
|
319
|
-
# we remove touch and resize binding on newly created atomes
|
320
|
-
tool.apply(:inactive_tool_col)
|
321
|
-
tool.data[:created].each do |new_atome|
|
322
|
-
new_atome.drag(false)
|
323
|
-
new_atome.resize(:remove)
|
324
|
-
end
|
325
|
-
################################
|
326
|
-
# we restore prev touch and resize
|
327
|
-
tool.data[:prev_states].each do |atome_f, prev_par|
|
328
|
-
puts prev_par
|
329
|
-
# params[:events].each do |part_f, val_f|
|
330
|
-
# # alert "@#{part_f}, #{part_f}"
|
331
|
-
# atome_f.send(part_f, val_f)
|
332
|
-
# end
|
333
|
-
# alert "--> params : #{params[:events]}"
|
334
|
-
# alert "--> procs : #{params[:procs][params[:events]]}"
|
335
|
-
# atome_f.touch(false)
|
336
|
-
# atome_f.touch(true) do
|
337
|
-
# alert :kool
|
338
|
-
# end
|
339
|
-
# alert params[:procs]
|
340
|
-
# params[:procs].each do |var_n, procs_f|
|
341
|
-
# # procs_f.each do |action_f, proc|
|
342
|
-
# # # puts "#{var_n}==> #{action_f}, #{proc}"
|
343
|
-
# # end
|
344
|
-
# puts "==> #{var_n}, #{proc_f}"
|
345
|
-
# # atome_f.instance_variable_set("@#{var_n}", proc_f)
|
346
|
-
# end
|
347
|
-
# atome_f.touch(false)
|
348
|
-
# alert "#{atome_f.touch} : #{atome_f.instance_variable_get("@touch_code")}"
|
349
|
-
end
|
350
|
-
|
351
|
-
# atome_f.touch(touch_found)
|
352
|
-
# atome_f.resize(resize_found)
|
353
|
-
# inactivation code
|
354
|
-
#################################
|
345
|
+
tool.deactivate_tool
|
355
346
|
tick[tool_name] = 0
|
356
347
|
end
|
357
348
|
end
|
358
349
|
end
|
350
|
+
|
359
351
|
end
|
data/lib/renderers/html/html.rb
CHANGED
@@ -219,7 +219,6 @@ class HTML
|
|
219
219
|
particles_from_style[key.to_sym] = value if key && value
|
220
220
|
end
|
221
221
|
|
222
|
-
|
223
222
|
particles_found = particles_found.merge(particles_from_style)
|
224
223
|
current_atome = grab(@id)
|
225
224
|
usr_bloc.call(particles_found)
|
@@ -735,7 +734,7 @@ class HTML
|
|
735
734
|
end
|
736
735
|
|
737
736
|
def drag_remove(option)
|
738
|
-
|
737
|
+
@draggable = nil
|
739
738
|
interact = JS.eval("return interact('##{@id}')")
|
740
739
|
|
741
740
|
case option
|
@@ -745,8 +744,9 @@ class HTML
|
|
745
744
|
@drag_end = ''
|
746
745
|
when :move
|
747
746
|
interact.draggable(false)
|
748
|
-
interact.unset
|
747
|
+
# interact.unset
|
749
748
|
@drag_move = nil
|
749
|
+
|
750
750
|
when :locked
|
751
751
|
@drag_locked = ''
|
752
752
|
when :restrict
|
@@ -759,7 +759,7 @@ class HTML
|
|
759
759
|
@drag_restrict = ''
|
760
760
|
@drag_move = nil
|
761
761
|
interact.draggable(false)
|
762
|
-
interact.unset
|
762
|
+
# interact.unset
|
763
763
|
end
|
764
764
|
|
765
765
|
end
|
@@ -772,7 +772,7 @@ class HTML
|
|
772
772
|
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
773
773
|
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
774
774
|
# group etc..
|
775
|
-
@drag_start.call(event) if @drag_start
|
775
|
+
@drag_start.call(event) if event_validation(@drag_start)
|
776
776
|
end
|
777
777
|
end
|
778
778
|
|
@@ -784,38 +784,43 @@ class HTML
|
|
784
784
|
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
785
785
|
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
786
786
|
# group etc..
|
787
|
-
@drag_end.call(event) if @drag_end
|
787
|
+
@drag_end.call(event) if event_validation(@drag_end)
|
788
788
|
end
|
789
789
|
end
|
790
790
|
|
791
791
|
def drag_move(_option)
|
792
|
-
|
792
|
+
# the condition below prevent drag accumulation
|
793
793
|
interact = JS.eval("return interact('##{@id}')")
|
794
|
-
# interact.draggable(false)
|
795
794
|
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
795
|
+
unless @draggable
|
796
|
+
interact.draggable({
|
797
|
+
drag: true,
|
798
|
+
inertia: { resistance: 12,
|
799
|
+
minSpeed: 200,
|
800
|
+
endSpeed: 100 },
|
801
|
+
})
|
802
|
+
@drag_move = @original_atome.instance_variable_get('@drag_code')[:move]
|
803
|
+
unless @first_drag
|
804
|
+
interact.on('dragmove') do |native_event|
|
805
|
+
# the use of Native is only for Opal (look at lib/platform_specific/atome_wasm_extensions.rb for more infos)
|
806
|
+
event = Native(native_event)
|
807
|
+
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
808
|
+
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
809
|
+
# group etc..
|
810
|
+
@drag_move.call(event) if event_validation(@drag_move)
|
811
|
+
Universe.allow_tool_operations = false
|
812
|
+
dx = event[:dx]
|
813
|
+
dy = event[:dy]
|
814
|
+
x = (@original_atome.left || 0) + dx.to_f
|
815
|
+
y = (@original_atome.top || 0) + dy.to_f
|
816
|
+
@original_atome.left(x)
|
817
|
+
@original_atome.top(y)
|
818
|
+
end
|
802
819
|
|
803
|
-
|
804
|
-
interact.on('dragmove') do |native_event|
|
805
|
-
# the use of Native is only for Opal (look at lib/platform_specific/atome_wasm_extensions.rb for more infos)
|
806
|
-
event = Native(native_event)
|
807
|
-
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
808
|
-
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
809
|
-
# group etc..
|
810
|
-
@drag_move.call(event) if @drag_move.is_a?(Proc)
|
811
|
-
Universe.allow_tool_operations = false
|
812
|
-
dx = event[:dx]
|
813
|
-
dy = event[:dy]
|
814
|
-
x = (@original_atome.left || 0) + dx.to_f
|
815
|
-
y = (@original_atome.top || 0) + dy.to_f
|
816
|
-
@original_atome.left(x)
|
817
|
-
@original_atome.top(y)
|
820
|
+
end
|
818
821
|
end
|
822
|
+
@first_drag = true
|
823
|
+
@draggable = true
|
819
824
|
end
|
820
825
|
|
821
826
|
def drag_restrict(option)
|
@@ -866,7 +871,7 @@ class HTML
|
|
866
871
|
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
867
872
|
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
868
873
|
# group etc..
|
869
|
-
@drag_move.call(event) if @drag_move
|
874
|
+
@drag_move.call(event) if event_validation(@drag_move)
|
870
875
|
dx = event[:dx]
|
871
876
|
dy = event[:dy]
|
872
877
|
x = (@original_atome.left || 0) + dx.to_f
|
@@ -893,7 +898,7 @@ class HTML
|
|
893
898
|
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
894
899
|
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
895
900
|
# group etc..
|
896
|
-
@drag_lock.call(event) if @drag_lock
|
901
|
+
@drag_lock.call(event) if event_validation(@drag_lock)
|
897
902
|
end
|
898
903
|
end
|
899
904
|
|
@@ -904,7 +909,7 @@ class HTML
|
|
904
909
|
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
905
910
|
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
906
911
|
# group etc..
|
907
|
-
bloc.call({ source: draggable_element, destination: dropzone_element }) if bloc
|
912
|
+
bloc.call({ source: draggable_element, destination: dropzone_element }) if event_validation(bloc)
|
908
913
|
end
|
909
914
|
|
910
915
|
def drop_activate(_option)
|
@@ -915,7 +920,7 @@ class HTML
|
|
915
920
|
accept: nil, # Accept any element
|
916
921
|
overlap: 0.75,
|
917
922
|
ondropactivate: lambda do |native_event|
|
918
|
-
drop_action(native_event, @drop_activate)
|
923
|
+
drop_action(native_event, @drop_activate) if event_validation(@drop_activate)
|
919
924
|
end
|
920
925
|
})
|
921
926
|
end
|
@@ -928,7 +933,7 @@ class HTML
|
|
928
933
|
# overlap: 0.75,
|
929
934
|
# FIXME : remove because os an opal bug since 1.8 reactivate when opal will be debbuged
|
930
935
|
ondropdeactivate: lambda do |native_event|
|
931
|
-
drop_action(native_event, @drop_deactivate)
|
936
|
+
drop_action(native_event, @drop_deactivate) if event_validation(@drop_deactivate)
|
932
937
|
end
|
933
938
|
})
|
934
939
|
end
|
@@ -941,7 +946,7 @@ class HTML
|
|
941
946
|
overlap: 0.75,
|
942
947
|
# FIXME : remove because os an opal bug since 1.8 reactivate when opal will be debbuged
|
943
948
|
ondrop: lambda do |native_event|
|
944
|
-
drop_action(native_event, @drop_dropped)
|
949
|
+
drop_action(native_event, @drop_dropped) if event_validation(@drop_dropped)
|
945
950
|
end
|
946
951
|
})
|
947
952
|
end
|
@@ -956,7 +961,7 @@ class HTML
|
|
956
961
|
overlap: 0.001,
|
957
962
|
# FIXME : remove because os an opal bug since 1.8 reactivate when opal will be debbuged
|
958
963
|
ondragenter: lambda do |native_event|
|
959
|
-
drop_action(native_event, @drop_enter)
|
964
|
+
drop_action(native_event, @drop_enter) if event_validation(@drop_enter)
|
960
965
|
end
|
961
966
|
})
|
962
967
|
end
|
@@ -970,7 +975,7 @@ class HTML
|
|
970
975
|
# overlap: 0.75,
|
971
976
|
# FIXME : remove because os an opal bug since 1.8 reactivate when opal will be debbuged
|
972
977
|
ondragleave: lambda do |native_event|
|
973
|
-
drop_action(native_event, @drop_leave)
|
978
|
+
drop_action(native_event, @drop_leave) if event_validation(@drop_enter)
|
974
979
|
end
|
975
980
|
})
|
976
981
|
|
@@ -990,8 +995,8 @@ class HTML
|
|
990
995
|
@drop_leave = ''
|
991
996
|
else
|
992
997
|
# to remove all interact event ( touch, drag, scale, ... uncomment below)
|
993
|
-
interact = JS.eval("return interact('##{@id}')")
|
994
|
-
interact.unset
|
998
|
+
# interact = JS.eval("return interact('##{@id}')")
|
999
|
+
# interact.unset
|
995
1000
|
@drop_activate = ''
|
996
1001
|
@drop_deactivate = ''
|
997
1002
|
@drop_dropped = ''
|
@@ -1025,7 +1030,7 @@ class HTML
|
|
1025
1030
|
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
1026
1031
|
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
1027
1032
|
# group etc..
|
1028
|
-
@resize.call(event) if @resize
|
1033
|
+
@resize.call(event) if event_validation(@resize)
|
1029
1034
|
x = (@element[:offsetLeft].to_i || 0)
|
1030
1035
|
y = (@element[:offsetTop].to_i || 0)
|
1031
1036
|
width = event[:rect][:width]
|
@@ -1055,7 +1060,7 @@ class HTML
|
|
1055
1060
|
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
1056
1061
|
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
1057
1062
|
# group etc..
|
1058
|
-
@overflow.call({ left: scroll_left, top: scroll_top }) if @overflow
|
1063
|
+
@overflow.call({ left: scroll_left, top: scroll_top }) if event_validation(@overflow)
|
1059
1064
|
end)
|
1060
1065
|
end
|
1061
1066
|
|
@@ -1064,12 +1069,11 @@ class HTML
|
|
1064
1069
|
@over_over = @original_atome.over_code[:over]
|
1065
1070
|
interact.on('mouseover') do |native_event|
|
1066
1071
|
JS.global[:myRubyMouseOverCallback] = Proc.new { @original_atome.over_code[:over].call }
|
1067
|
-
JS.eval("document.querySelector('##{@id}').addEventListener('mouseleave', myRubyMouseOverCallback);")
|
1068
1072
|
event = Native(native_event)
|
1069
1073
|
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
1070
1074
|
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
1071
1075
|
# group etc..
|
1072
|
-
@over_over.call(event) if @over_over
|
1076
|
+
@over_over.call(event) if event_validation(@over_over)
|
1073
1077
|
end
|
1074
1078
|
end
|
1075
1079
|
|
@@ -1081,21 +1085,23 @@ class HTML
|
|
1081
1085
|
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
1082
1086
|
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
1083
1087
|
# group etc..
|
1084
|
-
@over_enter.call(event) if @over_enter
|
1088
|
+
@over_enter.call(event) if event_validation(@over_enter)
|
1085
1089
|
end
|
1086
1090
|
@element.addEventListener('mouseenter', @over_enter_callback)
|
1087
1091
|
|
1088
1092
|
end
|
1089
1093
|
|
1090
1094
|
def over_leave(_option)
|
1095
|
+
|
1091
1096
|
@over_leave = @original_atome.instance_variable_get('@over_code')[:leave]
|
1092
1097
|
return unless @over_leave
|
1093
1098
|
|
1094
1099
|
@over_leave_callback = lambda do |event|
|
1100
|
+
|
1095
1101
|
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
1096
1102
|
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
1097
1103
|
# group etc..
|
1098
|
-
@over_leave.call(event) if @over_leave
|
1104
|
+
@over_leave.call(event) if event_validation(@over_leave)
|
1099
1105
|
end
|
1100
1106
|
@element.addEventListener('mouseleave', @over_leave_callback)
|
1101
1107
|
|
@@ -1142,7 +1148,6 @@ class HTML
|
|
1142
1148
|
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
1143
1149
|
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
1144
1150
|
# group etc..
|
1145
|
-
# unless Universe.edit_mode == true
|
1146
1151
|
# @touch_down.call(event) if @touch_down.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
|
1147
1152
|
@touch_down.call(event) if event_validation(@touch_down)
|
1148
1153
|
# end
|
@@ -1239,23 +1244,9 @@ class HTML
|
|
1239
1244
|
@touch_removed[:up] = true
|
1240
1245
|
@touch_up = ''
|
1241
1246
|
else
|
1242
|
-
interact = JS.eval("return interact('##{@id}')")
|
1243
|
-
interact.unset
|
1244
|
-
# @original_atome.instance_variable_set('@touch_code')
|
1245
|
-
@original_atome.instance_variable_set('@touch_code', nil)
|
1246
|
-
# @touch_removed[:double] = true
|
1247
|
-
# @touch_removed[:down] = true
|
1248
|
-
# @touch_removed[:long] = true
|
1249
|
-
# @touch_removed[:tap] = true
|
1250
|
-
# @touch_removed[:up] = true
|
1251
|
-
# @touch_double = ''
|
1252
|
-
# @touch_down = ''
|
1253
|
-
# @touch_long = ''
|
1254
|
-
# @touch_tap = ''
|
1255
|
-
# @touch_up = ''
|
1256
|
-
# to remove all interact event ( touch, drag, scale, ... uncomment below)
|
1257
1247
|
# interact = JS.eval("return interact('##{@id}')")
|
1258
1248
|
# interact.unset
|
1249
|
+
@original_atome.instance_variable_set('@touch_code', nil)
|
1259
1250
|
end
|
1260
1251
|
|
1261
1252
|
end
|
@@ -1303,14 +1294,13 @@ class HTML
|
|
1303
1294
|
end
|
1304
1295
|
end
|
1305
1296
|
|
1306
|
-
|
1307
1297
|
# animation below
|
1308
1298
|
def animate(animation_properties)
|
1309
|
-
prop= animation_properties[:particle]
|
1310
|
-
command = <<~JS
|
1299
|
+
prop = animation_properties[:particle]
|
1300
|
+
command = <<~JS
|
1311
1301
|
var target_div = document.getElementById('#{@id}');
|
1312
1302
|
window.currentAnimation = popmotion.animate({
|
1313
|
-
from: #{animation_properties[
|
1303
|
+
from: #{animation_properties[:from]},
|
1314
1304
|
to: #{animation_properties[:to]},
|
1315
1305
|
duration: #{animation_properties[:duration]},
|
1316
1306
|
onUpdate: function(v) {
|
@@ -1326,8 +1316,6 @@ class HTML
|
|
1326
1316
|
JS.eval(command)
|
1327
1317
|
end
|
1328
1318
|
|
1329
|
-
|
1330
|
-
|
1331
1319
|
def stop_animation
|
1332
1320
|
JS.eval('if (window.currentAnimation) window.currentAnimation.stop();')
|
1333
1321
|
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
|
-
|
2
|
+
# wait 0.5 do
|
3
|
+
# JS.eval("console.clear()")
|
4
|
+
# end
|
4
5
|
########################### Test check and verification below ############################
|
5
6
|
|
6
|
-
new({ tool: :
|
7
|
+
new({ tool: :combined }) do |params|
|
7
8
|
|
8
9
|
active_code = lambda {
|
9
10
|
puts :alteration_tool_code_activated
|
@@ -22,7 +23,7 @@ new({ tool: :blur }) do |params|
|
|
22
23
|
}
|
23
24
|
|
24
25
|
zone_spe = lambda { |current_tool|
|
25
|
-
puts "current tool is : #{:current_tool} now creating specific zone"
|
26
|
+
# puts "current tool is : #{:current_tool} now creating specific zone"
|
26
27
|
# b = box({ width: 33, height: 12 })
|
27
28
|
# b.text({ data: :all })
|
28
29
|
|
@@ -68,7 +69,6 @@ new({ tool: :box }) do |params|
|
|
68
69
|
|
69
70
|
end
|
70
71
|
|
71
|
-
|
72
72
|
new({ tool: :project }) do
|
73
73
|
active_code = lambda {
|
74
74
|
|
@@ -85,32 +85,86 @@ new({ tool: :project }) do
|
|
85
85
|
{ activation: active_code }
|
86
86
|
end
|
87
87
|
|
88
|
-
new({tool: :
|
88
|
+
new({tool: :move}) do
|
89
89
|
active_code = lambda {
|
90
|
-
|
91
|
-
|
92
|
-
|
90
|
+
puts 'move activated'
|
91
|
+
}
|
92
|
+
move_code = lambda {
|
93
|
+
drag(true)
|
94
|
+
}
|
95
|
+
inactive_code = lambda {|data|
|
96
|
+
data[:treated].each do |atome_f|
|
97
|
+
atome_f.drag(false)
|
98
|
+
end
|
99
|
+
}
|
100
|
+
|
101
|
+
{ activation: active_code, alteration: { event: move_code }, inactivation: inactive_code }
|
102
|
+
end
|
103
|
+
|
104
|
+
new({tool: :drag}) do
|
105
|
+
active_code = lambda {
|
106
|
+
puts 'move activated'
|
107
|
+
}
|
108
|
+
move_code = lambda {
|
109
|
+
drag(true) do
|
110
|
+
puts left
|
93
111
|
end
|
94
112
|
}
|
95
|
-
|
113
|
+
|
114
|
+
{ activation: active_code, alteration: { event: move_code} }
|
115
|
+
end
|
116
|
+
|
117
|
+
new({tool: :touch}) do
|
118
|
+
move_code = lambda {
|
119
|
+
touch(:down) do
|
120
|
+
color(:red)
|
121
|
+
end
|
122
|
+
}
|
123
|
+
{ alteration: { event: move_code } }
|
124
|
+
end
|
125
|
+
|
126
|
+
new({tool: :toolbox1}) do
|
127
|
+
active_code = lambda {
|
128
|
+
toolbox({tools: [:combined],toolbox: { orientation: :ew, left:90 , bottom: 9, spacing: 9} })
|
129
|
+
}
|
96
130
|
{ activation: active_code }
|
97
131
|
end
|
98
132
|
|
133
|
+
# Universe.tools_root= {tools: [:blur, :box, :test, :toolbox1],toolbox: { orientation: :ew, left:90 , bottom: 9, spacing: 9} }
|
134
|
+
Universe.tools_root= {tools: [:box,:drag,:touch, :move,:toolbox1],toolbox: { orientation: :ew, left:9 , bottom: 9, spacing: 9} }
|
99
135
|
|
100
|
-
Universe.tools_root= {tools: [:blur, :box, :test],toolbox: { orientation: :ew, left:9 , bottom: 9, spacing: 9} }
|
101
|
-
# Universe.tools_root=[:test]
|
102
136
|
Atome.init_intuition
|
103
137
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
138
|
+
b=box({id: :the_test__box, selected: true})
|
139
|
+
circle({left: 90, id: :the_test_circle, selected: true})
|
140
|
+
b.touch(true) do
|
141
|
+
if b.width==170
|
142
|
+
b.width(55)
|
143
|
+
else
|
144
|
+
b.width(170)
|
111
145
|
end
|
146
|
+
|
112
147
|
end
|
113
148
|
|
149
|
+
# box({id: :the_box})
|
150
|
+
# circle({left: 90, id: :the_circle})
|
151
|
+
# alert b.aid
|
152
|
+
|
153
|
+
# b=box
|
154
|
+
#
|
155
|
+
# active_code = lambda {
|
156
|
+
# b=grab(:view).circle({color: :red, left: 88})
|
157
|
+
# b.touch(true) do
|
158
|
+
# alert :kool
|
159
|
+
# end
|
160
|
+
# }
|
161
|
+
# b.touch(true) do
|
162
|
+
# # c=circle({color: :red})
|
163
|
+
# active_code.call
|
164
|
+
# # c.touch(true) do
|
165
|
+
# # # active_code.call
|
166
|
+
# # end
|
167
|
+
# end
|
114
168
|
|
115
169
|
# ################### check below
|
116
170
|
|
@@ -16,6 +16,25 @@ class EDen
|
|
16
16
|
Database.db_access
|
17
17
|
end
|
18
18
|
|
19
|
+
def email_exist(data, message_id, ws)
|
20
|
+
|
21
|
+
mail = data["email"]
|
22
|
+
puts "mail : #{mail}"
|
23
|
+
db = db_access
|
24
|
+
puts "db : #{db}"
|
25
|
+
user_table = db[:user]
|
26
|
+
puts "user_table : #{user_table}"
|
27
|
+
sanitized_email = sanitize_email(mail)
|
28
|
+
puts "sanitized_email : #{sanitized_email}"
|
29
|
+
user = user_table.where(email: sanitized_email).first
|
30
|
+
puts "user : #{user}"
|
31
|
+
# build the answer telling if email exist or not
|
32
|
+
email_exists_response = !user.nil?
|
33
|
+
puts "email_exists_response : #{email_exists_response}"
|
34
|
+
# response return
|
35
|
+
{ data: {email_exist: email_exists_response}, message_id: message_id }
|
36
|
+
end
|
37
|
+
|
19
38
|
def terminal(data, message_id, ws)
|
20
39
|
{ data: { message: `#{data}` }, message_id: message_id }
|
21
40
|
end
|
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
|
+
version: 0.5.7.3.0
|
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-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eventmachine
|
@@ -613,6 +613,7 @@ files:
|
|
613
613
|
- vendor/assets/application/examples/online.rb
|
614
614
|
- vendor/assets/application/examples/opacity.rb
|
615
615
|
- vendor/assets/application/examples/over.rb
|
616
|
+
- vendor/assets/application/examples/overflow.rb
|
616
617
|
- vendor/assets/application/examples/paint.rb
|
617
618
|
- vendor/assets/application/examples/particles.rb
|
618
619
|
- vendor/assets/application/examples/percent_to_px.rb
|
@@ -627,7 +628,6 @@ files:
|
|
627
628
|
- vendor/assets/application/examples/repeat.rb
|
628
629
|
- vendor/assets/application/examples/resize.rb
|
629
630
|
- vendor/assets/application/examples/rotate.rb
|
630
|
-
- vendor/assets/application/examples/scroll.rb
|
631
631
|
- vendor/assets/application/examples/security.rb
|
632
632
|
- vendor/assets/application/examples/select_text.rb
|
633
633
|
- vendor/assets/application/examples/selected.rb
|
File without changes
|