Module: Shoes::Mod2

Included in:
App
Defined in:
lib/shoes/helper_methods.rb

Instance Method Summary collapse

Instance Method Details

#init_app_varsObject



38
39
40
41
42
43
44
# File 'lib/shoes/helper_methods.rb', line 38

def init_app_vars
  @contents, @mccs, @mrcs, @mmcs, @mhcs, @mlcs, @shcs, @mcs, @order, @dics, @animates, @radio_groups, @textcursors, @textmarkers, @fronts, @backs, @focusables, @pinning_elements = 
    [], [], [], [], [], [], [], [], [], [], [], {}, {}, {}, [], [], [], []
  @cmask, @focus_ele, @location = nil, nil, '/'
  @mouse_button, @mouse_pos = 0, [0, 0]
  @fill, @stroke = black, black
end

#set_rotate_angle(args) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/shoes/helper_methods.rb', line 46

def set_rotate_angle args
  @context_angle2 = Math::PI/2 - @context_angle
  m = args[:height] * Math.sin(@context_angle)
  w = args[:width] * Math.sin(@context_angle2) + m
  h = args[:width] * Math.sin(@context_angle) + args[:height] * Math.sin(@context_angle2)
  mx, my = m * Math.sin(@context_angle2), m * Math.sin(@context_angle)
  if @pixbuf_rotate.even?
    args[:left] += (args[:width] - w)/2.0
    args[:top] -= (h - args[:height])/2.0
  else
    args[:left] -= (h - args[:width])/2.0
    args[:top] += (args[:height] - w)/2.0
  end
  return w, h, mx, my
end