import { floorplanService } from '../Service/FloorplanService'
import { mathUtil } from '../MathUtil.js'
import { coordinate } from '../Coordinate'
import Constant from '../Constant'

export default class MoveArrow {
    constructor() {}

    moveFullArrow(dx,dy, arrowId) {
        let arrow = floorplanService.getArrow(arrowId)
        arrow.startPoint = {
            x:arrow.startPoint.x + dx/coordinate.res * Constant.defaultZoom/coordinate.zoom,
            y:arrow.startPoint.y - dy/coordinate.res * Constant.defaultZoom/coordinate.zoom,
        }

        arrow.endPoint = {
            x:arrow.endPoint.x + dx/coordinate.res * Constant.defaultZoom/coordinate.zoom,
            y:arrow.endPoint.y - dy/coordinate.res * Constant.defaultZoom/coordinate.zoom,
        }
    }

    moveArrowVertex(newPosition,arrowId,dir) {
        let arrow = floorplanService.getArrow(arrowId)
        arrow.updatePoint(newPosition,dir)
    }
}

const moveArrow = new MoveArrow()
export { moveArrow }
