Method: Miyako::TextBox#attach_cursor

Defined in:
lib/Miyako/API/textbox.rb

#attach_cursor(x, y) ⇒ Object

マウスカーソルの位置とコマンドを照合する

選択肢・選択カーソルを、マウスカーソルが当たっているコマンドに移動させるどのコマンドにも当たっていない場合は、すべてのコマンドは非選択状態になる

x

マウスカーソルの位置(x軸方向)

y

マウスカーソルの位置(y軸方向)

返却値

自分自身を返す



586
587
588
589
590
591
592
593
594
595
596
597
598
599
# File 'lib/Miyako/API/textbox.rb', line 586

def attach_cursor(x, y)
  attach = @choices.attach(x, y)
  if attach
    if @select_cursor
      @select_cursor.snap(@choices.body)
      @select_cursor_position.call(@select_cursor, @choices.body)
    end
  else
    @choices.non_select if @pre_attach
    @select_cursor.snap(@choices.body) if @select_cursor
  end
  @pre_attach = attach
  return self
end