package com.akjava.gwt.three.client.js.extras.controls;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.user.client.ui.HasEnabled;

/**
 * Controls for changing the position and angle of an object, e.g. a camera.
 * @author sbaumhekel
 */
public class TrackballControls extends JavaScriptObject implements HasEnabled
{

	/**
	 * Do not use.
	 */
	@Deprecated
	protected TrackballControls()
	{
	}

	/**
	 * Gets whether panning is allowed.
	 * @return true on success, else false
	 */
	public final native double getAllowPan()/*-{
		return !this.noPan;
	}-*/;

	/**
	 * Gets whether rotation is allowed.
	 * @return true on success, else false
	 */
	public final native double getAllowRotate()/*-{
		return !this.noRotate;
	}-*/;

	/**
	 * Gets whether zoom is allowed.
	 * @return true on success, else false
	 */
	public final native double getAllowZoom()/*-{
		return !this.noZoom;
	}-*/;

	/**
	 * Gets the maximum distance of objects to be shown.
	 * @return maximum distance (default: {@link Double#POSITIVE_INFINITY} )
	 */
	public final native double getMaxDistance()/*-{
		return this.maxDistance;
	}-*/;

	/**
	 * Gets the minimum distance of objects to be shown.
	 * @return minimum distance (default: 0)
	 */
	public final native double getMinDistance()/*-{
		return this.minDistance;
	}-*/;

	/**
	 * Handles resizes of the parent element.
	 */
	public final native void handleResize()/*-{
		this.handleResize();
	}-*/;

	/*
	 * (non-Javadoc)
	 * @see com.google.gwt.user.client.ui.HasEnabled#isEnabled()
	 */
	@Override
	public final native boolean isEnabled()/*-{
		return this.enabled;
	}-*/;

	/**
	 * Resets the current control state.
	 */
	public final native void reset()/*-{
		this.reset();
	}-*/;

	/**
	 * Sets whether panning is allowed.
	 * @param allow allow panning
	 */
	public final native void setAllowPan(boolean allow)/*-{
		this.noPan = !allow;
	}-*/;

	/**
	 * Sets whether rotation is allowed.
	 * @param allow allow rotation
	 */
	public final native void setAllowRotate(boolean allow)/*-{
		this.noRotate = !allow;
	}-*/;

	/**
	 * Sets whether zoom is allowed.
	 * @param allow allow zoom
	 */
	public final native void setAllowZoom(boolean allow)/*-{
		this.noZoom = !allow;
	}-*/;

	/*
	 * (non-Javadoc)
	 * @see com.google.gwt.user.client.ui.HasEnabled#setEnabled(boolean)
	 */
	@Override
	public final native void setEnabled(boolean enabled)/*-{
		this.enabled = enabled;
	}-*/;

	/**
	 * Sets the maximum distance of objects to be shown.
	 * @param maxDistance maximum distance {@link Double#POSITIVE_INFINITY}
	 */
	public final native void setMaxDistance(double maxDistance)/*-{
		this.maxDistance = maxDistance;
	}-*/;

	/**
	 * Sets the minimum distance of objects to be shown.
	 * @param minDistance minimum distance (default: 0)
	 */
	public final native void setMinDistance(double minDistance)/*-{
		this.minDistance = minDistance;
	}-*/;

	/**
	 * Updates the current control state.
	 */
	public final native void update()/*-{
		this.update();
	}-*/;

}

@@ -572,32 +572,197 @@
 .noPan;%0A%09%7D-*/;%0A%0A
+%09/**%0A%09 * Gets whether rolling is allowed.%0A%09 * @return true on success, else false%0A%09 */%0A%09public final native double getAllowRoll()/*-%7B%0A%09%09return !this.noRoll;%0A%09%7D-*/;%0A%0A
 %09/**%0A%09 * Gets wh
@@ -2062,32 +2062,200 @@
 !allow;%0A%09%7D-*/;%0A%0A
+%09/**%0A%09 * Sets whether rolling is allowed.%0A%09 * @param allow allow rolling%0A%09 */%0A%09public final native void setAllowRoll(boolean allow)/*-%7B%0A%09%09this.noRoll = !allow;%0A%09%7D-*/;%0A%0A
 %09/**%0A%09 * Sets wh

allow rolling with latest three.js.