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.
@@ -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
 
@@ -1139,70 +1263,95 @@ class HTML
1139
1263
 
1140
1264
  def touch_down(_option)
1141
1265
  @element[:style][:cursor] = 'pointer'
1142
-
1143
1266
  @touch_down = @original_atome.instance_variable_get('@touch_code')[:down]
1144
1267
  interact = JS.eval("return interact('##{@id}')")
1145
- unless @touch_removed[:down]
1146
- interact.on('down') do |native_event|
1147
- event = Native(native_event)
1148
- # we use .call instead of instance_eval because instance_eval bring the current object as context
1149
- # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1150
- # group etc..
1151
- # @touch_down.call(event) if @touch_down.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
1152
- @touch_down.call(event) if event_validation(@touch_down)
1153
- # end
1268
+ # unless @touch_removed[:down]
1269
+ interact.on('down') do |native_event|
1270
+ event = Native(native_event)
1271
+ # we use .call instead of instance_eval because instance_eval bring the current object as context
1272
+ # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1273
+ # group etc..
1274
+ # @touch_down.call(event) if @touch_down.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
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
1154
1281
  end
1282
+ # end
1283
+ # end
1155
1284
  end
1156
1285
  end
1157
1286
 
1158
1287
  def touch_tap(_option)
1159
1288
  @element[:style][:cursor] = 'pointer'
1160
1289
  interact = JS.eval("return interact('##{@id}')")
1161
- touch_tap = @original_atome.instance_variable_get('@touch_code')[:tap]
1290
+ @touch_tap = @original_atome.instance_variable_get('@touch_code')[:tap]
1162
1291
  # unless @touch_removed[:tap]
1163
1292
  interact.on('tap') do |native_event|
1293
+
1164
1294
  event = Native(native_event)
1165
1295
  # we use .call instead of instance_eval because instance_eval bring the current object as context
1166
- # and it's lead to a problem of context and force the use of grab(:view) when using atome method such as shape ,
1296
+ # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1167
1297
  # group etc..
1168
- # @touch_tap.call(event) if @touch_tap.is_a?(Proc) && !Universe.edit_mode || !@original_atome.tag[:system]
1169
- touch_tap.call(event) if event_validation(touch_tap)
1298
+ # @touch_up.call(event) if @touch_up.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
1299
+ # event = Native(native_event)
1300
+ # ########## old code :
1301
+ # @touch_tap.call(event) if event_validation(@touch_tap)
1302
+ # ########## new code:
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
1170
1309
  end
1171
1310
  # end
1172
-
1173
1311
  end
1174
1312
 
1175
1313
  def touch_up(_option)
1176
1314
  @element[:style][:cursor] = 'pointer'
1177
1315
  interact = JS.eval("return interact('##{@id}')")
1178
1316
  @touch_up = @original_atome.instance_variable_get('@touch_code')[:up]
1179
- unless @touch_removed[:up]
1180
- interact.on('up') do |native_event|
1181
- event = Native(native_event)
1182
- # we use .call instead of instance_eval because instance_eval bring the current object as context
1183
- # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1184
- # group etc..
1185
- # @touch_up.call(event) if @touch_up.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
1186
- @touch_up.call(event) if event_validation(@touch_up)
1317
+ # unless @touch_removed[:up]
1318
+ interact.on('up') do |native_event|
1319
+ event = Native(native_event)
1320
+ # we use .call instead of instance_eval because instance_eval bring the current object as context
1321
+ # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1322
+ # group etc..
1323
+ # @touch_up.call(event) if @touch_up.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
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
1187
1330
  end
1188
-
1189
1331
  end
1332
+
1333
+ # end
1190
1334
  end
1191
1335
 
1192
1336
  def touch_double(_option)
1193
1337
  @element[:style][:cursor] = 'pointer'
1194
1338
  interact = JS.eval("return interact('##{@id}')")
1195
1339
  @touch_double = @original_atome.instance_variable_get('@touch_code')[:double]
