package smart_gs.drawing_tool.action;

import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import smart_gs.drawing_tool.ImageLabel;
import smart_gs.drawing_tool.SpreadCanvas;
import smart_gs.logical.AnchorTextSegment;
import smart_gs.logical.Region;
import smart_gs.logical.region.AnchorRegion;
import smart_gs.swingui.WorkspaceWindow;

public class AnchorJumpAction implements ActionListener {

	private AnchorTextSegment segment;
	
	public AnchorJumpAction(AnchorTextSegment segment) {
		this.segment = segment;	
	}
	
	@Override
	public void actionPerformed(ActionEvent arg0) {
		Point point = this.segment.getAnchorRegion().getCenterPoint();
		SpreadCanvas canvas = WorkspaceWindow.getInstance().getSpreadCanvas();
//		canvas.imageLabel.showImage();
		canvas.imageLabel.moveTo(point);
		canvas.selectRegion(segment.getAnchorRegion());

	}

}
