12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <template>
- <div>
- <canvas id="wall" width="800" height="400" tabindex="0"/>
- </div>
- </template>
- <script lang="ts">
- import { SGraphScene, SGraphView } from "@persagy-web/graph/";
- import { SWindowItem } from "@persagy-web/big/lib/items/floor/SWindowItem";
- import { Component, Vue } from "vue-property-decorator";
- /**
- * 窗户对象示例
- *
- * @author 郝洁 <haojie@persagy.com>
- */
- @Component
- export default class WindowCanvas extends Vue {
- /** 实例化 view */
- view: SGraphView | undefined;
- outline1 = [[{X: 120, Y: -30}, {X: 120, Y: -50}, {X: 10, Y: -50}, {X: 10, Y: -30}]];
- /**
- * 页面挂载
- */
- mounted(): void {
- this.init();
- }
- /**
- * 初始化加载
- */
- init(): void {
- this.view = new SGraphView('wall');
- const scene = new SGraphScene();
- this.view.scene = scene;
- // 只模拟了轮廓数据
- // @ts-ignore
- const item = new SWindowItem(null, {OutLine: this.outline1});
- scene.addItem(item);
- this.view.fitSceneToView();
- this.view.scalable = false;
- }
- }
- </script>
- <style scoped>
- </style>
|