atome 0.5.7.3.0 → 0.5.7.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ b = box({ left: 333, color: :blue, smooth: 6, id: :the_box2 })
4
+
5
+ t = text({ id: :the_text, data: 'touch the box and wait!' })
6
+
7
+ exec_code=lambda do
8
+
9
+ wait 2 do
10
+ t.data('it works!! ')
11
+ end
12
+
13
+ end
14
+ b.code(:hello) do
15
+ circle({ left: rand(333), color: :green })
16
+ end
17
+ b.run(:hello)
18
+ b.touch(:tap) do
19
+ {
20
+ color: :cyan,
21
+ target: { the_text: { data: :super! } },
22
+ run: exec_code
23
+ }
24
+ end
25
+
@@ -85,25 +85,27 @@ new({ tool: :project }) do
85
85
  { activation: active_code }
86
86
  end
87
87
 
88
- new({tool: :move}) do
88
+ new({ tool: :move }) do
89
89
  active_code = lambda {
90
- puts 'move activated'
90
+ puts 'move activated1'
91
91
  }
92
92
  move_code = lambda {
93
93
  drag(true)
94
94
  }
95
- inactive_code = lambda {|data|
96
- data[:treated].each do |atome_f|
97
- atome_f.drag(false)
98
- end
95
+ inactive_code = lambda { |data|
96
+ data[:treated].each do |atome_f|
97
+ atome_f.drag(false)
98
+ end
99
99
  }
100
100
 
101
- { activation: active_code, alteration: { event: move_code }, inactivation: inactive_code }
101
+ { activation: active_code,
102
+ alteration: { event: move_code },
103
+ inactivation: inactive_code}
102
104
  end
103
105
 
104
- new({tool: :drag}) do
106
+ new({ tool: :drag }) do
105
107
  active_code = lambda {
106
- puts 'move activated'
108
+ puts 'move activated2'
107
109
  }
108
110
  move_code = lambda {
109
111
  drag(true) do
@@ -111,10 +113,10 @@ new({tool: :drag}) do
111
113
  end
112
114
  }
113
115
 
114
- { activation: active_code, alteration: { event: move_code} }
116
+ { activation: active_code, alteration: { event: move_code } }
115
117
  end
116
118
 
117
- new({tool: :touch}) do
119
+ new({ tool: :touch }) do
118
120
  move_code = lambda {
119
121
  touch(:down) do
120
122
  color(:red)
@@ -123,22 +125,44 @@ new({tool: :touch}) do
123
125
  { alteration: { event: move_code } }
124
126
  end
125
127
 
126
- new({tool: :toolbox1}) do
128
+ new({ tool: :toolbox1 }) do
127
129
  active_code = lambda {
128
- toolbox({tools: [:combined],toolbox: { orientation: :ew, left:90 , bottom: 9, spacing: 9} })
130
+ toolbox({ tools: [:combined], toolbox: { orientation: :ew, left: 90, bottom: 9, spacing: 9 } })
129
131
  }
130
132
  { activation: active_code }
131
133
  end
132
134
 
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} }
135
+ new({ tool: :color }) do
136
+ active_code = lambda {
137
+ puts 'color activated1'
138
+ }
139
+ color_code = lambda {
140
+ # color(:green)
141
+ # tools_values
142
+ }
143
+ inactive_code = lambda { |data|
144
+ data[:treated].each do |atome_f|
145
+ # atome_f.drag(false)
146
+ # atome_f.color(:green)
147
+ end
148
+ }
135
149
 
150
+ { activation: active_code,
151
+ alteration: { event: color_code },
152
+ inactivation: inactive_code,
153
+ target: :color,
154
+ particles: { red: 0, green: 0.5, blue: 1, alpha: 1 }}
155
+ end
156
+
157
+ # Universe.tools_root= {tools: [:blur, :box, :test, :toolbox1],toolbox: { orientation: :ew, left:90 , bottom: 9, spacing: 9} }
158
+ Universe.tools_root = {id: :root_tools, tools: [:box, :drag, :touch,:color, :move, :toolbox1], toolbox: { orientation: :ew, left: 9, bottom: 9, spacing: 9 } }
159
+ puts "above we added an id because each tool may be in many toolbox and have an uniq ID"
136
160
  Atome.init_intuition
137
161
 
138
- b=box({id: :the_test__box, selected: true})
139
- circle({left: 90, id: :the_test_circle, selected: true})
162
+ b = box({ id: :the_test__box, selected: true })
163
+ circle({ left: 90, id: :the_test_circle, selected: true })
140
164
  b.touch(true) do
