Sha256: 81ed2f2e72afd01b55a009f0bc7e51bed5fa0aafd2ac51c0d1a94d05a9b509c2

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 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(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

3 entries across 3 versions & 1 rubygems

Version Path
atome-0.5.7.5.4 vendor/assets/application/examples/touch.rb
atome-0.5.7.5.3 vendor/assets/application/examples/touch.rb
atome-0.5.7.5.1 vendor/assets/application/examples/touch.rb