12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <template>
- <div>
- <canvas id="wall" width="800" height="400" tabindex="0" />
- </div>
- </template>
- <script>
- import {SGraphScene, SGraphView} from "@persagy-web/graph/";
- import {SDoorItem} from "../../../../guides/big/items/src/SDoorItem";
- export default {
- name: "wall",
- data(){
- return {
- view: null,
- // 图中靠上位置的黑色矩形轮廓
- outline1:[[{X:120,Y:100},{X:120,Y:300}]],
- // 图中靠下位置的,绘制多个图形,会覆盖
- outline2:[
- [{X:120,Y:-30},{X:120,Y:-50},{X:10,Y:-50},{X:10,Y:-30}],
- [{X:20,Y:-30},{X:20,Y:-85},{X:110,Y:-85},{X:110,Y:-40}]
- ]
- }
- },
- mounted() {
- this.init();
- },
- methods:{
- init(){
- this.view = new SGraphView('wall');
- // this.view.scalable = false;
- const scene = new SGraphScene();
- this.view.scene = scene;
- // 只模拟了轮廓数据
- const item = new SDoorItem(null,
- {
- OutLine:this.outline1,
- FaceDirection: {X: 0, Y: -1, Z: 0},
- HandDirection: {X: 1, Y: 0, Z: 0}
- }
- );
- scene.addItem(item);
- // 只模拟了轮廓数据
- // const item2 = new SDoorItem(null,
- // {
- // OutLine:this.outline2,
- // FaceDirection: {X: -1, Y: 1, Z: 0},
- // HandDirection: {X: 1, Y: 1, Z: 0}
- // }
- // );
- // scene.addItem(item2);
- // this.view.fitSceneToView();
- }
- }
- }
- </script>
- <style scoped>
- </style>
|