Sha256: 8b9cdc58559ac88e84143227319d1c45662ca697b23b9c33585a71d5525e4a9d

Contents?: true

Size: 660 Bytes

Versions: 1

Compression:

Stored size: 660 Bytes

Contents

Shoes.app do

  def center_x(length)
    width/2 - length/ 2
  end

  def center_text_on(text, rectangle)
    new_left = rectangle.left + rectangle.width / 2 - 55 / 2
    new_top = rectangle.top + rectangle.height / 2 - 35 / 2
    text.move new_left, new_top
    puts "new_left: #{new_left}, new_top: #{new_top}"
  end

  button 'boom' do
    clear
    s = stack width: width do
      background red
      dsl_length = 400
      dsl_top = 300
      rect_height = 100
      dsl_rect = rect center_x(dsl_length), dsl_top, dsl_length, rect_height, fill: green
      dsl_text = para 'DSL'
      center_text_on dsl_text, dsl_rect
    end
    puts s.width
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shoes-4.0.0.pre2 samples/present.rb