ArrowService.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import VectorType from '../enum/VectorType.js'
  2. import Arrow from '../Geometry/Arrow.js'
  3. import { mathUtil } from '../MathUtil.js'
  4. import { floorplanService } from './FloorplanService'
  5. import Constant from '../Constant'
  6. export default class ArrowService {
  7. constructor() {
  8. }
  9. createArrow(startPosition,endPosition,vectorId) {
  10. const arrow = new Arrow(startPosition, endPosition,vectorId)
  11. floorplanService.addArrow(arrow)
  12. return arrow
  13. }
  14. updateArrow(vectorId,newPosition,dir){
  15. const arrow = floorplanService.getArrow(vectorId)
  16. arrow.updatePoint(newPosition,dir)
  17. }
  18. setArrowInfo(arrowInfo) {
  19. let arrow = floorplanService.getArrow(arrowInfo.vectorId)
  20. arrow.vectorId = arrowInfo.vectorId
  21. arrow.startPoint = JSON.parse(JSON.stringify(arrowInfo.startPoint))
  22. arrow.endPoint = JSON.parse(JSON.stringify(arrowInfo.endPoint))
  23. }
  24. deleteArrow(arrowId, floorNum) {
  25. floorplanService.deleteArrow(arrowId, floorNum)
  26. }
  27. }
  28. const arrowService = new ArrowService()
  29. export { arrowService }