package org.helioviewer.gl3d.camera;

import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;

import org.helioviewer.gl3d.view.GL3DSceneGraphView;
import org.helioviewer.jhv.display.Displayer;

/**
 * Default {@link GL3DInteraction} class that provides a reference to the
 * {@link GL3DSceneGraphView}. Default behavior includes camera reset on double
 * click.
 *
 * @author Simon Spoerri (simon.spoerri@fhnw.ch)
 *
 */
public abstract class GL3DDefaultInteraction extends GL3DInteraction {
    private static final double ZOOM_WHEEL_FACTOR = 1.0 / 20;

    protected GL3DSceneGraphView sceneGraphView;

    protected GL3DDefaultInteraction(GL3DCamera camera, GL3DSceneGraphView sceneGraph) {
        super(camera);
        this.sceneGraphView = sceneGraph;
    }

    @Override
    public void reset(GL3DCamera camera) {
    }

    @Override
    public void mouseClicked(MouseEvent e, GL3DCamera camera) {
        if (e.getClickCount() == 2) {
            camera.reset();
        }
    }

    public void reset() {
        //camera.setDefaultFOV();
        //this.camera.updateCameraTransformation();
    }

    @Override
    public void mouseWheelMoved(MouseWheelEvent e, GL3DCamera camera) {
        int wr = e.getWheelRotation();
        double previousFOV = camera.getCameraFOV();

        camera.setCameraFOV(camera.getCameraFOV() + 0.04 * ZOOM_WHEEL_FACTOR * wr);
        if (previousFOV != camera.getCameraFOV()) {
            Displayer.getSingletonInstance().display();
        }
    }
}

@@ -559,16 +559,13 @@
 R = 
-1
+0
 .0
- / 2
 0
+2
 ;%0A%0A 
@@ -1029,94 +1029,8 @@
 ) %7B%0A
-        //camera.setDefaultFOV();%0A        //this.camera.updateCameraTransformation();%0A
     
@@ -1265,15 +1265,8 @@
 () +
- 0.04 *
  ZOO

set ZOOM_WHEEL_FACTOR