package com.example.exo1;

import android.view.GestureDetector;
import android.view.MotionEvent;
import com.example.sae41_2025.CaseOnTouchListener;

public class CaseGestureListener implements GestureDetector.OnGestureListener {

    private CaseOnTouchListener listener;

    public CaseGestureListener(CaseOnTouchListener listener) {
        this.listener = listener;
    }

    @Override
    public void onLongPress(MotionEvent e) {
    }

    @Override
    public boolean onDown(MotionEvent e) {
        return true;
    }

    @Override
    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
        return false;
    }

    @Override
    public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
        this.listener.setOrientation(distanceX, distanceY);
        this.listener.updatePosition(e2);
        return true;
    }

    @Override
    public void onShowPress(MotionEvent e) {
    }

    @Override
    public boolean onSingleTapUp(MotionEvent e) {
        return false;
    }

}