# Examples

# Stick Man

Edit Vue Template

<template>
  <div id="app">
    <fabric-canvas :height="400" :width="400">
      <fabric-line
        :id="'headToBody'"
        :x1="headPosLeft"
        :y1="headPosTop"
        :x2="bodyPosLeft"
        :y2="bodyPosTop"
        :fill="'red'"
        :stroke="'red'"
        :strokeWidth="5"
        :selectable="false"
        :evented="false"
        :originX="'center'"
        :originY="'center'"
      ></fabric-line>
      <fabric-line
        :id="'bodyToWaist'"
        :x1="bodyPosLeft"
        :y1="bodyPosTop"
        :x2="waistPosLeft"
        :y2="waistPosTop"
        :fill="'red'"
        :stroke="'red'"
        :strokeWidth="5"
        :selectable="false"
        :evented="false"
        :originX="'center'"
        :originY="'center'"
      ></fabric-line>
      <fabric-line
        :id="'bodyToLeftArm'"
        :x1="bodyPosLeft"
        :y1="bodyPosTop"
        :x2="leftHandPosLeft"
        :y2="leftHandPosTop"
        :fill="'red'"
        :stroke="'red'"
        :strokeWidth="5"
        :selectable="false"
        :evented="false"
        :originX="'center'"
        :originY="'center'"
      ></fabric-line>
      <fabric-line
        :id="'bodyToRightArm'"
        :x1="bodyPosLeft"
        :y1="bodyPosTop"
        :x2="rightHandPosLeft"
        :y2="rightHandPosTop"
        :fill="'red'"
        :stroke="'red'"
        :strokeWidth="5"
        :selectable="false"
        :evented="false"
        :originX="'center'"
        :originY="'center'"
      ></fabric-line>
      <fabric-line
        :id="'waistToLeftFoot'"
        :x1="leftFootPosLeft"
        :y1="leftFootPosTop"
        :x2="waistPosLeft"
        :y2="waistPosTop"
        :fill="'red'"
        :stroke="'red'"
        :strokeWidth="5"
        :selectable="false"
        :evented="false"
        :originX="'center'"
        :originY="'center'"
      ></fabric-line>
      <fabric-line
        :id="'waistToRightFoot'"
        :x1="rightFootPosLeft"
        :y1="rightFootPosTop"
        :x2="waistPosLeft"
        :y2="waistPosTop"
        :fill="'red'"
        :stroke="'red'"
        :strokeWidth="5"
        :selectable="false"
        :evented="false"
        :originX="'center'"
        :originY="'center'"
      ></fabric-line>
      <fabric-circle
        :id="'head'"
        :left.sync="headPosLeft"
        :top.sync="headPosTop"
        :strokeWidth="5"
        :radius="12"
        :fill="'#fff'"
        :stroke="'#666'"
        :originX="'center'"
        :originY="'center'"
      ></fabric-circle>
      <fabric-circle
        :id="'body'"
        :left.sync="bodyPosLeft"
        :top.sync="bodyPosTop"
        :strokeWidth="5"
        :radius="12"
        :fill="'#fff'"
        :stroke="'#666'"
        :originX="'center'"
        :originY="'center'"
      ></fabric-circle>
      <fabric-circle
        :id="'waist'"
        :left.sync="waistPosLeft"
        :top.sync="waistPosTop"
        :strokeWidth="5"
        :radius="12"
        :fill="'#fff'"
        :stroke="'#666'"
        :originX="'center'"
        :originY="'center'"
      ></fabric-circle>
      <fabric-circle
        :id="'leftHand'"
        :left.sync="leftHandPosLeft"
        :top.sync="leftHandPosTop"
        :strokeWidth="5"
        :radius="12"
        :fill="'#fff'"
        :stroke="'#666'"
        :originX="'center'"
        :originY="'center'"
      ></fabric-circle>
      <fabric-circle
        :id="'rightHand'"
        :left.sync="rightHandPosLeft"
        :top.sync="rightHandPosTop"
        :strokeWidth="5"
        :radius="12"
        :fill="'#fff'"
        :stroke="'#666'"
        :originX="'center'"
        :originY="'center'"
      ></fabric-circle>
      <fabric-circle
        :id="'leftFoot'"
        :left.sync="leftFootPosLeft"
        :top.sync="leftFootPosTop"
        :strokeWidth="5"
        :radius="12"
        :fill="'#fff'"
        :stroke="'#666'"
        :originX="'center'"
        :originY="'center'"
      ></fabric-circle>
      <fabric-circle
        :id="'rightFoot'"
        :left.sync="rightFootPosLeft"
        :top.sync="rightFootPosTop"
        :strokeWidth="5"
        :radius="12"
        :fill="'#fff'"
        :stroke="'#666'"
        :originX="'center'"
        :originY="'center'"
      ></fabric-circle>
    </fabric-canvas>
  </div>
</template>

<script>
import vueFabricWrapper from "vue-fabric-wrapper";

export default {
  name: "App",
  components: {
    FabricCanvas: vueFabricWrapper.FabricCanvas,
    FabricCircle: vueFabricWrapper.FabricCircle,
    FabricLine: vueFabricWrapper.FabricLine
  },
  data() {
    return {
      headPosLeft: 250,
      headPosTop: 125,
      bodyPosLeft: 250,
      bodyPosTop: 175,
      waistPosLeft: 250,
      waistPosTop: 250,
      leftHandPosLeft: 175,
      leftHandPosTop: 225,
      rightHandPosLeft: 325,
      rightHandPosTop: 225,
      leftFootPosLeft: 200,
      leftFootPosTop: 350,
      rightFootPosLeft: 300,
      rightFootPosTop: 350
    };
  }
};
</script>

<style>
#app {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209

# Dot Snappable Grid

<template>
    <fabric-canvas :id="'gridtesting2'" :height="400" :width="400">
      <fabric-dot-grid
        :id="'gridtesting2'"
        :gridSize="gridSize"
        :gridHeight="gridHeight"
        :gridWidth="gridWidth"
      ></fabric-dot-grid>
      <fabric-rectangle :id="'rectGridTesting2'"></fabric-rectangle>
    </fabric-canvas>
</template>

<script>
import vueFabricWrapper from "vue-fabric-wrapper";

export default {
  name: "Grid",
  components: {
    FabricCanvas: vueFabricWrapper.FabricCanvas,
    FabricRectangle: vueFabricWrapper.FabricRectangle,
    FabricDotGrid: vueFabricWrapper.FabricDotGrid
  },
  data() {
    return {
      gridSize: 40,
      gridHeight: 400,
      gridWidth: 400
    };
  },
  methods: {}
};
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Last Updated: 12/19/2019, 10:00:02 AM