atome 0.5.6.8.7 → 0.5.7.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/documentation/basic.md +7 -8
- data/documentation/deep learning/basic_infos.txt +6 -6
- data/documentation/installation/atome_server.md +66 -1
- data/documentation/installation/buiding_atome.md +307 -0
- data/lib/atome/atome.rb +2 -3
- data/lib/atome/extensions/atome.rb +38 -12
- data/lib/atome/genesis/atomes.rb +1 -1
- data/lib/atome/genesis/genesis.rb +11 -11
- data/lib/atome/genesis/particles/event.rb +58 -50
- data/lib/atome/genesis/particles/identity.rb +3 -0
- data/lib/atome/genesis/particles/property.rb +2 -1
- data/lib/atome/genesis/particles/utility.rb +19 -12
- data/lib/atome/genesis/presets.rb +10 -0
- data/lib/atome/genesis/sparkle.rb +11 -9
- data/lib/atome/kernel/universe.rb +22 -11
- data/lib/atome/presets/atome.rb +20 -17
- data/lib/atome/utilities/essentials.rb +5 -5
- data/lib/atome/utilities/utilities.rb +168 -15
- data/lib/atome/version.rb +1 -1
- data/lib/atome.rb +1 -0
- data/lib/atome_relative.rb +1 -0
- data/lib/molecules/init.rb +22 -42
- data/lib/molecules/intuition/_deprecated_inputs.rb +111 -0
- data/lib/molecules/intuition/utillities.rb +105 -11
- data/lib/renderers/html/event.rb +20 -4
- data/lib/renderers/html/html.rb +145 -161
- data/lib/renderers/html/identity.rb +10 -2
- data/lib/renderers/html/utility.rb +64 -8
- data/vendor/assets/application/examples/b64_to_image.rb +9 -0
- data/vendor/assets/application/examples/drag.rb +9 -2
- data/vendor/assets/application/examples/matrix.rb +77 -114
- data/vendor/assets/application/examples/recorder.rb +74 -0
- data/vendor/assets/application/examples/site.rb +41 -0
- data/vendor/assets/application/examples/sub_atome_manipulation.rb +0 -2
- data/vendor/assets/application/examples/svg_img_to_vector.rb +6 -0
- data/vendor/assets/application/examples/svg_vectorizer.rb +21 -0
- data/vendor/assets/application/examples/table.rb +1 -1
- data/vendor/assets/application/examples/test.rb +572 -0
- data/vendor/assets/application/examples/tools.rb +650 -304
- data/vendor/assets/application/examples/vector.rb +16 -3
- data/vendor/assets/server/atome_server.rb +3 -2
- data/vendor/assets/server/atome_server_wasm.rb +2 -2
- data/vendor/assets/server/eDen.rb +135 -14
- data/vendor/assets/src/index.html +1 -1
- data/vendor/assets/src/index_opal.html +1 -1
- data/vendor/assets/src/index_server.html +1 -1
- data/vendor/assets/src/index_server_wasm.html +1 -1
- data/vendor/assets/src/index_wasm.html +1 -1
- data/vendor/assets/src/js/atome/atome.js +250 -49
- data/vendor/assets/src/js/atome/atome_helpers/communication.js +4 -4
- data/vendor/assets/src/js/atome/specific/opal.js +19 -3
- data/vendor/assets/src/js/atome/specific/wasm.js +18 -3
- data/vendor/assets/src/js/molecules/web.js +1 -1
- data/vendor/assets/src/medias/images/icons/Lowpass.svg +8 -0
- data/vendor/assets/src/medias/images/icons/activate.svg +3 -0
- data/vendor/assets/src/medias/images/icons/audio.svg +7 -0
- data/vendor/assets/src/medias/images/icons/band_pass.svg +8 -0
- data/vendor/assets/src/medias/images/icons/clear.svg +5 -0
- data/vendor/assets/src/medias/images/icons/color.svg +5 -0
- data/vendor/assets/src/medias/images/icons/copy.svg +8 -0
- data/vendor/assets/src/medias/images/icons/create.svg +3 -0
- data/vendor/assets/src/medias/images/icons/delete.svg +8 -0
- data/vendor/assets/src/medias/images/icons/edit-.svg +4 -0
- data/vendor/assets/src/medias/images/icons/edit.svg +4 -0
- data/vendor/assets/src/medias/images/icons/edition.svg +4 -0
- data/vendor/assets/src/medias/images/icons/equalizer-.svg +5 -0
- data/vendor/assets/src/medias/images/icons/equalizer.svg +5 -0
- data/vendor/assets/src/medias/images/icons/filter.svg +4 -0
- data/vendor/assets/src/medias/images/icons/folder.svg +4 -0
- data/vendor/assets/src/medias/images/icons/group.svg +6 -0
- data/vendor/assets/src/medias/images/icons/hamburger.svg +8 -0
- data/vendor/assets/src/medias/images/icons/high_pass.svg +5 -0
- data/vendor/assets/src/medias/images/icons/link.svg +4 -0
- data/vendor/assets/src/medias/images/icons/load.svg +4 -0
- data/vendor/assets/src/medias/images/icons/low_pass.svg +5 -0
- data/vendor/assets/src/medias/images/icons/microphone.svg +7 -0
- data/vendor/assets/src/medias/images/icons/midi_in.svg +4 -0
- data/vendor/assets/src/medias/images/icons/midi_out.svg +4 -0
- data/vendor/assets/src/medias/images/icons/modules.svg +11 -0
- data/vendor/assets/src/medias/images/icons/paste.svg +4 -0
- data/vendor/assets/src/medias/images/icons/pause.svg +5 -0
- data/vendor/assets/src/medias/images/icons/play.svg +7 -0
- data/vendor/assets/src/medias/images/icons/record.svg +4 -0
- data/vendor/assets/src/medias/images/icons/save.svg +5 -0
- data/vendor/assets/src/medias/images/icons/select--.svg +4 -0
- data/vendor/assets/src/medias/images/icons/select-.svg +5 -0
- data/vendor/assets/src/medias/images/icons/select-all.svg +4 -0
- data/vendor/assets/src/medias/images/icons/select.svg +4 -0
- data/vendor/assets/src/medias/images/icons/settings.svg +5 -0
- data/vendor/assets/src/medias/images/icons/settings0.svg +2 -0
- data/vendor/assets/src/medias/images/icons/settings1.svg +17 -0
- data/vendor/assets/src/medias/images/icons/settings2.svg +25 -0
- data/vendor/assets/src/medias/images/icons/settings_old.svg +6 -0
- data/vendor/assets/src/medias/images/icons/shape.svg +7 -0
- data/vendor/assets/src/medias/images/icons/speaker.svg +6 -0
- data/vendor/assets/src/medias/images/icons/stop.svg +4 -0
- data/vendor/assets/src/medias/images/icons/tool.svg +7 -0
- data/vendor/assets/src/medias/images/icons/tools.svg +9 -0
- data/vendor/assets/src/medias/images/icons/undo2.svg +4 -0
- data/vendor/assets/src/medias/images/icons/validate.svg +9 -0
- data/vendor/assets/src/medias/images/icons/vie.svg +3 -0
- data/vendor/assets/src/medias/images/icons/wave-saw.svg +3 -0
- data/vendor/assets/src/medias/images/icons/wave-sine.svg +3 -0
- data/vendor/assets/src/medias/images/icons/wave-square-.svg +4 -0
- data/vendor/assets/src/medias/images/icons/wave-square.svg +3 -0
- data/vendor/assets/src/medias/images/icons/wave-triangle.svg +3 -0
- data/vendor/assets/src/medias/images/icons/waveform-.svg +4 -0
- data/vendor/assets/src/medias/images/icons/waveform.svg +7 -0
- metadata +68 -6
- data/lib/molecules/intuition/inputs.rb +0 -111
- /data/lib/molecules/{examples → _deprecated_examples}/site.rb +0 -0
- /data/lib/molecules/intuition/{toolbox.rb → _deprecated_toolbox.rb} +0 -0
data/lib/renderers/html/html.rb
CHANGED
@@ -302,10 +302,7 @@ class HTML
|
|
302
302
|
# editable_pres_array = Array.new(editable_pres[:length].to_i) { |i| editable_pres.call(:item, i) }
|
303
303
|
# editable_pres_array.each do |pre|
|
304
304
|
# pre.addEventListener('click') do
|
305
|
-
# # Focus sur l'élément pour activer le curseur
|
306
305
|
# pre.focus()
|
307
|
-
# alert :ok
|
308
|
-
# # Optionnel : Ajoutez du style pour rendre le curseur plus visible
|
309
306
|
# pre[:style][:caretColor] = 'blue' # Changez la couleur du curseur en bleu
|
310
307
|
# end
|
311
308
|
# end
|
@@ -400,15 +397,20 @@ class HTML
|
|
400
397
|
self
|
401
398
|
end
|
402
399
|
|
403
|
-
def svg_data(
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
400
|
+
def svg_data(all_datas)
|
401
|
+
# we remove previous datas
|
402
|
+
# @element.innerHTML = ''
|
403
|
+
all_datas.each do |full_data|
|
404
|
+
full_data.each do |type_passed, datas|
|
405
|
+
|
406
|
+
svg_ns = 'http://www.w3.org/2000/svg'
|
407
|
+
new_path = JS.global[:document].createElementNS(svg_ns.to_s, type_passed.to_s)
|
408
|
+
JS.global[:document][:body].appendChild(new_path)
|
409
|
+
datas.each do |property, value|
|
410
|
+
new_path.setAttribute(property.to_s, value.to_s)
|
411
|
+
end
|
412
|
+
@element.appendChild(new_path)
|
410
413
|
end
|
411
|
-
@element.appendChild(new_path)
|
412
414
|
end
|
413
415
|
end
|
414
416
|
|
@@ -704,11 +706,18 @@ class HTML
|
|
704
706
|
end
|
705
707
|
|
706
708
|
def drag_remove(option)
|
709
|
+
|
710
|
+
interact = JS.eval("return interact('##{@id}')")
|
711
|
+
|
707
712
|
case option
|
708
713
|
when :start
|
709
714
|
@drag_start = ''
|
710
715
|
when :end, :stop
|
711
716
|
@drag_end = ''
|
717
|
+
when :move
|
718
|
+
interact.draggable(false)
|
719
|
+
interact.unset
|
720
|
+
@drag_move = nil
|
712
721
|
when :locked
|
713
722
|
@drag_locked = ''
|
714
723
|
when :restrict
|
@@ -719,6 +728,9 @@ class HTML
|
|
719
728
|
@drag_end = ''
|
720
729
|
@drag_locked = ''
|
721
730
|
@drag_restrict = ''
|
731
|
+
@drag_move = nil
|
732
|
+
interact.draggable(false)
|
733
|
+
interact.unset
|
722
734
|
end
|
723
735
|
|
724
736
|
end
|
@@ -748,7 +760,10 @@ class HTML
|
|
748
760
|
end
|
749
761
|
|
750
762
|
def drag_move(_option)
|
763
|
+
|
751
764
|
interact = JS.eval("return interact('##{@id}')")
|
765
|
+
# interact.draggable(false)
|
766
|
+
|
752
767
|
interact.draggable({
|
753
768
|
drag: true,
|
754
769
|
inertia: { resistance: 12,
|
@@ -764,7 +779,7 @@ class HTML
|
|
764
779
|
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
765
780
|
# group etc..
|
766
781
|
@drag_move.call(event) if @drag_move.is_a?(Proc)
|
767
|
-
|
782
|
+
Universe.allow_tool_operations = false
|
768
783
|
dx = event[:dx]
|
769
784
|
dy = event[:dy]
|
770
785
|
x = (@original_atome.left || 0) + dx.to_f
|
@@ -946,8 +961,8 @@ class HTML
|
|
946
961
|
@drop_leave = ''
|
947
962
|
else
|
948
963
|
# to remove all interact event ( touch, drag, scale, ... uncomment below)
|
949
|
-
|
950
|
-
|
964
|
+
interact = JS.eval("return interact('##{@id}')")
|
965
|
+
interact.unset
|
951
966
|
@drop_activate = ''
|
952
967
|
@drop_deactivate = ''
|
953
968
|
@drop_dropped = ''
|
@@ -975,25 +990,26 @@ class HTML
|
|
975
990
|
modifiers: [],
|
976
991
|
listeners: {
|
977
992
|
move: lambda do |native_event|
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
993
|
+
Universe.allow_tool_operations = false
|
994
|
+
# if @resize.is_a?(Proc)
|
995
|
+
event = Native(native_event)
|
996
|
+
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
997
|
+
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
998
|
+
# group etc..
|
999
|
+
@resize.call(event) if @resize.is_a?(Proc)
|
1000
|
+
x = (@element[:offsetLeft].to_i || 0)
|
1001
|
+
y = (@element[:offsetTop].to_i || 0)
|
1002
|
+
width = event[:rect][:width]
|
1003
|
+
height = event[:rect][:height]
|
1004
|
+
# Translate when resizing from any corner
|
1005
|
+
x += event[:deltaRect][:left].to_f
|
1006
|
+
y += event[:deltaRect][:top].to_f
|
1007
|
+
@original_atome.width width.to_i if width.to_i.between?(min_width, max_width)
|
1008
|
+
@original_atome.height height.to_i if height.to_i.between?(min_height, max_height)
|
1009
|
+
@original_atome.left(x)
|
1010
|
+
@original_atome.top(y)
|
996
1011
|
end
|
1012
|
+
# end
|
997
1013
|
},
|
998
1014
|
|
999
1015
|
})
|
@@ -1082,82 +1098,103 @@ class HTML
|
|
1082
1098
|
end
|
1083
1099
|
end
|
1084
1100
|
|
1085
|
-
def
|
1101
|
+
def event_validation(action_proc)
|
1102
|
+
action_proc.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
|
1103
|
+
end
|
1104
|
+
|
1105
|
+
def touch_down(_option)
|
1106
|
+
@element[:style][:cursor] = 'pointer'
|
1107
|
+
|
1108
|
+
@touch_down = @original_atome.instance_variable_get('@touch_code')[:down]
|
1086
1109
|
interact = JS.eval("return interact('##{@id}')")
|
1087
|
-
|
1088
|
-
|
1089
|
-
interact.on('tap') do |native_event|
|
1110
|
+
unless @touch_removed[:down]
|
1111
|
+
interact.on('down') do |native_event|
|
1090
1112
|
event = Native(native_event)
|
1091
1113
|
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
1092
1114
|
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
1093
1115
|
# group etc..
|
1094
|
-
|
1116
|
+
# unless Universe.edit_mode == true
|
1117
|
+
# @touch_down.call(event) if @touch_down.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
|
1118
|
+
@touch_down.call(event) if event_validation(@touch_down)
|
1119
|
+
# end
|
1095
1120
|
end
|
1096
1121
|
end
|
1097
|
-
|
1098
1122
|
end
|
1099
1123
|
|
1100
|
-
def
|
1124
|
+
def touch_tap(_option)
|
1125
|
+
# alert :touch_tap
|
1126
|
+
@element[:style][:cursor] = 'pointer'
|
1101
1127
|
interact = JS.eval("return interact('##{@id}')")
|
1102
|
-
|
1103
|
-
unless @touch_removed[:
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1128
|
+
touch_tap = @original_atome.instance_variable_get('@touch_code')[:tap]
|
1129
|
+
# unless @touch_removed[:tap]
|
1130
|
+
interact.on('tap') do |native_event|
|
1131
|
+
# alert 'touchy'
|
1132
|
+
event = Native(native_event)
|
1133
|
+
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
1134
|
+
# and it's lead to a problem of context and force the use of grab(:view) when using atome method such as shape ,
|
1135
|
+
# group etc..
|
1136
|
+
# @touch_tap.call(event) if @touch_tap.is_a?(Proc) && !Universe.edit_mode || !@original_atome.tag[:system]
|
1137
|
+
touch_tap.call(event) if event_validation(touch_tap)
|
1111
1138
|
end
|
1139
|
+
# end
|
1112
1140
|
|
1113
1141
|
end
|
1114
1142
|
|
1115
|
-
def
|
1116
|
-
@
|
1143
|
+
def touch_up(_option)
|
1144
|
+
@element[:style][:cursor] = 'pointer'
|
1117
1145
|
interact = JS.eval("return interact('##{@id}')")
|
1118
|
-
|
1119
|
-
|
1146
|
+
@touch_up = @original_atome.instance_variable_get('@touch_code')[:up]
|
1147
|
+
unless @touch_removed[:up]
|
1148
|
+
interact.on('up') do |native_event|
|
1120
1149
|
event = Native(native_event)
|
1121
1150
|
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
1122
1151
|
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
1123
1152
|
# group etc..
|
1124
|
-
@
|
1153
|
+
# @touch_up.call(event) if @touch_up.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
|
1154
|
+
@touch_up.call(event) if event_validation(@touch_up)
|
1125
1155
|
end
|
1126
|
-
end
|
1127
1156
|
|
1157
|
+
end
|
1128
1158
|
end
|
1129
1159
|
|
1130
|
-
def
|
1131
|
-
@
|
1160
|
+
def touch_double(_option)
|
1161
|
+
@element[:style][:cursor] = 'pointer'
|
1132
1162
|
interact = JS.eval("return interact('##{@id}')")
|
1133
|
-
|
1134
|
-
|
1163
|
+
@touch_double = @original_atome.instance_variable_get('@touch_code')[:double]
|
1164
|
+
unless @touch_removed[:double]
|
1165
|
+
interact.on('doubletap') do |native_event|
|
1135
1166
|
event = Native(native_event)
|
1136
1167
|
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
1137
1168
|
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
1138
1169
|
# group etc..
|
1139
|
-
@
|
1140
|
-
|
1170
|
+
# @touch_double.call(event) if @touch_double.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
|
1171
|
+
@touch_double.call(event) if event_validation(@touch_double)
|
1141
1172
|
|
1173
|
+
end
|
1142
1174
|
end
|
1175
|
+
|
1143
1176
|
end
|
1144
1177
|
|
1145
|
-
def
|
1178
|
+
def touch_long(_option)
|
1179
|
+
@element[:style][:cursor] = 'pointer'
|
1180
|
+
@touch_long = @original_atome.instance_variable_get('@touch_code')[:long]
|
1146
1181
|
interact = JS.eval("return interact('##{@id}')")
|
1147
|
-
|
1148
|
-
|
1149
|
-
interact.on('up') do |native_event|
|
1182
|
+
unless @touch_removed[:long]
|
1183
|
+
interact.on('hold') do |native_event|
|
1150
1184
|
event = Native(native_event)
|
1151
1185
|
# we use .call instead of instance_eval because instance_eval bring the current object as context
|
1152
1186
|
# and it's lead to a problem of context and force the use of grab(:view) when suing atome method such as shape ,
|
1153
1187
|
# group etc..
|
1154
|
-
@
|
1155
|
-
|
1188
|
+
@touch_long.call(event) if event_validation(@touch_long)
|
1189
|
+
# @touch_long.call(event) if @touch_long.is_a?(Proc) && (!Universe.edit_mode || @original_atome.tag[:system])
|
1190
|
+
# @touch_double.call(event) if event_validation(@touch_double)
|
1156
1191
|
|
1192
|
+
end
|
1157
1193
|
end
|
1158
1194
|
end
|
1159
1195
|
|
1160
1196
|
def touch_remove(option)
|
1197
|
+
@element[:style][:cursor] = 'default'
|
1161
1198
|
case option
|
1162
1199
|
when :double
|
1163
1200
|
@touch_double = ''
|
@@ -1175,16 +1212,20 @@ class HTML
|
|
1175
1212
|
@touch_removed[:up] = true
|
1176
1213
|
@touch_up = ''
|
1177
1214
|
else
|
1178
|
-
|
1179
|
-
|
1180
|
-
@
|
1181
|
-
@
|
1182
|
-
@touch_removed[:
|
1183
|
-
@
|
1184
|
-
@
|
1185
|
-
@
|
1186
|
-
@
|
1187
|
-
@
|
1215
|
+
interact = JS.eval("return interact('##{@id}')")
|
1216
|
+
interact.unset
|
1217
|
+
# @original_atome.instance_variable_set('@touch_code')
|
1218
|
+
@original_atome.instance_variable_set('@touch_code', nil)
|
1219
|
+
# @touch_removed[:double] = true
|
1220
|
+
# @touch_removed[:down] = true
|
1221
|
+
# @touch_removed[:long] = true
|
1222
|
+
# @touch_removed[:tap] = true
|
1223
|
+
# @touch_removed[:up] = true
|
1224
|
+
# @touch_double = ''
|
1225
|
+
# @touch_down = ''
|
1226
|
+
# @touch_long = ''
|
1227
|
+
# @touch_tap = ''
|
1228
|
+
# @touch_up = ''
|
1188
1229
|
# to remove all interact event ( touch, drag, scale, ... uncomment below)
|
1189
1230
|
# interact = JS.eval("return interact('##{@id}')")
|
1190
1231
|
# interact.unset
|
@@ -1244,12 +1285,12 @@ class HTML
|
|
1244
1285
|
to: #{animation_properties[:to]},
|
1245
1286
|
duration: #{animation_properties[:duration]},
|
1246
1287
|
onUpdate: function(v) {
|
1247
|
-
|
1248
|
-
|
1288
|
+
atomeJsToRuby("puts x= "+v)
|
1289
|
+
atomeJsToRuby("grab('#{@id}').left("+v+")")
|
1249
1290
|
},
|
1250
1291
|
onComplete: function() {
|
1251
1292
|
window.currentAnimation = null;
|
1252
|
-
|
1293
|
+
atomeJsToRuby("puts :complete")
|
1253
1294
|
}
|
1254
1295
|
});
|
1255
1296
|
JS
|
@@ -1549,63 +1590,14 @@ class HTML
|
|
1549
1590
|
style("filter", 'none')
|
1550
1591
|
@original_atome.apply(@original_atome.apply)
|
1551
1592
|
end
|
1552
|
-
|
1553
|
-
# reset_background
|
1554
|
-
# style(:background, '')
|
1555
|
-
# style(:background, 'black')
|
1556
|
-
# @original_atome.color(:red)
|
1557
|
-
# @original_atome.apply(@original_atome.color[0])
|
1593
|
+
|
1558
1594
|
end
|
1559
1595
|
|
1560
1596
|
def table_remove(params)
|
1561
1597
|
if params[:row]
|
1562
|
-
# row_index = params[:row]
|
1563
|
-
# table_element = JS.global[:document].querySelector("##{@id} table")
|
1564
|
-
#
|
1565
|
-
# if table_element.nil?
|
1566
|
-
# puts 'Table not found'
|
1567
|
-
# return
|
1568
|
-
# end
|
1569
|
-
#
|
1570
|
-
# rows = table_element.querySelectorAll('tbody tr').to_a
|
1571
|
-
#
|
1572
|
-
# if row_index >= rows.length
|
1573
|
-
# puts "row not found : #{row_index}"
|
1574
|
-
# return
|
1575
|
-
# end
|
1576
|
-
# row_to_remove = rows[row_index]
|
1577
|
-
#
|
1578
|
-
# row_to_remove[:parentNode].removeChild(row_to_remove)
|
1579
|
-
#
|
1580
|
-
# rows.each_with_index do |row, i|
|
1581
|
-
# next if i <= row_index
|
1582
|
-
# end
|
1583
1598
|
elsif params[:column]
|
1584
|
-
|
1585
|
-
|
1586
|
-
#
|
1587
|
-
# if table_element.nil?
|
1588
|
-
# puts 'Table not found'
|
1589
|
-
# return
|
1590
|
-
# end
|
1591
|
-
#
|
1592
|
-
# rows = table_element.querySelectorAll('tbody tr').to_a
|
1593
|
-
# rows.each do |row|
|
1594
|
-
# cells = row.querySelectorAll('td').to_a
|
1595
|
-
# if column_index < cells.length
|
1596
|
-
# cell_to_remove = cells[column_index]
|
1597
|
-
# cell_to_remove[:parentNode].removeChild(cell_to_remove)
|
1598
|
-
# end
|
1599
|
-
# end
|
1600
|
-
|
1601
|
-
end
|
1602
|
-
end
|
1603
|
-
|
1604
|
-
# def reset_background
|
1605
|
-
# style(:background, 'black')
|
1606
|
-
# style('box-shadow', 'none')
|
1607
|
-
# style('text-shadow', 'none')
|
1608
|
-
# end
|
1599
|
+
end
|
1600
|
+
end
|
1609
1601
|
|
1610
1602
|
# atomisation!
|
1611
1603
|
def atomized(html_object)
|
@@ -1613,35 +1605,6 @@ class HTML
|
|
1613
1605
|
@element = html_object
|
1614
1606
|
end
|
1615
1607
|
|
1616
|
-
# def center(options, attach)
|
1617
|
-
# parent = grab(attach)
|
1618
|
-
#
|
1619
|
-
# # Centre sur l'axe X
|
1620
|
-
# if options[:x]
|
1621
|
-
# x_position = calculate_position(options[:x], parent.to_px(:width), @original_atome.to_px(:width))
|
1622
|
-
# @original_atome.left(x_position)
|
1623
|
-
# end
|
1624
|
-
#
|
1625
|
-
# # Centre sur l'axe Y
|
1626
|
-
# if options[:y]
|
1627
|
-
# y_position = calculate_position(options[:y], parent.to_px(:height), @original_atome.to_px(:height))
|
1628
|
-
# @original_atome.top(y_position)
|
1629
|
-
# end
|
1630
|
-
# end
|
1631
|
-
#
|
1632
|
-
# # Méthode auxiliaire pour calculer la position
|
1633
|
-
# def calculate_position(option, parent_dimension, self_dimension)
|
1634
|
-
# if option.is_a?(String) && option.end_with?('%')
|
1635
|
-
# percent = option.chop.to_f / 100.0
|
1636
|
-
# (parent_dimension - self_dimension) * percent
|
1637
|
-
# elsif option == 0
|
1638
|
-
# # Cas spécial pour centrer l'objet
|
1639
|
-
# (parent_dimension - self_dimension) / 2.0
|
1640
|
-
# else
|
1641
|
-
# option
|
1642
|
-
# end
|
1643
|
-
# end
|
1644
|
-
|
1645
1608
|
def center(options, attach)
|
1646
1609
|
@center_options = options
|
1647
1610
|
|
@@ -1657,10 +1620,31 @@ class HTML
|
|
1657
1620
|
end
|
1658
1621
|
end
|
1659
1622
|
|
1623
|
+
def record_audio(params)
|
1624
|
+
duration = params[:duration] * 1000
|
1625
|
+
name = params[:name]
|
1626
|
+
JS.eval("recordAudio(#{duration},'#{@id}', '#{name}')")
|
1627
|
+
end
|
1628
|
+
|
1629
|
+
def record_video(params)
|
1630
|
+
duration = params[:duration] * 1000
|
1631
|
+
name = params[:name]
|
1632
|
+
JS.eval("recordVideo(#{duration},'#{@id}', '#{name}')")
|
1633
|
+
end
|
1634
|
+
def stop_video_preview(id)
|
1635
|
+
JS.eval("stopPreview('#{id}')")
|
1636
|
+
end
|
1637
|
+
def video_preview(id, video, audio)
|
1638
|
+
JS.eval("create_preview('#{id}','#{video}','#{audio}')")
|
1639
|
+
end
|
1640
|
+
|
1641
|
+
def stop_media_recorder(id)
|
1642
|
+
JS.eval("writeatomestore('#{id}', 'record', 'stop')")
|
1643
|
+
end
|
1644
|
+
|
1660
1645
|
private
|
1661
1646
|
|
1662
1647
|
def apply_centering(options, parent)
|
1663
|
-
# Centre sur l'axe X
|
1664
1648
|
if options[:x]
|
1665
1649
|
x_position = calculate_position(options[:x], parent.to_px(:width), @original_atome.to_px(:width))
|
1666
1650
|
@original_atome.left(x_position)
|
@@ -51,6 +51,9 @@ new({ method: :data, type: :string, specific: :text, renderer: :html }) do |para
|
|
51
51
|
end
|
52
52
|
|
53
53
|
new({ method: :data, type: :string, specific: :vector, renderer: :html }) do |value|
|
54
|
+
unless value.instance_of? Array
|
55
|
+
value=[value]
|
56
|
+
end
|
54
57
|
html.svg_data(value)
|
55
58
|
end
|
56
59
|
|
@@ -87,10 +90,15 @@ new({ renderer: :html, method: :category, type: :symbol }) do |category_names|
|
|
87
90
|
end
|
88
91
|
end
|
89
92
|
|
90
|
-
new({ method: :data, type: :string, specific: :
|
93
|
+
new({ method: :data, type: :string, specific: :table, renderer: :html }) do |value, _user_proc|
|
91
94
|
html.table(value)
|
92
95
|
end
|
93
96
|
|
94
97
|
new({ method: :type, type: :hash, specific: :atomized, renderer: :html }) do |value, _user_proc|
|
95
|
-
html.atomized(
|
98
|
+
html.atomized(value)
|
99
|
+
end
|
100
|
+
|
101
|
+
|
102
|
+
new({ renderer: :html, method: :selected, specific: :text }) do |value, &bloc|
|
103
|
+
html.select_text(value)
|
96
104
|
end
|
@@ -26,8 +26,7 @@ new({ renderer: :html, method: :terminal, type: :string }) do |value, &bloc|
|
|
26
26
|
html.terminal(id, value)
|
27
27
|
end
|
28
28
|
|
29
|
-
|
30
|
-
new({renderer: :html, method: :match}) do |params, bloc|
|
29
|
+
new({ renderer: :html, method: :match }) do |params, bloc|
|
31
30
|
case id
|
32
31
|
when :atome || :view
|
33
32
|
result = bloc.call
|
@@ -37,7 +36,6 @@ new({renderer: :html, method: :match}) do |params, bloc|
|
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
40
|
-
|
41
39
|
new({ renderer: :html, method: :import, type: :blob }) do |_params, bloc|
|
42
40
|
|
43
41
|
if Atome::host == 'web-opal'
|
@@ -75,6 +73,7 @@ new({ renderer: :html, method: :import, type: :blob }) do |_params, bloc|
|
|
75
73
|
end
|
76
74
|
div_element.appendChild(input_element)
|
77
75
|
end
|
76
|
+
|
78
77
|
create_file_browser(:options) do |file_content|
|
79
78
|
# puts "wasm ===>#{file_content}"
|
80
79
|
bloc.call(file_content)
|
@@ -83,11 +82,6 @@ new({ renderer: :html, method: :import, type: :blob }) do |_params, bloc|
|
|
83
82
|
|
84
83
|
end
|
85
84
|
|
86
|
-
|
87
|
-
new({ renderer: :html, method: :selected, specific: :text }) do |value, &bloc|
|
88
|
-
html.select_text(value)
|
89
|
-
end
|
90
|
-
|
91
85
|
new({ method: :compute, type: :hash, renderer: :html }) do |params|
|
92
86
|
element = JS.global[:document].getElementById(@id.to_s)
|
93
87
|
bounding_box = element.getBoundingClientRect()
|
@@ -111,4 +105,66 @@ new({ method: :compute, type: :hash, renderer: :html }) do |params|
|
|
111
105
|
@compute[:value] = value_found
|
112
106
|
end
|
113
107
|
|
108
|
+
new({ renderer: :html, method: :preview }) do |params, user_proc|
|
109
|
+
if params[:id]
|
110
|
+
id_f = params[:id]
|
111
|
+
else
|
112
|
+
id_f = identity_generator
|
113
|
+
end
|
114
|
+
if params[:stop]
|
115
|
+
html.stop_video_preview(id_f)
|
116
|
+
else
|
117
|
+
|
118
|
+
if params[:media] == :video
|
119
|
+
html.video_preview(id_f, true, false)
|
120
|
+
elsif params[:media] == :audio
|
121
|
+
html.video_preview(id_f, false, true)
|
122
|
+
elsif params[:media] == :all
|
123
|
+
html.video_preview(id_f, true, true)
|
124
|
+
else
|
125
|
+
html.video_preview(id_f, true, true)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
new({ renderer: :html, method: :record }) do |params, user_proc|
|
131
|
+
duration = params[:duration] ||= 1000000
|
132
|
+
media = params[:media] ||= :video
|
133
|
+
mode = params[:mode] ||= :web # web or native
|
134
|
+
name = params[:name] ||= :record
|
135
|
+
path = params[:path] ||= './'
|
136
|
+
data = params[:data] ||= {}
|
137
|
+
stop = params[:stop]
|
138
|
+
if stop
|
139
|
+
if @video_recorder_type == :web || @audio_recorder_type == :web
|
140
|
+
html.stop_media_recorder(id)
|
141
|
+
elsif @video_recorder_type == :native || @audio_recorder_type == :native
|
142
|
+
A.message({ action: :stop_recording, data: params })
|
143
|
+
end
|
144
|
+
|
145
|
+
elsif media == :video
|
146
|
+
type = params[:type] ||= :mp4
|
147
|
+
if mode == :native
|
148
|
+
@video_recorder_type = :native
|
149
|
+
A.message({ action: :record, data: { type: type, duration: duration, name: name, path: path, media: media, data: data } }) do |result|
|
150
|
+
user_proc.call(result)
|
151
|
+
end
|
152
|
+
else
|
153
|
+
@video_recorder_type = :web
|
154
|
+
html.record_video(params)
|
155
|
+
end
|
156
|
+
|
157
|
+
elsif media == :audio
|
158
|
+
type = params[:type] ||= :wav
|
159
|
+
if mode == :native
|
160
|
+
@audio_recorder_type = :native
|
161
|
+
A.message({ action: :record, data: { type: type, duration: duration, name: name, path: path, media: media, data: data } }) do |result|
|
162
|
+
user_proc.call(result)
|
163
|
+
end
|
164
|
+
else
|
165
|
+
@audio_recorder_type = :web
|
166
|
+
html.record_audio(params)
|
167
|
+
end
|
168
|
+
end
|
114
169
|
|
170
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
image({ id: :logo })
|
4
|
+
def_2 = "M 536.75,-0.25 C 536.75,-0.25 536.75,-0.08 536.75,0.25 536.75,25.82 536.75,1023.75 536.75,1023.75 536.75,1024.08 536.75,1024.25 536.75,1024.25 L 486.75,1024.25 C 486.75,1024.25 486.75,1024.08 486.75,1023.75 486.75,998.18 486.75,0.25 486.75,0.25 486.75,0.24 486.75,-0.2 486.75,-0.2 L 536.75,-0.25 536.75,-0.25 Z M 536.75,-0.25"
|
5
|
+
vector({ id: :my_svg, top: 33, left: 99, data: { path: { d: def_2, id: :p2, stroke: :red, 'stroke-width' => 3, fill: :green } } })
|
6
|
+
|
7
|
+
wait 1 do
|
8
|
+
grab(:view).b64_to_tag({ id: 'my_svg', target: :logo })
|
9
|
+
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
a=box({width: 666, height: 777, color: :orange})
|
3
|
-
b = box({ left: 666, color: :blue, smooth: 6, id: :the_box2, depth: 1 })
|
3
|
+
b = box({ left: 666, color: :blue, smooth: 6, id: :the_box2, depth: 1 , top: 66})
|
4
4
|
cc=circle({color: :red, left: 0, top: 0})
|
5
5
|
clone = ""
|
6
6
|
b.drag(:start) do
|
7
7
|
b.color(:black)
|
8
8
|
b.height(123)
|
9
9
|
# beware you must use grab(:view) else it'll be attached to the context, that means to 'b' in this case
|
10
|
-
clone = grab(:view).circle({
|
10
|
+
clone = grab(:view).circle({ color: :white, left: b.left, top: b.top, depth: 3 })
|
11
11
|
end
|
12
12
|
|
13
13
|
b.drag(:stop) do
|
@@ -44,4 +44,11 @@ t.touch(true) do
|
|
44
44
|
b.drag({remove: :stop})
|
45
45
|
end
|
46
46
|
|
47
|
+
tt= text({data: "remove drag on circles", top: 99})
|
48
|
+
|
49
|
+
tt.touch(true) do
|
50
|
+
cc.drag(false)
|
51
|
+
c.drag(false)
|
52
|
+
end
|
53
|
+
|
47
54
|
|