1196
- unless @touch_removed[:double]
1197
- interact.on('doubletap') do |native_event|
1198
- event = Native(native_event)
1199
- # we use .call instead of instance_eval because instance_eval bring the current object as context
1200
- # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1201
- # group etc..
1202
- # @touch_double.call(event) if @touch_double.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
1203
- @touch_double.call(event) if event_validation(@touch_double)
1204
-
1340
+ # unless @touch_removed[:double]
1341
+ interact.on('doubletap') do |native_event|
1342
+ event = Native(native_event)
1343
+ # we use .call instead of instance_eval because instance_eval bring the current object as context
1344
+ # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1345
+ # group etc..
1346
+ # @touch_double.call(event) if @touch_double.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
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
1205
1353
  end
1354
+ # end
1206
1355
  end
1207
1356
 
1208
1357
  end
@@ -1211,18 +1360,24 @@ class HTML
1211
1360
  @element[:style][:cursor] = 'pointer'
1212
1361
  @touch_long = @original_atome.instance_variable_get('@touch_code')[:long]
1213
1362
  interact = JS.eval("return interact('##{@id}')")
1214
- unless @touch_removed[:long]
1215
- interact.on('hold') do |native_event|
1216
- event = Native(native_event)
1217
- # we use .call instead of instance_eval because instance_eval bring the current object as context
1218
- # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1219
- # group etc..
1220
- @touch_long.call(event) if event_validation(@touch_long)
1221
- # @touch_long.call(event) if @touch_long.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
1222
- # @touch_double.call(event) if event_validation(@touch_double)
1223
-
1363
+ # unless @touch_removed[:long]
1364
+ interact.on('hold') do |native_event|
1365
+ event = Native(native_event)
1366
+ # we use .call instead of instance_eval because instance_eval bring the current object as context
1367
+ # and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
1368
+ # group etc..
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
1224
1375
  end
1376
+ # @touch_long.call(event) if @touch_long.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
1377
+ # @touch_double.call(event) if event_validation(@touch_double)
1378
+
1225
1379
  end
1380
+ # end
1226
1381
  end
1227
1382
 
1228
1383
  def touch_remove(option)
@@ -1240,6 +1395,13 @@ class HTML
1240
1395
  when :tap
1241
1396
  @touch_removed[:tap] = true
1242
1397
  @touch_tap = ''
1398
+ @touch_removed[:touch] = true
1399
+ @touch_touch = ''
1400
+ when :touch
1401
+ @touch_removed[:tap] = true
1402
+ @touch_tap = ''
1403
+ @touch_removed[:touch] = true
1404
+ @touch_touch = ''
1243
1405
  when :up
1244
1406
  @touch_removed[:up] = true
1245
1407
  @touch_up = ''
@@ -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)
@@ -4,6 +4,7 @@ b = box()
4
4
  b.text('click me')
5
5
  orange=''
6
6
  b.touch(true) do
7
+
7
8
  c = grab(:view).circle({id: :circling, left: 222, color: :orange, blur: 1.9 })
8
9
  orange=c.box({id: :boxing,color: {id: :orange_col, red: 1, blue: 0.2 }, width: 33, height: 33, left: 123})
