FloorScene.ts 986 B

1234567891011121314151617181920212223242526272829303132
  1. import { SGraphScene } from "@saga-web/graph/lib"
  2. import { SMouseEvent } from "@saga-web/base/lib"
  3. import { SPoint } from "@saga-web/draw/lib"
  4. import { SFloorParser, SImageItem, STextItem, SLineItem, SPolylineItem } from "@saga-web/big"
  5. export class FloorScene extends SGraphScene {
  6. isLining: boolean = false
  7. constructor() {
  8. super()
  9. // this.selectContainer.connect("listChange", this, this.listChange)
  10. }
  11. // listChange(item, list) {
  12. // console.log(arguments)
  13. // }
  14. onMouseDown(event: SMouseEvent): boolean {
  15. if (this.isLining) {
  16. if (this.grabItem instanceof SPolylineItem) {
  17. return super.onMouseDown(event)
  18. } else {
  19. const item = new SPolylineItem(null, new SPoint(event.x, event.y))
  20. this.addItem(item)
  21. this.grabItem = item
  22. return true
  23. }
  24. } else {
  25. return super.onMouseDown(event)
  26. }
  27. }
  28. }