atome 0.5.7.3.1 → 0.5.7.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bda2b32c6739ba09c874bfdda703d1e64a3e01856b3f80fa01aba15866628335
4
- data.tar.gz: 8ce5a6571be7d57c82aa64a345997f881a35c80ad12a3ec77b9ecc6a6fe00d47
3
+ metadata.gz: 6bf0aa348d59571692a14c0bbd2910cddcb94fa1c1507e5a2d9ccdbd9c75f565
4
+ data.tar.gz: 43f0dd9848d94f025018efd4b86fc6d3209998fe37e23f34c707a97a0f7680ca
5
5
  SHA512:
6
- metadata.gz: 1e5d67579d27b6fe58b41e63a1b6ac4811b3d47e5cae67f005c234d835760721ddf6d5591594a011b660a719b4a0873b3f5c8eb7840e7a4886dd6cbcc31f2e5b
7
- data.tar.gz: 4f01d01a81f832cd14741c3a97ba93b82ee717821971b42aaf9d72f6820975c8b46a0adea51cf679cf114dd80678cd55ef4371b18a4b23fcb18a9e0f48dc0849
6
+ metadata.gz: 83d133860dd02158c3f8b72923987299a90b1f84c90816c9a79c67be923c4d56815fd76433117540ce9eb2341ad2f51cbdc2d32ee0b28e623dfb3de709cac572
7
+ data.tar.gz: 18580c37a8635cd805e23fa9daf8d39b7f7ccca3d6a954d731ca0b9bf819b5a1dffda460f25b27217b5a51e112409db90f3d897a91b6465f59220486a01f8f97
data/lib/atome/atome.rb CHANGED
@@ -48,6 +48,7 @@ class Atome
48
48
  @collect = {}
49
49
  @int8 = {}
50
50
  @css = {}
51
+ @code={}
51
52
  @aid= new_atome[:aid] || identity_generator
52
53
  @controller_proc=[]
53
54
  @id = new_atome[:id] || @aid
@@ -4,14 +4,14 @@ new({ particle: :touch, category: :event, type: :hash, store: false })
4
4
  new({ sanitizer: :touch }) do |params, user_bloc|
5
5
  if params
6
6
  # TODO: factorise code below
7
- # alert "touch_code: #{@touch_code}"
8
7
  @touch ||= {}
9
8
  @touch_code ||= {}
10
9
  option = true
11
10
  params = if params.instance_of? Hash
12
- @touch_code[params.keys[0]] = user_bloc
13
- option = params[params.keys[0]]
14
- params.keys[0]
11
+ user_bloc =params.delete(:code) if params[:code]
12
+ @touch_code[params.keys[0]] = user_bloc
13
+ option = params[params.keys[0]]
14
+ params.keys[0]
15
15
  else
16
16
  case params
17
17
  when true
@@ -120,9 +120,10 @@ new({ sanitizer: :drag }) do |params, user_bloc|
120
120
  @drag_code ||= {}
121
121
  option = true
122
122
  params = if params.instance_of? Hash
123
- @drag_code[params.keys[0]] = user_bloc
124
- option = params[params.keys[0]]
125
- params.keys[0]
123
+ user_bloc =params.delete(:code) if params[:code]
124
+ @drag_code[params.keys[0]] = user_bloc
125
+ option = params[params.keys[0]]
126
+ params.keys[0]
126
127
  else
127
128
  case params
128
129
  when true
@@ -173,9 +174,10 @@ new({ sanitizer: :drop }) do |params, user_bloc|
173
174
  @drop_code ||= {}
174
175
  option = true
175
176
  params = if params.instance_of? Hash
176
- @drop_code[params.keys[0]] = user_bloc
177
- option = params[params.keys[0]]
178
- params.keys[0]
177
+ user_bloc =params.delete(:code) if params[:code]
178
+ @drop_code[params.keys[0]] = user_bloc
179
+ option = params[params.keys[0]]
180
+ params.keys[0]
179
181
  else
180
182
  case params
181
183
  when true
@@ -210,10 +212,10 @@ new({ sanitizer: :over }) do |params, user_bloc|
210
212
  @over_code ||= {}
