haojianlong 4 rokov pred
rodič
commit
856fbb4c4e

+ 16 - 9
docs/.vuepress/components/scene/items/area.vue

@@ -7,20 +7,27 @@
 </template>
 
 <script>
-    import {SGraphAreaGroupItem,SGraphScene, SGraphView} from "@persagy-web/graph/lib";
+    import {SGraphAreaGroupItem, SGraphItem, SGraphScene, SGraphView} from "@persagy-web/graph/lib";
+    import {SPath} from "@persagy-web/draw/lib";
+
+    class sga extends SGraphItem{
+        constructor(parent){
+            super(parent);
+            this.path = new SPath();
+            this.path.polygon([{x:0,y:0},{x:0,y:1000},{x:700,y:1500},{x:500,y:1000},{x:200,y:0}])
+        }
+        onDraw(painter) {
+            console.log(this.path);
+            painter.drawPath(this.path)
+        }
+    }
 
     export default {
         name: "areaCanvas",
         data(){
             return{
                 id: 'area'+Date.now(),
-                view: '',
-                outline: [
-                    [
-                        [{X: 0, Y:0},{X: 0, Y:-100},{X: 100, Y:-100}],
-                        // [{X: 800, Y:200},{X: 800, Y:800},{X: 200, Y:800},{X: 200, Y:200}]
-                    ]
-                ]
+                view: ''
             }
         },
         mounted() {
@@ -30,7 +37,7 @@
             init(){
                 this.view = new SGraphView(this.id);
                 const scene = new SGraphScene();
-                const item = new SGraphAreaGroupItem(null, {OutLine: this.outline});
+                const item = new sga(null);
                 scene.addItem(item);
                 this.view.scene = scene;
                 this.view.fitSceneToView();