Sha256: 9f9679a8578cd0e99062676338a314ed8c23f7da7ddd5e6dff8aed120c0729e1

Contents?: true

Size: 993 Bytes

Versions: 2

Compression:

Stored size: 993 Bytes

Contents

# fit example

b = box({ size: 96 })
b.image({ content: :boat, size: :fit })
b.touch do
  clear(:view)
end
b2 = box({ x: 333 })
t = b2.text({ content: "hit the red or orange circle", visual: :Impact })
# t.edit(true)
t.width(96)

c0 = circle({ size: 33, x: 96, color: :yellowgreen })
c = circle({ size: 33, x: 120 })
c2 = circle({ size: 33, x: 150, color: :orange })

c0.touch do
  t.visual({ fit: :width })
  b2.size({ fit: t.atome_id })
  t.center(true)
end
c.touch do
  t.visual({ fit: :width })
  b2.size({ fit: t.atome_id, margin: { x: 33, y: 33 } })
  t.center(true)
end

c2.touch do
  t.visual({ fit: :width })
  b2.size({ fit: t.atome_id, margin: 66 })
  t.center(true)
end


# text fit box size

tt=text ({ content: "Super", x: 333, y: 120 } )
tt.border(({ color: :green, thickness: 3, pattern: :solid }))
bb=box({x:333, y: 333, width: 333, height: 150})
bb.text("touch me to make the upper text fit my size")
bb.touch do
  tt.size({ fit: bb.atome_id})
  tt.visual({fit: :width})
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
atome-0.4.7.0 vendor/assets/build/medias/rubies/examples/Old_examples/fit.rb
atome-0.4.5.4 vendor/assets/build/medias/rubies/examples/Old_examples/fit.rb