211
213
  option = true
212
214
  params = if params.instance_of? Hash
213
-
214
- @over_code[params.keys[0]] = user_bloc
215
- option = params[params.keys[0]]
216
- params.keys[0]
215
+ user_bloc =params.delete(:code) if params[:code]
216
+ @over_code[params.keys[0]] = user_bloc
217
+ option = params[params.keys[0]]
218
+ params.keys[0]
217
219
  else
218
220
  case params
219
221
  when true
@@ -269,8 +271,12 @@ new({ sanitizer: :keyboard }) do |params, user_bloc|
269
271
  option = {}
270
272
  params = if params.instance_of? Hash
271
273
  # @keyboard_code[:keyboard] = user_bloc
274
+ # option = params[params.keys[0]]
275
+ # :remove
276
+ user_bloc =params.delete(:code) if params[:code]
277
+ @keyboard_code[params.keys[0]] = user_bloc
272
278
  option = params[params.keys[0]]
273
- :remove
279
+ params.keys[0]
274
280
  else
275
281
  case params
276
282
  when true
@@ -1,11 +1,33 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  new({ particle: :renderers, category: :utility, type: :string })
4
- new({ particle: :code, category: :utility, type: :string })
5
- new({ particle: :run, category: :utility, type: :boolean }) do |params|
6
- code_found = @code
7
- instance_exec(params, &code_found) if code_found.is_a?(Proc)
4
+ new({ particle: :code, category: :utility, type: :string, store: false }) do |params, code|
5
+ @code[params]=code
8
6
  end
7
+ # new({ particle: :run, category: :utility, type: :boolean }) do |params|
8
+ # code_found = @code
9
+ # instance_exec(params, &code_found) if code_found.is_a?(Proc)
10
+ # end
11
+
12
+ new({ particle: :run }) do |params, code|
13
+ instance_exec(&params) if params.is_a?(Proc)
14
+ code_found = @code[params]
15
+ instance_exec(params, &code_found) if code_found.is_a?(Proc)
16
+ end
17
+
18
+ new({ particle: :target }) do |params|
19
+ params.each do |atome_f, value_f|
20
+ if value_f.instance_of?(Hash)
21
+ value_f.each do |part_f, part_val|
22
+ grab(atome_f).send(part_f, part_val)
23
+ end
24
+ else
25
+ grab(atome_f).send(value_f)
26
+ end
27
+ end
28
+ end
29
+
30
+
9
31
  # new({ particle: :broadcast })
10
32
 
11
33
  def delete_recursive(atome_id, force=false)
data/lib/atome/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  # return atome version
4
4
  class Atome
5
- VERSION = '0.5.7.3.1'
5
+ VERSION = '0.5.7.3.2'
6
6
  end
@@ -427,11 +427,13 @@ new(molecule: :matrix) do |params, &bloc|
427
427
  matrix_back.data(params)
428
428
  matrix_back
429
429
  end
430
+
430
431
  new(molecule: :page) do |params, &bloc|
431
432
  b = box({ color: :red, left: 99, drag: true })
432
433
  b.remove(:box_color)
433
434
  b.text(params)
434
435
  end
436
+
435
437
  new(molecule: :application) do |params, &bloc|
436
438
 
437
439
  main_page = box({ drag: true, width: :auto, height: :auto, top: 0, bottom: 0, left: 0, right: 0 })
@@ -650,7 +650,13 @@ class HTML
650
650
  mql = JS.global[:window].matchMedia(media_query)
651
651
 
652
652
  event_handler = ->(event) do
653
- bloc.call({ matches: event[:matches] }) if bloc.is_a? Proc
653
+ # bloc.call({ matches: event[:matches] }) if bloc.is_a? Proc
654
+ proc_content = bloc.call({ matches: event[:matches] }) if event_validation(bloc)
655
+ if proc_content.instance_of? Hash
656
+ proc_content.each do |k, v|
657
+ @original_atome.send(k, v)
658
+ end
659
+ end
654
660
  end
655
661
 
656
662
  # add a listener to matchMedia object
@@ -660,12 +666,33 @@ class HTML
660
666
  event_handler = ->(event) do
