export default class Scrollable {
    canScrolling = false;
    x = 0;
    y = 0;
    constructor(elemet) {
        this.elemet = elemet;
    }

    start(event) {
        if (event.changedTouches != undefined) {
            this.x = event.changedTouches[0].screenX;
            this.y = event.changedTouches[0].screenY;
        } else {
            this.x = event.screenX;
            this.y = event.screenY;
        }
        this.canScrolling = true;
    }
    move(event) {
        if (this.canScrolling == false) return;
        let x =
            event.changedTouches != undefined
                ? event.changedTouches[0].screenX
                : event.screenX;
        let y =
            event.changedTouches != undefined
                ? event.changedTouches[0].screenY
                : event.screenY;
        this.elemet.value.scrollLeft += this.x - x;
        this.elemet.value.scrollTop += this.y - y;
        this.x = x;
        this.y = y;
    }
    end() {
        this.canScrolling = false;
        this.x = 0;
        this.y = 0;
    }
}
