Class: Doodl::TooltipMouseListener

Inherits:
MouseMotionAdapter
  • Object
show all
Defined in:
lib/jruby/renderer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#elementObject (readonly)

Returns the value of attribute element.



389
390
391
# File 'lib/jruby/renderer.rb', line 389

def element
  @element
end

#positionObject (readonly)

Returns the value of attribute position.



389
390
391
# File 'lib/jruby/renderer.rb', line 389

def position
  @position
end

Instance Method Details

#mouseMoved(event) ⇒ Object



391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
# File 'lib/jruby/renderer.rb', line 391

def mouseMoved(event)
  result = event.getSource.node_shapes.select { |tupel| tupel[1].contains(event.getPoint)}.first
  if result == nil
    result = event.getSource.edge_shapes.select { |tupel| tupel[1].ptLineDist(event.getPoint) < 5.0 }.first
  end
  if result
    if @element != result[0]
      @element = result[0]
      @position = event.getPoint
      event.getSource.repaint
    end
  else
    if @element
      @element = nil
      @position = nil
      event.getSource.repaint
    end
  end
end