661
667
  width = JS.global[:window][:innerWidth]
662
668
  height = JS.global[:window][:innerHeight]
663
- bloc.call({ width: width, height: height }) if bloc.is_a? Proc
669
+ # bloc.call({ width: width, height: height }) if bloc.is_a? Proc
670
+ proc_content = bloc.call({ width: width, height: height }) if event_validation(bloc)
671
+ if proc_content.instance_of? Hash
672
+ proc_content.each do |k, v|
673
+ @original_atome.send(k, v)
674
+ end
675
+ end
664
676
  end
677
+
678
+ # proc_content = @drag_move.call(event) if event_validation(@drag_move)
679
+ # if proc_content.instance_of? Hash
680
+ # proc_content.each do |k, v|
681
+ # @original_atome.send(k, v)
682
+ # end
683
+ # end
684
+ # puts event_handler.class
665
685
  JS.global[:window].addEventListener('resize', event_handler)
686
+ # JS.global[:window].addEventListener('resize', event_handler)
666
687
  else
667
688
  event_handler = ->(event) do
668
- bloc.call(event) if bloc.is_a? Proc
689
+ # bloc.call(event) if bloc.is_a? Proc
690
+ proc_content = bloc.call(event) if event_validation(bloc)
691
+ if proc_content.instance_of? Hash
692
+ proc_content.each do |k, v|
693
+ @original_atome.send(k, v)
694
+ end
695
+ end
669
696
  end
670
697
  @element.addEventListener(property, event_handler)
671
698
  end
@@ -680,7 +707,13 @@ class HTML
680
707
  # we use .call instead of instance_eval because instance_eval bring the current object as context
681
708
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
682
709
  # group etc..
683
- @keyboard_press.call(event) if @keyboard_press.is_a?(Proc)
710
+ # @keyboard_press.call(event) if @keyboard_press.is_a?(Proc)
711
+ proc_content = @keyboard_press.call(event) if event_validation(@keyboard_press)
712
+ if proc_content.instance_of? Hash
713
+ proc_content.each do |k, v|
714
+ @original_atome.send(k, v)
715
+ end
716
+ end
684
717
  end
685
718
  @element.addEventListener('keypress', keypress_handler)
686
719
  end
@@ -692,7 +725,13 @@ class HTML
692
725
  # we use .call instead of instance_eval because instance_eval bring the current object as context
693
726
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
694
727
  # group etc..
695
- @keyboard_down.call(event) if @keyboard_down.is_a?(Proc)
728
+ # @keyboard_down.call(event) if @keyboard_down.is_a?(Proc)
729
+ proc_content = @keyboard_down.call(event) if event_validation(@keyboard_down)
730
+ if proc_content.instance_of? Hash
731
+ proc_content.each do |k, v|
732
+ @original_atome.send(k, v)
733
+ end
734
+ end
696
735
  end
697
736
  @element.addEventListener('keydown', keypress_handler)
698
737
  end
@@ -704,7 +743,13 @@ class HTML
704
743
  # we use .call instead of instance_eval because instance_eval bring the current object as context
705
744
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
706
745
  # group etc..
707
- @keyboard_up.call(event) if @keyboard_up.is_a?(Proc)
746
+ # @keyboard_up.call(event) if @keyboard_up.is_a?(Proc)
747
+ proc_content = @keyboard_up.call(event) if event_validation(@keyboard_up)
748
+ if proc_content.instance_of? Hash
749
+ proc_content.each do |k, v|
750
+ @original_atome.send(k, v)
751
+ end
752
+ end
708
753
  end
709
754
  @element.addEventListener('keyup', keypress_handler)
710
755
  end
@@ -772,7 +817,13 @@ class HTML
772
817
  # we use .call instead of instance_eval because instance_eval bring the current object as context
773
818
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
774
819
  # group etc..
775
- @drag_start.call(event) if event_validation(@drag_start)
820
+ # @drag_start.call(event) if event_validation(@drag_start)
821
+ proc_content = @drag_start.call(event) if event_validation(@drag_start)
822
+ if proc_content.instance_of? Hash
823
+ proc_content.each do |k, v|
824
+ @original_atome.send(k, v)
825
+ end
826
+ end
776
827
  end
