CurrentState.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. function CurrentState() {
  2. //画什么
  3. this.startbuild = null;
  4. //添加元素
  5. this.addSymbol = null;
  6. //选中门时候的两个端点
  7. this.currentSymbolCircleId1 = null;
  8. this.currentSymbolCircleId2 = null;
  9. //当前元素是否存在
  10. this.currentSymbol = false;
  11. //当前活动的墙
  12. this.currentWallId = null;
  13. //选中的线段所在位置的起始点
  14. //选中点的位置
  15. this.currentstartlinePointIndex = null;
  16. //选中的线段所在位置的终点
  17. this.currentendlinePointIndex = null;
  18. //当前选中的圆圈
  19. this.currentCircleId = null;
  20. //当前选中的点
  21. this.currentPointId = null;
  22. //当前选中的扇形
  23. this.currentSecotrId = null;
  24. //当前选中的线段
  25. this.currentLineId = null;
  26. //当前选中的symbol的id
  27. this.currentSymbolId = null;
  28. //当前选中的楼梯的id
  29. this.currentStairId = null;
  30. //选中的线段上的端点所在id
  31. this.currentLinePoint1Id = null;
  32. this.currentLinePoint2Id = null;
  33. //当前点是否被墙包含
  34. //id表示墙的vectorid,index表示墙对应的点的index,endindex表示墙的另一端对应的点的index,type表示对应的是墙角还是墙面
  35. this.selectWallSet = null;
  36. this.selectStairSet = null;
  37. //当前所处的状态
  38. //0表示什么也没有选中,1表示选中的是墙,2表示选中的是墙角,3表示选中的是墙上的门或窗户等元素
  39. //this.state=0;
  40. //当前状态和上一个状态一致
  41. CurrentState.prototype.isRetain = function (laststate) {
  42. if (this.currentstartlinePointIndex === laststate.currentstartlinePointIndex && this.currentendlinePointIndex === laststate.currentendlinePointIndex) {
  43. if (this.currentWallId === laststate.currentWallId && this.currentStairId === laststate.currentStairId) {
  44. return true;
  45. }
  46. }
  47. return false;
  48. };
  49. CurrentState.prototype.clearSelectSymbol = function () {
  50. this.currentSymbolCircleId1 = null;
  51. this.currentSymbolCircleId2 = null;
  52. this.currentSymbol = false;
  53. this.currentSymbolId = null;
  54. };
  55. CurrentState.prototype.clearSelects = function () {
  56. this.currentSymbolCircleId1 = null;
  57. this.currentSymbolCircleId2 = null;
  58. this.currentSymbol = false;
  59. this.currentWallId = null;
  60. this.currentstartlinePointIndex = null;
  61. this.currentendlinePointIndex = null;
  62. this.currentCircleId = null;
  63. this.currentPointId = null;
  64. this.currentSecotrId = null;
  65. this.currentLineId = null;
  66. this.currentSymbolId = null;
  67. this.currentLinePoint1Id = null;
  68. this.currentLinePoint2Id = null;
  69. //this.selectWallSet=null;
  70. };
  71. };