Class: ShortestTreeMouseListener

Inherits:
Object
  • Object
show all
Includes:
AppMouseListener
Defined in:
lib/app/simple_controller.rb

Instance Method Summary collapse

Methods included from AppMouseListener

#mouseClicked, #mouseEntered, #mouseExited

Constructor Details

#initialize(controller) ⇒ ShortestTreeMouseListener

Returns a new instance of ShortestTreeMouseListener.



450
451
452
# File 'lib/app/simple_controller.rb', line 450

def initialize(controller)
  @controller = controller
end

Instance Method Details

#mousePressed(event) ⇒ Object



454
455
456
457
# File 'lib/app/simple_controller.rb', line 454

def mousePressed(event)
  @node = @controller.model.get_nearest_node(event.x, event.y)
  @controller.model.click(@node)
end

#mouseReleased(event) ⇒ Object



459
460
461
462
463
464
465
# File 'lib/app/simple_controller.rb', line 459

def mouseReleased(event)
  if @node
    @controller.model.unclick(@node)
    @controller.model.dspt(@node)
  end
  @controller.view.remove_mouse_listener(self)
end