door.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <template>
  2. <div>
  3. <canvas id="wall" width="800" height="400" tabindex="0"/>
  4. </div>
  5. </template>
  6. <script lang="ts">
  7. import { SGraphScene, SGraphView } from "@persagy-web/graph/";
  8. import { SDoorItem } from "@persagy-web/big/lib/items/floor/SDoorItem";
  9. import { Component, Vue } from "vue-property-decorator";
  10. @Component
  11. export default class WallCanvas extends Vue {
  12. /** 实例化 view */
  13. view: SGraphView | undefined;
  14. outline1 = [[{X: 12000, Y: 10000}, {X: 12000, Y: 30000}]];
  15. /**
  16. * 页面挂载
  17. */
  18. mounted(): void {
  19. this.init();
  20. };
  21. /**
  22. * 初始化加载
  23. */
  24. init(): void {
  25. this.view = new SGraphView('wall');
  26. const scene = new SGraphScene();
  27. this.view.scene = scene;
  28. // 只模拟了轮廓数据
  29. // @ts-ignore
  30. const item = new SDoorItem(null,
  31. // @ts-ignore
  32. {
  33. OutLine: this.outline1,
  34. FaceDirection: {X: 0, Y: -1, Z: 0},
  35. HandDirection: {X: 1, Y: 0, Z: 0}
  36. }
  37. );
  38. scene.addItem(item);
  39. this.view.fitSceneToView();
  40. }
  41. }
  42. </script>
  43. <style scoped>
  44. </style>