window.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. /**
  11. * 窗户对象示例
  12. *
  13. * @author 郝洁 <haojie@persagy.com>
  14. */
  15. @Component
  16. export default class WindowCanvas extends Vue {
  17. /** 实例化 view */
  18. view: SGraphView | undefined;
  19. outline1 = [[{X: 120, Y: -30}, {X: 120, Y: -50}, {X: 10, Y: -50}, {X: 10, Y: -30}]];
  20. /**
  21. * 页面挂载
  22. */
  23. mounted(): void {
  24. this.init();
  25. }
  26. /**
  27. * 初始化加载
  28. */
  29. init(): void {
  30. this.view = new SGraphView('wall');
  31. const scene = new SGraphScene();
  32. this.view.scene = scene;
  33. // 只模拟了轮廓数据
  34. // @ts-ignore
  35. const item = new SWindowItem(null, {OutLine: this.outline1});
  36. scene.addItem(item);
  37. this.view.fitSceneToView();
  38. this.view.scalable = false;
  39. }
  40. }
  41. </script>
  42. <style scoped>
  43. </style>