* @param text
*/
private void makeLabel(String text) {
if( text != null )
{
DragLabel label = new DragLabel(transformer,text,currentNode.path );
if( popupPosition != null )
{
label.setLocation(popupPosition.x,popupPosition.y);
}
else
{
FPoint p = null,
center = null,
dir = null;
if( currentNode.vennObject != null )
{
if (((VennPolygonObject)(currentNode.vennObject)).getPolygon() != null)
{
center = currentNode.vennObject.getOffset();
dir = center.sub(new FPoint(0.5,0.5));
dir = dir.multiply(1/(dir.distance(new FPoint(0,0))));
double circleRadius = Math.sqrt(((VennPolygonObject)currentNode.vennObject).getPolygon().area()/3.14);
dir = dir.multiply(circleRadius+.15);
p = center.add(dir);
//p = currentNode.vennObject.getOffset();
}
else return;
}
else
{
p = new FPoint(0.5,0.5);
}
label.setRelativePosition(p);
}
label.setVisible(true);
label.addMouseListener(this);
label.addMouseMotionListener(this);
add(label);
notifyHasLabelsChanged();
invalidateView();
repaint();
}