777
828
  end
778
829
 
@@ -784,7 +835,13 @@ class HTML
784
835
  # we use .call instead of instance_eval because instance_eval bring the current object as context
785
836
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
786
837
  # group etc..
787
- @drag_end.call(event) if event_validation(@drag_end)
838
+ # @drag_end.call(event) if event_validation(@drag_end)
839
+ proc_content = @drag_end.call(event) if event_validation(@drag_end)
840
+ if proc_content.instance_of? Hash
841
+ proc_content.each do |k, v|
842
+ @original_atome.send(k, v)
843
+ end
844
+ end
788
845
  end
789
846
  end
790
847
 
@@ -807,7 +864,13 @@ class HTML
807
864
  # we use .call instead of instance_eval because instance_eval bring the current object as context
808
865
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
809
866
  # group etc..
810
- @drag_move.call(event) if event_validation(@drag_move)
867
+ # @drag_move.call(event) if event_validation(@drag_move)
868
+ proc_content = @drag_move.call(event) if event_validation(@drag_move)
869
+ if proc_content.instance_of? Hash
870
+ proc_content.each do |k, v|
871
+ @original_atome.send(k, v)
872
+ end
873
+ end
811
874
  Universe.allow_tool_operations = false
812
875
  dx = event[:dx]
813
876
  dy = event[:dy]
@@ -871,7 +934,13 @@ class HTML
871
934
  # we use .call instead of instance_eval because instance_eval bring the current object as context
872
935
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
873
936
  # group etc..
874
- @drag_move.call(event) if event_validation(@drag_move)
937
+ # @drag_move.call(event) if event_validation(@drag_move)
938
+ proc_content = @drag_move.call(event) if event_validation(@drag_move)
939
+ if proc_content.instance_of? Hash
940
+ proc_content.each do |k, v|
941
+ @original_atome.send(k, v)
942
+ end
943
+ end
875
944
  dx = event[:dx]
876
945
  dy = event[:dy]
877
946
  x = (@original_atome.left || 0) + dx.to_f
@@ -898,7 +967,13 @@ class HTML
898
967
  # we use .call instead of instance_eval because instance_eval bring the current object as context
899
968
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
900
969
  # group etc..
901
- @drag_lock.call(event) if event_validation(@drag_lock)
970
+ # @drag_lock.call(event) if event_validation(@drag_lock)
971
+ proc_content = @drag_lock.call(event) if event_validation(@drag_lock)
972
+ if proc_content.instance_of? Hash
973
+ proc_content.each do |k, v|
974
+ @original_atome.send(k, v)
975
+ end
976
+ end
902
977
  end
903
978
  end
904
979
 
@@ -909,7 +984,13 @@ class HTML
909
984
  # we use .call instead of instance_eval because instance_eval bring the current object as context
910
985
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
911
986
  # group etc..
912
- bloc.call({ source: draggable_element, destination: dropzone_element }) if event_validation(bloc)
987
+ # bloc.call({ source: draggable_element, destination: dropzone_element }) if event_validation(bloc)
988
+ proc_content = bloc.call({ source: draggable_element, destination: dropzone_element }) if event_validation(bloc)
989
+ if proc_content.instance_of? Hash
990
+ proc_content.each do |k, v|
991
+ @original_atome.send(k, v)
992
+ end
993
+ end
913
994
  end
914
995
 
915
996
  def drop_activate(_option)
@@ -920,7 +1001,16 @@ class HTML
920
1001
  accept: nil, # Accept any element
921
1002
  overlap: 0.75,
922
1003
  ondropactivate: lambda do |native_event|
1004
+ event = Native(native_event)
1005
+
923
1006
  drop_action(native_event, @drop_activate) if event_validation(@drop_activate)
1007
+ # @drag_lock.call(event) if event_validation(@drag_lock)
1008
+ # proc_content = @drop_activate.call(event) if event_validation(@drop_activate)
1009
+ # if proc_content.instance_of? Hash
1010
+ # proc_content.each do |k, v|
1011
+ # @original_atome.send(k, v)
1012
+ # end
1013
+ # end
924
1014
  end
