<commit_before>package org.helioviewer.gl3d.camera;

import java.awt.Point;
import java.awt.event.MouseEvent;

import org.helioviewer.base.math.Vector2dDouble;
import org.helioviewer.base.physics.Constants;
import org.helioviewer.jhv.display.Displayer;
import org.helioviewer.viewmodel.view.RegionView;
import org.helioviewer.viewmodel.view.ViewHelper;
import org.helioviewer.viewmodel.view.opengl.GL3DSceneGraphView;
import org.helioviewer.viewmodel.view.opengl.GLInfo;

/**
 * Standard panning interaction, moves the camera proportionally to the mouse
 * movement when dragging
 *
 * @author <NAME> (<EMAIL>)
 *
 */
public class GL3DPanInteraction extends GL3DDefaultInteraction {

    private Point lastMousePoint;

    protected GL3DPanInteraction(GL3DSolarRotationTrackingTrackballCamera camera, GL3DSceneGraphView sceneGraph) {
        super(camera, sceneGraph);
    }

    @Override
    public void mousePressed(MouseEvent e, GL3DCamera camera) {
        this.lastMousePoint = e.getPoint();
    }

    @Override
    public void mouseDragged(MouseEvent e, GL3DCamera camera) {
        int x = (e.getPoint().x - this.lastMousePoint.x) * GLInfo.pixelScale[0];
        int y = (e.getPoint().y - this.lastMousePoint.y) * GLInfo.pixelScale[1];
        if (sceneGraphView.getAdapter(RegionView.class).getRegion() != null) {
            Vector2dDouble imageDisplacement = ViewHelper.convertScreenToImageDisplacement(x, y, sceneGraphView.getAdapter(RegionView.class).getRegion(), ViewHelper.calculateViewportImageSize(sceneGraphView));
            camera.translation.x += imageDisplacement.getX();
            camera.translation.y += imageDisplacement.getY();
        } else {
            camera.translation.x += x / 100.0 * Constants.SunRadius;
            camera.translation.y -= y / 100.0 * Constants.SunRadius;
        }
        this.lastMousePoint = e.getPoint();
        camera.updateCameraTransformation();

        Displayer.display();
    }

    @Override<commit_msg>Fix pan<commit_after>package org.helioviewer.gl3d.camera;

import java.awt.Point;
import java.awt.event.MouseEvent;

import org.helioviewer.base.math.Vector2dDouble;
import org.helioviewer.base.physics.Constants;
import org.helioviewer.jhv.display.Displayer;
import org.helioviewer.viewmodel.view.RegionView;
import org.helioviewer.viewmodel.view.ViewHelper;
import org.helioviewer.viewmodel.view.opengl.GL3DSceneGraphView;

/**
 * Standard panning interaction, moves the camera proportionally to the mouse
 * movement when dragging
 *
 * @author <NAME> (<EMAIL>)
 *
 */
public class GL3DPanInteraction extends GL3DDefaultInteraction {

    private Point lastMousePoint;

    protected GL3DPanInteraction(GL3DSolarRotationTrackingTrackballCamera camera, GL3DSceneGraphView sceneGraph) {
        super(camera, sceneGraph);
    }

    @Override
    public void mousePressed(MouseEvent e, GL3DCamera camera) {
        this.lastMousePoint = e.getPoint();
    }

    @Override
    public void mouseDragged(MouseEvent e, GL3DCamera camera) {
        int x = e.getPoint().x - this.lastMousePoint.x;
        int y = e.getPoint().y - this.lastMousePoint.y;
        if (sceneGraphView.getAdapter(RegionView.class).getRegion() != null) {
            Vector2dDouble imageDisplacement = ViewHelper.convertScreenToImageDisplacement(x, y, sceneGraphView.getAdapter(RegionView.class).getRegion(), ViewHelper.calculateViewportImageSize(sceneGraphView));
            camera.translation.x += imageDisplacement.getX();
            camera.translation.y += imageDisplacement.getY();
        } else {
            camera.translation.x += x / 100.0 * Constants.SunRadius;
            camera.translation.y -= y / 100.0 * Constants.SunRadius;
        }
        this.lastMousePoint = e.getPoint();
        camera.updateCameraTransformation();

        Displayer.display();
    }

    @Override
{'fraction_non_alphanumeric': 0.10471476947121647, 'fraction_numerical': 0.01041938004688721, 'mean_word_length': 3.6658566221142164, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6345296', 'n_tokens_mistral': 1200, 'n_tokens_neox': 1169, 'n_words': 204}