9
10
  orange.shadow({
@@ -23,10 +24,14 @@ b.touch(true) do
23
24
  end
24
25
  end
25
26
 
26
- c.touch(true) do
27
- c.delete({ recursive: true })
27
+ c.touch(:down) do
28
+ puts '1?'
29
+ grab(:circling).delete({ recursive: true }) if grab(:circling)
28
30
  end
29
31
  # alert orange.apply
32
+ wait 4 do
33
+ grab(:circling).delete({ recursive: true })if grab(:circling)
34
+ end
30
35
  end
31
36
 
32
37
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  a=box({width: 666, height: 777, color: :orange})
3
4
  b = box({ left: 666, color: :blue, smooth: 6, id: :the_box2, depth: 1 , top: 66})
4
5
  cc=circle({color: :red, left: 0, top: 0})
@@ -16,8 +17,6 @@ b.drag(:stop) do
16
17
  clone.delete(true)
17
18
  end
18
19
 
19
-
20
-
21
20
  b.drag(:locked) do |event|
22
21
  dx = event[:dx]
23
22
  dy = event[:dy]
@@ -29,7 +28,6 @@ b.drag(:locked) do |event|
29
28
  puts "y: #{y}"
30
29
  end
31
30
  cc.drag({ restrict: {max:{ left: 240, top: 190}} }) do |event|
32
-
33
31
  end
34
32
 
35
33
 
@@ -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
@@ -1,60 +1,70 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- b = box({ top: 166 , id: :the_box, left: 333})
4
- b.color({id: :new_col, red: 1})
5
- b.color({id: :other_col, green: 1})
6
- # b.paint({gradient: [:other_col, :new_col]})
7
- color({id: :last_col, green: 0.3, blue: 0.5})
8
- color({id: :last_col2, red: 1, blue: 0.5})
3
+ b = box({ top: 166, id: :the_box, left: 333 })
4
+ b.color({ id: :new_col, red: 1 })
9
5
 
10
- b.shadow({
11
- id: :s1,
12
- # affect: [:the_circle],
13
- left: 9, top: 3, blur: 9,
14
- invert: false,
15
- red: 0, green: 0, blue: 0, alpha: 1
16
- })
17
-
18
-
19
- wait 1 do
20
- b.remove(:other_col)
21
- wait 1 do
22
- b.remove(:new_col)
23
- wait 1 do
24
- b.remove(:box_color)
25
-
26
- wait 1 do
27
- b.apply(:last_col)
28
- wait 1 do
29
- b.apply(:last_col2)
30
- b.remove(:s1)
31
- end
32
- end
33
- end
34
- end
35
- end
36
6
  b.touch(true) do
37
- b.shadow({
38
- id: :s1,
39
- # affect: [:the_circle],
40
- left: 9, top: 3, blur: 9,
41
- invert: false,
42
- red: 0, green: 0, blue: 0, alpha: 1
43
- })
7
+ # alert b.color
8
+ b.remove(:box_color)
44
9
 
45
- puts "before => #{b.apply}"
46
- b.remove({all: :color})
47
- puts "after => #{b.apply}"
10
+ # alert b.color
48
11
  wait 1 do
49
- b.paint({id: :the_gradient_1,gradient: [:box_color, :circle_color]})
50
- b.paint({id: :the_gradient,gradient: [:other_col, :new_col]})
51
- wait 1 do
52
- b.remove(:the_gradient)
53
- wait 1 do
54
- b.remove(all: :shadow)
55
- b.color(:cyan)
56
- end
57
- end
12
+ grab('box_color').red(1)
58
13
  end
59
14
  end
60
-
15
+ # b.color({id: :other_col, green: 1})
16
+ # # b.paint({gradient: [:other_col, :new_col]})
17
+ # color({id: :last_col, green: 0.3, blue: 0.5})
18
+ # color({id: :last_col2, red: 1, blue: 0.5})
19
+ #
20
+ # b.shadow({
21
+ # id: :s1,
22
+ # # affect: [:the_circle],
23
+ # left: 9, top: 3, blur: 9,
24
+ # invert: false,
25
+ # red: 0, green: 0, blue: 0, alpha: 1
26
+ # })
27
+ #
28
+ #
29
+ # wait 1 do
30
+ # b.remove(:other_col)
31
+ # wait 1 do
32
+ # b.remove(:new_col)
33
+ # wait 1 do
34
+ # b.remove(:box_color)
35
+ #
36
+ # wait 1 do
37
+ # b.apply(:last_col)
38
+ # wait 1 do
39
+ # b.apply(:last_col2)
40
+ # b.remove(:s1)
41
+ # end
42
+ # end
43
+ # end
44
+ # end
45
+ # end
46
+ # b.touch(true) do
47
+ # b.shadow({
48
+ # id: :s1,
49
+ # # affect: [:the_circle],
50
+ # left: 9, top: 3, blur: 9,
51
+ # invert: false,
52
+ # red: 0, green: 0, blue: 0, alpha: 1
53
+ # })
54
+ #
55
+ # puts "before => #{b.apply}"
56
+ # b.remove({all: :color})
57
+ # puts "after => #{b.apply}"
58
+ # wait 1 do
59
+ # b.paint({id: :the_gradient_1,gradient: [:box_color, :circle_color]})
60
+ # b.paint({id: :the_gradient,gradient: [:other_col, :new_col]})
61
+ # wait 1 do
62
+ # b.remove(:the_gradient)
63
+ # wait 1 do
64
+ # b.remove(all: :shadow)
65
+ # b.color(:cyan)
66
+ # end
67
+ # end
68
+ # end
69
+ # end
70
+ #
@@ -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
+