divideFloorScene.ts 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * ********************************************************************************************************************
  3. *
  4. * :*$@@%$*: ;: ;; ;;
  5. * :@@%! :!@@%: %! ;%%@@%$ =@@@@@@@%; @%@@@%%%%@@@@@
  6. * :@%; :$= %%$$$%$$ ;$$ ;$@= !@$
  7. * =@! %! @ $=;% !@@@%: !$$$$$$$$$$$$$$=
  8. * =@* %! @ $= % %@= =%@! %=
  9. * *$%%! @@= ;=$%%%$*: %! @ $= % =%%%%%%@$ *%: =%
  10. * %@@!: !@@@%=$@@@@%! :*@@$: %! @ $= % $* ;@ @* :%*
  11. * ;@@! ;!!!;: ;@%: =======@%========* @ $$ % $%*****$@ :@$=*********=@$
  12. * $@* ;@@@%=!: *@*
  13. * =@$ ;;;!=%@@@@=! =@!
  14. * %@$: =@%: :*@@@* %@= Copyright (c) 2016-2019. 北京上格云技术有限公司
  15. * ;%@@$=$@@%* *@@@$=%@@%;
  16. * ::;:: ::;:: All rights reserved.
  17. *
  18. * ********************************************************************************************************************
  19. */
  20. import { FloorScene } from "./FloorScene";
  21. import { SMouseEvent } from "@sybotan-web/graphy/lib";
  22. import { SColor, SPoint, SRect } from "@sybotan-web/draw/lib";
  23. import { UserMark } from "./items/UserMark";
  24. /**
  25. * 划分业务空间
  26. *
  27. * @author 郝建龙
  28. */
  29. export class DivideFloorScene extends FloorScene {
  30. /** 是否开启用户标记 */
  31. _isMarking: boolean = false;
  32. get isMarking(): boolean {
  33. return this._isMarking;
  34. } // Get isMarking
  35. set isMarking(v: boolean) {
  36. if (this._isMarking === v) {
  37. return;
  38. }
  39. this._isMarking = v;
  40. } // Set isMarking
  41. /**
  42. * 构造函数
  43. *
  44. * @param data
  45. */
  46. constructor() {
  47. super();
  48. } // Constructor
  49. /** 清除切割 */
  50. clearUserMark(): void {
  51. if (this.grabItem) {
  52. this.removeItem(this.grabItem);
  53. this.grabItem = null;
  54. this.isMarking = false;
  55. }
  56. } // Function clearUserMark()
  57. /**
  58. * 点击事件
  59. *
  60. * @param event 保存事件参数
  61. * @return boolean
  62. */
  63. onMouseDown(event: SMouseEvent): boolean {
  64. if (this.isMarking) {
  65. if (this.grabItem) {
  66. this.grabItem.onMouseDown(event);
  67. } else {
  68. let point = new SPoint(event.x, event.y);
  69. let userM = new UserMark(null, point);
  70. this.addItem(userM);
  71. this.grabItem = userM;
  72. }
  73. } else {
  74. super.onMouseDown(event);
  75. }
  76. return false;
  77. } // Function onClick()
  78. } // Class DivideFloorScene