package jp.ac.kyutech.mns.ist;

import java.awt.Color;
import java.awt.Shape;

import edu.umd.cs.piccolo.nodes.PPath;

public class FocusSrc extends PPath {
	private static final long serialVersionUID = 6509898129322742212L;

	FocusRectangle fr;
	Sheet sheet;
	FocusFrame fframe;
	Note note;
	Color bgcolor = null;
	public FocusSrc(Shape sp, FocusRectangle _fr, FocusFrame _ff, Note _n){
		super(sp);
		fr = _fr;
		sheet = fr.sheet;
		fframe = _ff;
		note = _n;
		setStroke(Note.getCachedBasicStroke(2f));
		setTransparency(0.5f);
//		setPaint(Color.green);

//		setPickable(true);
		
		//シート上でのマウス操作
		addInputEventListener(new Event_onFS(this));

	}
	public Sheet getSheet(){
		return sheet;
	}
	public Note getNote(){
		return note;
	}
	public void setColor(Color c){
		bgcolor = c;
	}
	public void isHover(boolean b){
		if (b) {
			if (bgcolor == null) setPaint(Color.yellow);
			else setPaint(bgcolor);
			setTransparency(0.3f);
		}
		else {
			setTransparency(0.5f);
			setPaint(bgcolor);
		}
		sheet.isshowImage(b);
	}
	public void focus() {
		sheet.canvas.getCamera().animateViewToCenterBounds(getGlobalBounds(), true, 1000);
		
	}
}
