package com.example.myapplication;

import android.content.Context;
import android.view.MotionEvent;
import android.view.View;

public class Pois implements View.OnTouchListener {

    private Fenetre mavue;
    private float x=-1;
    private float y=-1;

    public Pois() {
    }

    public void setVue(Fenetre vue){
        this.mavue=vue;
    }

    public float getPoisX(){
        return this.x;
    }

    public float getPoisY(){
        return this.y;
    }

    @Override
    public boolean onTouch(View v, MotionEvent e) {
        int action = e.getActionMasked();
        if (action==MotionEvent.ACTION_DOWN){
            this.x=e.getX(0);
            this.y=e.getY(0);
            mavue.invalidate();
        }
        if (action==MotionEvent.ACTION_UP){
            this.x=-1;
            this.y=-1;
            mavue.invalidate();
        }
        if (action==MotionEvent.ACTION_MOVE){
            this.x=e.getX(0);
            this.y=e.getY(0);
            mavue.invalidate();
        }
        return true;
    }
}
