package jp.ac.kyutech.mns.ist;

import java.awt.event.MouseEvent;
import java.awt.geom.Point2D;

import edu.umd.cs.piccolo.event.PBasicInputEventHandler;
import edu.umd.cs.piccolo.event.PInputEvent;

public class Event_onSheetNum extends PBasicInputEventHandler {
	MyRect sheet;
	Note note;

	PInputEvent pressEv = null;
	Point2D pressP = null;
	int dragCount = 0;

	public Event_onSheetNum(MyRect _sheet, Note _note) {
		sheet = _sheet;
		note = _note;
	}
	public void mouseEntered(PInputEvent aEvent){
		for(Sheet s: note.sheets.values()){
			s.showStaticSheetNum(true);
		}
	}
	public void mouseExited(PInputEvent aEvent){
		for(Sheet s: note.sheets.values()){
			s.showStaticSheetNum(false);
		}
	}

	public void mousePressed(final PInputEvent aEvent) {
		pressEv = aEvent;
		dragCount = 0;
	}
	public void mouseDragged(final PInputEvent aEvent) {
		dragCount++;
	}
	public void mouseReleased(final PInputEvent aEvent) {

		if (dragCount < 3){
			if (pressEv.getButton()==MouseEvent.BUTTON3){
//				//ポップアップメニュー
//				new PopupMenu_forSheet(sheet, pressEv, sheet.canvas);
			} else if (pressEv.getButton()==MouseEvent.BUTTON1){
				if (SimpleATN.theapp.zrh.selection == null){
					
//					sheet.collect();
					note.focus();
					
//					sheet.canvas.getCamera().animateViewToCenterBounds(sheet.getBounds(), true, 1000);
				} else {
//					//集約する
//					new PopupMenu_forZoomRegion(sheet, aEvent, sheet.canvas, SimpleATN.theapp.zrh);
				}
			}
		}
	}	

}