925
1015
  })
926
1016
  end
@@ -1030,7 +1120,14 @@ class HTML
1030
1120
  # we use .call instead of instance_eval because instance_eval bring the current object as context
1031
1121
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1032
1122
  # group etc..
1033
- @resize.call(event) if event_validation(@resize)
1123
+ # @resize.call(event) if event_validation(@resize)
1124
+ proc_content = @resize.call(event) if event_validation(@resize)
1125
+ if proc_content.instance_of? Hash
1126
+ proc_content.each do |k, v|
1127
+ @original_atome.send(k, v)
1128
+ end
1129
+ end
1130
+
1034
1131
  x = (@element[:offsetLeft].to_i || 0)
1035
1132
  y = (@element[:offsetTop].to_i || 0)
1036
1133
  width = event[:rect][:width]
@@ -1054,13 +1151,21 @@ class HTML
1054
1151
  def overflow(params, bloc)
1055
1152
  style(:overflow, params)
1056
1153
  @overflow = @original_atome.instance_variable_get('@overflow_code')[:overflow]
1057
- @element.addEventListener('scroll', lambda do |event|
1154
+ @element.addEventListener('scroll', lambda do |native_event|
1155
+ # event = Native(native_event)
1058
1156
  scroll_top = @element[:scrollTop].to_i
1059
1157
  scroll_left = @element[:scrollLeft].to_i
1060
1158
  # we use .call instead of instance_eval because instance_eval bring the current object as context
1061
1159
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1062
1160
  # group etc..
1063
1161
  @overflow.call({ left: scroll_left, top: scroll_top }) if event_validation(@overflow)
1162
+
1163
+ proc_content = @overflow.call({ left: scroll_left, top: scroll_top }) if event_validation(@overflow)
1164
+ if proc_content.instance_of? Hash
1165
+ proc_content.each do |k, v|
1166
+ @original_atome.send(k, v)
1167
+ end
1168
+ end
1064
1169
  end)
1065
1170
  end
1066
1171
 
@@ -1073,7 +1178,14 @@ class HTML
1073
1178
  # we use .call instead of instance_eval because instance_eval bring the current object as context
1074
1179
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1075
1180
  # group etc..
1076
- @over_over.call(event) if event_validation(@over_over)
1181
+ # @over_over.call(event) if event_validation(@over_over)
1182
+
1183
+ proc_content = @over_over.call(event) if event_validation(@over_over)
1184
+ if proc_content.instance_of? Hash
1185
+ proc_content.each do |k, v|
1186
+ @original_atome.send(k, v)
1187
+ end
1188
+ end
1077
1189
  end
1078
1190
  end
1079
1191
 
@@ -1085,7 +1197,13 @@ class HTML
1085
1197
  # we use .call instead of instance_eval because instance_eval bring the current object as context
1086
1198
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1087
1199
  # group etc..
1088
- @over_enter.call(event) if event_validation(@over_enter)
1200
+ # @over_enter.call(event) if event_validation(@over_enter)
1201
+ proc_content = @over_enter.call(event) if event_validation(@over_enter)
1202
+ if proc_content.instance_of? Hash
1203
+ proc_content.each do |k, v|
1204
+ @original_atome.send(k, v)
1205
+ end
1206
+ end
1089
1207
  end
1090
1208
  @element.addEventListener('mouseenter', @over_enter_callback)
1091
1209
 
@@ -1101,7 +1219,13 @@ class HTML
1101
1219
  # we use .call instead of instance_eval because instance_eval bring the current object as context
1102
1220
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1103
1221
  # group etc..
1104
- @over_leave.call(event) if event_validation(@over_leave)
1222
+ # @over_leave.call(event) if event_validation(@over_leave)
1223
+ proc_content = @over_leave.call(event) if event_validation(@over_leave)
1224
+ if proc_content.instance_of? Hash
1225
+ proc_content.each do |k, v|
1226
+ @original_atome.send(k, v)
1227
+ end
1228
+ end
1105
1229
  end
1106
1230
  @element.addEventListener('mouseleave', @over_leave_callback)
1107
1231
 
@@ -1148,7 +1272,13 @@ class HTML
1148
1272
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1149
1273
  # group etc..
1150
1274
  # @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)
1275
+ # @touch_down.call(event) if event_validation(@touch_down)
1276
+ proc_content = @touch_down.call(event) if event_validation(@touch_down)
1277
+ if proc_content.instance_of? Hash
1278
+ proc_content.each do |k, v|
1279
+ @original_atome.send(k, v)
1280
+ end
1281
+ end
1152
1282
  # end
1153
1283
  # end
1154
1284
  end
@@ -1168,14 +1298,14 @@ class HTML
1168
1298
  # @touch_up.call(event) if @touch_up.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
1169
1299
  # event = Native(native_event)
1170
1300
  # ########## old code :
1171
- @touch_tap.call(event) if event_validation(@touch_tap)
1301
+ # @touch_tap.call(event) if event_validation(@touch_tap)
1172
1302
  # ########## 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
1303
+ proc_content = @touch_tap.call(event) if event_validation(@touch_tap)
1304
+ if proc_content.instance_of? Hash
1305
+ proc_content.each do |k, v|
1306
+ @original_atome.send(k, v)
1307
+ end
1308
+ end
1179
1309
  end
1180
1310
  # end
1181
1311
  end
@@ -1191,7 +1321,13 @@ class HTML
1191
1321
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1192
1322
  # group etc..
1193
1323
  # @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)
1324
+ # @touch_up.call(event) if event_validation(@touch_up)
1325
+ proc_content = @touch_up.call(event) if event_validation(@touch_up)
1326
+ if proc_content.instance_of? Hash
1327
+ proc_content.each do |k, v|
1328
+ @original_atome.send(k, v)
1329
+ end
1330
+ end
1195
1331
  end
1196
1332
 
1197
1333
  # end
@@ -1208,8 +1344,13 @@ class HTML
1208
1344
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1209
1345
  # group etc..
1210
1346
  # @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)
1212
-
1347
+ # @touch_double.call(event) if event_validation(@touch_double)
1348
+ proc_content = @touch_double.call(event) if event_validation(@touch_double)
1349
+ if proc_content.instance_of? Hash
1350
+ proc_content.each do |k, v|
1351
+ @original_atome.send(k, v)
1352
+ end
1353
+ end
1213
1354
  # end
1214
1355
  end
1215
1356
 
@@ -1225,7 +1366,13 @@ class HTML
1225
1366
  # we use .call instead of instance_eval because instance_eval bring the current object as context
1226
1367
  # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1227
1368
  # group etc..
1228
- @touch_long.call(event) if event_validation(@touch_long)
1369
+ # @touch_long.call(event) if event_validation(@touch_long)
1370
+ proc_content = @touch_long.call(event) if event_validation(@touch_long)
1371
+ if proc_content.instance_of? Hash
1372
+ proc_content.each do |k, v|
1373
+ @original_atome.send(k, v)
1374
+ end
1375
+ end
1229
1376
  # @touch_long.call(event) if @touch_long.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
1230
1377
  # @touch_double.call(event) if event_validation(@touch_double)
1231
1378
 
@@ -1,11 +1,8 @@
1
1
  # frozen_string_literal: true
2
- new({ particle: :run }) do |params, code|
3
- code_found = @code_code[:code]
4
- instance_exec(params, &code_found) if code_found.is_a?(Proc)
5
- end
2
+
6
3
  a = box
7
4
  a.code(:hello) do
8
- circle({ left: 333 })
5
+ circle({ left: 333, color: :orange })
9
6
  end
10
7
  wait 1 do
11
8
  a.run(:hello)
@@ -8,4 +8,5 @@ initial_height=cc.height
8
8
  b.overflow(:scroll) do |event|
9
9
  new_height = initial_height + event[:top]
10
10
  cc.height(new_height)
11
+ {left: event[:top]}
11
12
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ b = box({ left: 333, color: :blue, smooth: 6, id: :the_box2 })
4
+
5
+
6
+
7
+ exec_code=lambda do
8
+
9
+ wait 1 do
10
+ b.color(:violet)
11
+ end
12
+
13
+ end
14
+
15
+ b.run(exec_code)
16
+
17
+
@@ -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
+
@@ -311,4 +311,11 @@ JS.eval("localStorage.clear();")
311
311
  # verif(val=33) do |var|
312
312
  # # puts left = '20' + var.to_s
313
313
  # {left: '20' + var.to_s, alert: 'hello! and big bisous!!'}
314
- # end
314
+ # end
315
+
316
+
317
+ b=box
318
+ b.touch({tap: true}) do
319
+ alert :hello
320
+ end
321
+
@@ -2,7 +2,7 @@
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
@@ -17,17 +17,19 @@ t.touch(:down) do |event|
17
17
  # b.touch(:remove) # or b.touch(false) to remove all touches bindings
18
18
  t.data('touch down killed')
19
19
  end
20
- b.touch(true) do
21
- puts :true
20
+
21
+ touch_code =lambda do
22
22
  b.color(:red)
23
23
  puts 'box tapped'
24
24
  # b.instance_variable_set('@touch_code', nil)
25
25
  end
26
+ b.touch(tap: true, code: touch_code)
26
27
 
27
28
  b.touch(:long) do
28
- puts :long
29
- t.data('type of touch is : long ')
30
- b.color(:black)
29
+ # puts :long
30
+ # t.data('type of touch is : long ')
31
+ # b.color(:black)
32
+ {color: :cyan}
31
33
  end
32
34
 
33
35
  b.touch(:up) do
@@ -48,3 +50,6 @@ b.touch(:double) do
48
50
  t.data('type of touch is : double ')
49
51
  b.color(:yellowgreen)
50
52
  end
53
+
54
+
55
+
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100" height="98" xml:space="preserve" id="canvas1">
4
+ <path id="canvas1-bezier2" stroke="rgb(205, 231, 182)" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" fill="none" d="M 10,24 L 10,85 70,85" />
5
+ <path id="canvas1-bezier" stroke="rgb(205, 231, 182)" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" fill="none" d="M -43,3.75 L -36,32.75 -4,42.75" transform="translate(44.37, 49.72) rotate(-169.32)" />
6
+ <circle id="canvas1-oval" stroke="rgb(106, 140, 201)" stroke-width="16" stroke-miterlimit="10" fill="none" cx="47.5" cy="46.5" r="16.5" />
7
+ </svg>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.7.3.1
4
+ version: 0.5.7.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean-Eric Godard
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-07 00:00:00.000000000 Z
11
+ date: 2024-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eventmachine
@@ -628,6 +628,7 @@ files:
628
628
  - vendor/assets/application/examples/repeat.rb
629
629
  - vendor/assets/application/examples/resize.rb
630
630
  - vendor/assets/application/examples/rotate.rb
631
+ - vendor/assets/application/examples/run.rb
631
632
  - vendor/assets/application/examples/security.rb
632
633
  - vendor/assets/application/examples/select_text.rb
633
634
  - vendor/assets/application/examples/selected.rb
@@ -646,6 +647,7 @@ files:
646
647
  - vendor/assets/application/examples/sync.rb
647
648
  - vendor/assets/application/examples/table.rb
648
649
  - vendor/assets/application/examples/tagged.rb
650
+ - vendor/assets/application/examples/target.rb
649
651
  - vendor/assets/application/examples/terminal.rb
650
652
  - vendor/assets/application/examples/test.rb
651
653
  - vendor/assets/application/examples/text.rb
@@ -850,6 +852,7 @@ files:
850
852
  - vendor/assets/src/medias/images/logos/X.svg
851
853
  - vendor/assets/src/medias/images/logos/YouTube.svg
852
854
  - vendor/assets/src/medias/images/logos/apple.svg
855
+ - vendor/assets/src/medias/images/logos/arp.svg
853
856
  - vendor/assets/src/medias/images/logos/atome.svg
854
857
  - vendor/assets/src/medias/images/logos/freebsd.png
855
858
  - vendor/assets/src/medias/images/logos/freebsd.svg