<template>
    <div>
        <canvas id="wall" width="800" height="400" tabindex="0"/>
    </div>
</template>

<script lang="ts">
import { SGraphScene, SGraphView } from "@persagy-web/graph/";
import { SDoorItem } from "@persagy-web/big/lib/items/floor/SDoorItem";
import { Component, Vue } from "vue-property-decorator";

/**
 * 门对象示例
 *
 * @author 郝洁 <haojie@persagy.com>
 */
@Component
export default class WallCanvas extends Vue {
    /** 实例化 view */
    view: SGraphView | undefined;
    /** 图中靠上位置的黑色矩形轮廓 */
    outline1 = [[{X: 12000, Y: 10000}, {X: 12000, Y: 30000}]];

    /**
     * 页面挂载
     */
    mounted(): void {
        this.init();
    };

    /**
     * 初始化加载
     */
    init(): void {
        this.view = new SGraphView('wall');
        const scene = new SGraphScene();
        this.view.scene = scene;
        // 只模拟了轮廓数据
        // @ts-ignore
        const item = new SDoorItem(null,
            // @ts-ignore
            {
                OutLine: this.outline1,
                    FaceDirection: {X: 0, Y: -1, Z: 0},
                    HandDirection: {X: 1, Y: 0, Z: 0}
                }
            );
            scene.addItem(item);
            this.view.fitSceneToView();
        }
    }
</script>

<style scoped>

</style>
