Sha256: aab5e89611a33a75e156b0f78fe00992267c4da42bcb28f87b83bffc81b4c465

Contents?: true

Size: 1 KB

Versions: 21

Compression:

Stored size: 1 KB

Contents

#  frozen_string_literal: true
a=box({width: 666, height: 777, color: :orange})
b = box({ left: 666, color: :blue, smooth: 6, id: :the_box2, depth: 1 })
cc=circle({color: :red, left: 0, top: 0})
clone = ""
b.drag(:start) do
  b.color(:black)
  b.height(123)
  # beware you must use grab(:view) else it'll be attached to the context, that means to 'b' in this case
  clone = grab(:view).circle({ id: "#{b.id}_cloned",color: :white, left: b.left, top: b.top, depth: 3 })
end

b.drag(:stop) do
  b.color(:purple)
  b.height=b.height+100
  clone.delete(true)
end



b.drag(:locked) do |event|
  dx = event[:dx]
  dy = event[:dy]
  x = (clone.left || 0) + dx.to_f
  y = (clone.top || 0) + dy.to_f
  clone.left(x)
  clone.top(y)
  puts "x: #{x}"
  puts "y: #{y}"
end
cc.drag({ restrict: {max:{ left: 240, top: 190}} }) do |event|

end


c=circle

c.drag({ restrict: a.id }) do |event|

end

t=text({data: 'touch me to unbind drag stop for b (clone will not deleted anymore)', left: 250 })
t.touch(true) do
  b.drag({remove: :stop})
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
atome-0.5.6.1.4 vendor/assets/application/examples/drag.rb
atome-0.5.6.1.1 vendor/assets/application/examples/drag.rb
atome-0.5.6.1.0 vendor/assets/application/examples/drag.rb
atome-0.5.6.0.4 vendor/assets/application/examples/drag.rb
atome-0.5.6.0.3 vendor/assets/application/examples/drag.rb
atome-0.5.6.0.2 vendor/assets/application/examples/drag.rb
atome-0.5.5.9.1 vendor/assets/application/examples/drag.rb
atome-0.5.5.8.7 vendor/assets/application/examples/drag.rb
atome-0.5.5.8.5 vendor/assets/application/examples/drag.rb
atome-0.5.5.8.1 vendor/assets/application/examples/drag.rb
atome-0.5.5.7.7 vendor/assets/application/examples/drag.rb
atome-0.5.5.7.5 vendor/assets/application/examples/drag.rb
atome-0.5.5.7.3 vendor/assets/application/examples/drag.rb
atome-0.5.5.7.1 vendor/assets/application/examples/drag.rb
atome-0.5.5.7.0 vendor/assets/application/examples/drag.rb
atome-0.5.5.6.9 vendor/assets/application/examples/drag.rb
atome-0.5.5.6.8 vendor/assets/application/examples/drag.rb
atome-0.5.5.6.7.9 vendor/assets/application/examples/drag.rb
atome-0.5.5.6.6 vendor/assets/application/examples/drag.rb
atome-0.5.5.6.5 vendor/assets/application/examples/drag.rb