Method: MiniGL::TextField#set_position

Defined in:
lib/minigl/forms.rb

#set_position(x, y) ⇒ Object

Sets the position of the text field in the screen.

Parameters:

x

The new x-coordinate for the text field.

y

The new y-coordinate for the text field.



922
923
924
925
926
927
928
929
930
931
# File 'lib/minigl/forms.rb', line 922

def set_position(x, y)
  d_x = x - @x
  d_y = y - @y
  @x = x; @y = y
  @text_x += d_x
  @text_y += d_y
  @nodes.map! do |n|
    n + d_x
  end
end