Пример #1
0
	/**
	 * method that will be called when mouse presses
	 * @param point , the point mouse press at
	 */
	public void onMousePress(Location point){
		lastpoint = point;
		if (isShown && mouse.contains(point)) {
			isGrabbed = true;
		} else {
			isGrabbed = false;
		}
		timer.reset();
		moved = false;
	}
Пример #2
0
	/**
	 * method that will be called when mouse releases
	 * @param point , the point mouse release at
	 */
	public void onMouseRelease(Location point) {
		isGrabbed = false;
		if(isShown && !moved &&
				timer.elapsedMilliseconds() >= FLIP_PRESS_THRESHOLD){
			if(mouse.inFace(point)){
				mouse.move((double)(CENTER_X - point.getX()),
						(double)(CENTER_Y - point.getY()));
			}
			else if(mouse.inLeftEar(point)){
				mouse.turnLeft();
			}
			else if(mouse.inRightEar(point)){
				mouse.turnRight();
			}
		}

	}