import '../../../assert/js/assert.js';
import '../../../globals.js';
import Vector3 from '../../../dot/js/Vector3.js';
import { Pointer, scenery } from '../imports.js';
export default class Mouse extends Pointer {
    constructor(point) {
        super(point, 'mouse');
        this.id = null;
        this.leftDown = false;
        this.middleDown = false;
        this.rightDown = false;
        this.wheelDelta = new Vector3(0, 0, 0);
        this.wheelDeltaMode = 0;
        sceneryLog && sceneryLog.Pointer && sceneryLog.Pointer(`Created ${this.toString()}`);
    }
    /**
     * Sets information in this Mouse for a given mouse down. (scenery-internal)
     *
     * @returns - Whether the point changed
     */
    down(event) {
        assert && assert(event instanceof MouseEvent); // eslint-disable-line phet/no-simple-type-checking-assertions
        const mouseEvent = event;
        switch (mouseEvent.button) {
            case 0:
                this.leftDown = true;
                break;
            case 1:
                this.middleDown = true;
                break;
            case 2:
                this.rightDown = true;
                break;
            default:
            // no-op until we refactor things, see https://github.com/phetsims/scenery/issues/813
        }
        return super.down(event);
    }
    /**
     * Sets information in this Mouse for a given mouse up. (scenery-internal)
     *
     * @returns - Whether the point changed
     */
    up(point, event) {
        assert && assert(event instanceof MouseEvent); // eslint-disable-line phet/no-simple-type-checking-assertions
        const mouseEvent = event;
        switch (mouseEvent.button) {
            case 0:
                this.leftDown = false;
                break;
            case 1:
                this.middleDown = false;
                break;
            case 2:
                this.rightDown = false;
                break;
            default:
            // no-op until we refactor things, see https://github.com/phetsims/scenery/issues/813
        }
        return super.up(point, event);
    }
    /**
     * Sets information in this Mouse for a given mouse move. (scenery-internal)
     *
     * @returns - Whether the point changed
     */
    move(point) {
        const pointChanged = this.hasPointChanged(point);
        point && sceneryLog && sceneryLog.InputEvent && sceneryLog.InputEvent(`mouse move at ${point.toString()}`);
        this.point = point;
        return pointChanged;
    }
    /**
     * Sets information in this Mouse for a given mouse over. (scenery-internal)
     *
     * @returns - Whether the point changed
     */
    over(point) {
        const pointChanged = this.hasPointChanged(point);
        point && sceneryLog && sceneryLog.InputEvent && sceneryLog.InputEvent(`mouse over at ${point.toString()}`);
        this.point = point;
        return pointChanged;
    }
    /**
     * Sets information in this Mouse for a given mouse out. (scenery-internal)
     *
     * @returns - Whether the point changed
     */
    out(point) {
        const pointChanged = this.hasPointChanged(point);
        point && sceneryLog && sceneryLog.InputEvent && sceneryLog.InputEvent(`mouse out at ${point.toString()}`);
        return pointChanged;
    }
    /**
     * Sets information in this Mouse for a given mouse wheel. (scenery-internal)
     */
    wheel(event) {
        assert && assert(event instanceof WheelEvent); // eslint-disable-line phet/no-simple-type-checking-assertions
        const wheelEvent = event;
        this.wheelDelta.setXYZ(wheelEvent.deltaX, wheelEvent.deltaY, wheelEvent.deltaZ);
        this.wheelDeltaMode = wheelEvent.deltaMode;
    }
    /**
     * Returns an improved string representation of this object.
     */
    toString() {
        return 'Mouse'; // there is only one
    }
}
scenery.register('Mouse', Mouse);
//# sourceMappingURL=Mouse.js.map