atome 0.5.7.1.8 → 0.5.7.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/atome/genesis/particles/event.rb +0 -2
- data/lib/atome/genesis/particles/material.rb +4 -0
- 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 +292 -147
- data/lib/molecules/intuition/utilities.rb +13 -10
- data/lib/renderers/html/html.rb +115 -112
- data/vendor/assets/application/examples/delete.rb +7 -2
- data/vendor/assets/application/examples/drag.rb +1 -3
- data/vendor/assets/application/examples/remove.rb +62 -52
- data/vendor/assets/application/examples/test.rb +135 -25
- data/vendor/assets/application/examples/touch.rb +6 -0
- data/vendor/assets/server/eDen.rb +19 -0
- data/vendor/assets/src/css/style.css +7 -0
- data/vendor/assets/src/js/third_parties/interact.min.js +3 -2
- metadata +3 -3
- /data/vendor/assets/application/examples/{scroll.rb → overflow.rb} +0 -0
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
|
|
@@ -1133,71 +1139,78 @@ class HTML
|
|
1133
1139
|
|
1134
1140
|
def touch_down(_option)
|
1135
1141
|
@element[:style][:cursor] = 'pointer'
|
1136
|
-
|
1137
1142
|
@touch_down = @original_atome.instance_variable_get('@touch_code')[:down]
|
1138
1143
|
interact = JS.eval("return interact('##{@id}')")
|
1139
|
-
unless @touch_removed[:down]
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
end
|
1144
|
+
# unless @touch_removed[:down]
|
1145
|
+
interact.on('down') do |native_event|
|
1146
|
+
event = Native(native_event)
|
1147
|
+
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
1148
|
+
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
1149
|
+
# group etc..
|
1150
|
+
# @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)
|
1152
|
+
# end
|
1153
|
+
# end
|
1150
1154
|
end
|
1151
1155
|
end
|
1152
1156
|
|
1153
1157
|
def touch_tap(_option)
|
1154
1158
|
@element[:style][:cursor] = 'pointer'
|
1155
1159
|
interact = JS.eval("return interact('##{@id}')")
|
1156
|
-
touch_tap = @original_atome.instance_variable_get('@touch_code')[:tap]
|
1160
|
+
@touch_tap = @original_atome.instance_variable_get('@touch_code')[:tap]
|
1157
1161
|
# unless @touch_removed[:tap]
|
1158
1162
|
interact.on('tap') do |native_event|
|
1163
|
+
|
1159
1164
|
event = Native(native_event)
|
1160
1165
|
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
1161
|
-
# and it's lead to a problem of context and force the use of grab(:view) when
|
1166
|
+
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
1162
1167
|
# group etc..
|
1163
|
-
# @
|
1164
|
-
|
1168
|
+
# @touch_up.call(event) if @touch_up.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
|
1169
|
+
# event = Native(native_event)
|
1170
|
+
# ########## old code :
|
1171
|
+
@touch_tap.call(event) if event_validation(@touch_tap)
|
1172
|
+
# ########## 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
|
1165
1179
|
end
|
1166
1180
|
# end
|
1167
|
-
|
1168
1181
|
end
|
1169
1182
|
|
1170
1183
|
def touch_up(_option)
|
1171
1184
|
@element[:style][:cursor] = 'pointer'
|
1172
1185
|
interact = JS.eval("return interact('##{@id}')")
|
1173
1186
|
@touch_up = @original_atome.instance_variable_get('@touch_code')[:up]
|
1174
|
-
unless @touch_removed[:up]
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
end
|
1183
|
-
|
1187
|
+
# unless @touch_removed[:up]
|
1188
|
+
interact.on('up') do |native_event|
|
1189
|
+
event = Native(native_event)
|
1190
|
+
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
1191
|
+
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
1192
|
+
# group etc..
|
1193
|
+
# @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)
|
1184
1195
|
end
|
1196
|
+
|
1197
|
+
# end
|
1185
1198
|
end
|
1186
1199
|
|
1187
1200
|
def touch_double(_option)
|
1188
1201
|
@element[:style][:cursor] = 'pointer'
|
1189
1202
|
interact = JS.eval("return interact('##{@id}')")
|
1190
1203
|
@touch_double = @original_atome.instance_variable_get('@touch_code')[:double]
|
1191
|
-
unless @touch_removed[:double]
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1204
|
+
# unless @touch_removed[:double]
|
1205
|
+
interact.on('doubletap') do |native_event|
|
1206
|
+
event = Native(native_event)
|
1207
|
+
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
1208
|
+
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
1209
|
+
# group etc..
|
1210
|
+
# @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)
|
1199
1212
|
|
1200
|
-
end
|
1213
|
+
# end
|
1201
1214
|
end
|
1202
1215
|
|
1203
1216
|
end
|
@@ -1206,18 +1219,18 @@ class HTML
|
|
1206
1219
|
@element[:style][:cursor] = 'pointer'
|
1207
1220
|
@touch_long = @original_atome.instance_variable_get('@touch_code')[:long]
|
1208
1221
|
interact = JS.eval("return interact('##{@id}')")
|
1209
|
-
unless @touch_removed[:long]
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1222
|
+
# unless @touch_removed[:long]
|
1223
|
+
interact.on('hold') do |native_event|
|
1224
|
+
event = Native(native_event)
|
1225
|
+
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
1226
|
+
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
1227
|
+
# group etc..
|
1228
|
+
@touch_long.call(event) if event_validation(@touch_long)
|
1229
|
+
# @touch_long.call(event) if @touch_long.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
|
1230
|
+
# @touch_double.call(event) if event_validation(@touch_double)
|
1218
1231
|
|
1219
|
-
end
|
1220
1232
|
end
|
1233
|
+
# end
|
1221
1234
|
end
|
1222
1235
|
|
1223
1236
|
def touch_remove(option)
|
@@ -1235,27 +1248,20 @@ class HTML
|
|
1235
1248
|
when :tap
|
1236
1249
|
@touch_removed[:tap] = true
|
1237
1250
|
@touch_tap = ''
|
1251
|
+
@touch_removed[:touch] = true
|
1252
|
+
@touch_touch = ''
|
1253
|
+
when :touch
|
1254
|
+
@touch_removed[:tap] = true
|
1255
|
+
@touch_tap = ''
|
1256
|
+
@touch_removed[:touch] = true
|
1257
|
+
@touch_touch = ''
|
1238
1258
|
when :up
|
1239
1259
|
@touch_removed[:up] = true
|
1240
1260
|
@touch_up = ''
|
1241
1261
|
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
1262
|
# interact = JS.eval("return interact('##{@id}')")
|
1258
1263
|
# interact.unset
|
1264
|
+
@original_atome.instance_variable_set('@touch_code', nil)
|
1259
1265
|
end
|
1260
1266
|
|
1261
1267
|
end
|
@@ -1303,14 +1309,13 @@ class HTML
|
|
1303
1309
|
end
|
1304
1310
|
end
|
1305
1311
|
|
1306
|
-
|
1307
1312
|
# animation below
|
1308
1313
|
def animate(animation_properties)
|
1309
|
-
prop= animation_properties[:particle]
|
1310
|
-
command = <<~JS
|
1314
|
+
prop = animation_properties[:particle]
|
1315
|
+
command = <<~JS
|
1311
1316
|
var target_div = document.getElementById('#{@id}');
|
1312
1317
|
window.currentAnimation = popmotion.animate({
|
1313
|
-
from: #{animation_properties[
|
1318
|
+
from: #{animation_properties[:from]},
|
1314
1319
|
to: #{animation_properties[:to]},
|
1315
1320
|
duration: #{animation_properties[:duration]},
|
1316
1321
|
onUpdate: function(v) {
|
@@ -1326,8 +1331,6 @@ class HTML
|
|
1326
1331
|
JS.eval(command)
|
1327
1332
|
end
|
1328
1333
|
|
1329
|
-
|
1330
|
-
|
1331
1334
|
def stop_animation
|
1332
1335
|
JS.eval('if (window.currentAnimation) window.currentAnimation.stop();')
|
1333
1336
|
end
|
@@ -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(
|
27
|
-
|
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
|
|
@@ -1,60 +1,70 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
b = box({ top: 166
|
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.
|
38
|
-
|
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
|
-
|
46
|
-
b.remove({all: :color})
|
47
|
-
puts "after => #{b.apply}"
|
10
|
+
# alert b.color
|
48
11
|
wait 1 do
|
49
|
-
|
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
|
+
#
|