141
- if b.width==170
165
+ if b.width == 170
142
166
  b.width(55)
143
167
  else
144
168
  b.width(170)
@@ -239,12 +263,6 @@ end
239
263
 
240
264
  # A.html.record
241
265
 
242
-
243
-
244
-
245
-
246
-
247
-
248
266
  # 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"
249
267
  #
250
268
  # v = vector({left: 99, data: { path: { d: edition, id: :p1, stroke: :black, 'stroke-width' => 37, fill: :red } } })
@@ -256,3 +274,48 @@ end
256
274
  # end
257
275
  # end
258
276
 
277
+ s = box({ color: :red, left: 123, top: 123 })
278
+ # tap event content :
279
+ # 1. Common Properties:
280
+ # • target: The element that is being interacted with.
281
+ # • interaction: The Interaction object that the event belongs to.
282
+ # • x0, y0: The page coordinates where the interaction started.
283
+ # • clientX0, clientY0: The client coordinates where the interaction started.
284
+ # • dx, dy: The change in coordinates since the last event.
285
+ # • velocityX, velocityY: The velocity of the pointer.
286
+ # • speed: The speed of the pointer.
287
+ # • timeStamp: The time when the event was created.
288
+ # 2. Tap Specific Properties:
289
+ # • pointerId: The identifier of the pointer used for the tap.
290
+ # • pageX, pageY: The X and Y coordinates of the event relative to the page.
291
+ # • clientX, clientY: The X and Y coordinates of the event relative to the viewport.
292
+
293
+ s.touch(true) do |event|
294
+ x_pos = event[:clientX]
295
+ { left: '20', alert: 'hello! and big bisous!!, position : ' + x_pos.to_s }
296
+
297
+ end
298
+ s.remove(:box_color)
299
+ ####### empty local storage :
300
+ JS.eval("localStorage.clear();")
301
+ ############## soluce below
302
+
303
+ # def verif(val, &pro)
304
+ # datas= pro.call(val)
305
+ # alert datas.delete(:left)
306
+ # datas.each do |k,v|
307
+ # send(k,v)
308
+ # end
309
+ # end
310
+ #
311
+ # verif(val=33) do |var|
312
+ # # puts left = '20' + var.to_s
313
+ # {left: '20' + var.to_s, alert: 'hello! and big bisous!!'}
314
+ # end
315
+
316
+
317
+ b=box
318
+ b.touch({tap: true}) do
319
+ alert :hello
320
+ end
321
+
@@ -2,26 +2,34 @@
2
2
 
3
3
  b = box({ left: 333, color: :blue, smooth: 6, id: :the_box2 })
4
4
 
5
- t=text({id: :the_text, data: 'type of touch : ?'})
5
+ t = text({ id: :the_text, data: 'type of touch : ?' })
6
6
 
7
7
  t.touch(:down) do |event|
8
8
  puts :down
9
9
  puts event[:pageX]
10
10
  puts event[:pageY]
11
11
  b.touch({remove: :down})
12
+ # b.touch({remove: :up})
13
+ # b.touch({remove: :long})
14
+ # b.touch({remove: :double})
15
+ # b.touch({remove: :tap})
16
+ # b.touch({remove: :touch})
12
17
  # b.touch(:remove) # or b.touch(false) to remove all touches bindings
13
18
  t.data('touch down killed')
14
19
  end
15
- b.touch(true) do
16
- puts :true
20
+
21
+ touch_code =lambda do
17
22
  b.color(:red)
18
23
  puts 'box tapped'
24
+ # b.instance_variable_set('@touch_code', nil)
19
25
  end
26
+ b.touch(tap: true, code: touch_code)
20
27
 
21
28
  b.touch(:long) do
22
- puts :long
23
- t.data('type of touch is : long ')
24
- b.color(:black)
29
+ # puts :long
30
+ # t.data('type of touch is : long ')
31
+ # b.color(:black)
32
+ {color: :cyan}
25
33
  end
26
34
 
27
35
  b.touch(:up) do
@@ -42,3 +50,6 @@ b.touch(:double) do
42
50
  t.data('type of touch is : double ')
43
51
  b.color(:yellowgreen)
44
52
  end
53
+
54
+
55
+
@@ -106,6 +106,13 @@ pre {
106
106
  word-wrap: break-word;
107
107
  white-space: pre-wrap;
108
108
  position: relative;
109
+
110
+ /* add on to test with multiple styles*/
111
+ display: inline-block;
112
+ box-sizing: border-box;
113
+ /*overflow: hidden;*/
114
+ text-overflow: ellipsis;
115
+ min-width: 0;
109
116
  }
110
117
 
111
118
  .center {