Sha256: 03e940c9843d5b2dec6024f0aa90239fc3bfd7e40c5e081e90b2633dfed6fd9d
Contents?: true
Size: 1.05 KB
Versions: 10
Compression:
Stored size: 1.05 KB
Contents
# frozen_string_literal: true b = box({ left: 333, color: :blue, smooth: 6, id: :the_box2 }) t = text({ id: :the_text, data: 'type of touch : ?' }) t.touch(:down) do |event| puts :down puts event[:pageX] puts event[:pageY] b.touch({remove: :down}) # b.touch({remove: :up}) # b.touch({remove: :long}) # b.touch({remove: :double}) # b.touch({remove: :tap}) # b.touch({remove: :touch}) # b.touch(:remove) # or b.touch(false) to remove all touches bindings t.data('touch down killed') end touch_code =lambda do b.color(:red) puts 'box tapped' # b.instance_variable_set('@touch_code', nil) end b.touch(tap: true, code: touch_code) b.touch(:long) do # puts :long # t.data('type of touch is : long ') # b.color(:black) {color: :cyan} end b.touch(:up) do puts :up t.data('type of touch is : up ') b.color(:orange) end b.touch(:down) do puts :down t.data('type of touch is : down ') b.color(:white) end b.touch(:double) do puts :double t.color(:red) t.data('type of touch is : double ') b.color(:yellowgreen) end
Version data entries
10 entries across 10 versions & 1 rubygems