window.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 { SWindowItem } from "@persagy-web/big/lib/items/floor/SWindowItem";
  9. import { Component, Vue } from "vue-property-decorator";
  10. @Component
  11. export default class WindowCanvas extends Vue {
  12. view: SGraphView | undefined;
  13. outline1 = [[{X: 120, Y: -30}, {X: 120, Y: -50}, {X: 10, Y: -50}, {X: 10, Y: -30}]];
  14. /**
  15. * 页面挂载
  16. */
  17. mounted(): void {
  18. this.init();
  19. }
  20. init(): void {
  21. this.view = new SGraphView('wall');
  22. const scene = new SGraphScene();
  23. this.view.scene = scene;
  24. // 只模拟了轮廓数据
  25. // @ts-ignore
  26. const item = new SWindowItem(null, {OutLine: this.outline1});
  27. scene.addItem(item);
  28. this.view.fitSceneToView();
  29. this.view.scalable = false;
  30. }
  31. }
  32. </script>
  33. <style scoped>
  34. </style>