forked from Pixieish/patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
138 lines (137 loc) · 4.72 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Aaron</title>
<style>
.two {
display: inline-block;
max-width: 95%;
margin: auto;
}
</style>
</head>
<body>
<div id="svg"></div>
<div id="svg1" class="two"></div>
<div id="svg2" class="two"></div>
<script type="text/javascript" src="node_modules/freesewing/dist/browser.js"></script>
<script type="text/javascript" src="node_modules/@freesewing/brian/dist/browser.js"></script>
<script type="text/javascript" src="node_modules/@freesewing/plugin-bundle/dist/browser.js"></script>
<script type="text/javascript" src="dist/browser.js"></script>
<script type="text/javascript" src="node_modules/@freesewing/plugin-theme/dist/browser.js"></script>
<script type="text/javascript" src="node_modules/@freesewing/plugin-designer/dist/browser.js"></script>
<script type="text/javascript" src="node_modules/@freesewing/plugin-debug/dist/browser.js"></script>
<script type="text/javascript" src="node_modules/@freesewing/plugin-validate/dist/browser.js"></script>
<script type="text/javascript" src="node_modules/@freesewing/plugin-i18n/dist/browser.js"></script>
<script type="text/javascript" src="node_modules/@freesewing/models/dist/browser.js"></script>
<script>
console.log(freesewing);
let settings = {
"complete": true,
"idPrefix": "fs-",
"locale": "en",
"options": { },
"embed": true,
"sa": 10,
"paperless": true,
"measurements": {
"bicepsCircumference": 335,
"centerBackNeckToWaist": 520,
"chestCircumference": 1080,
"hipsCircumference": 990,
"naturalWaist": 925,
"naturalWaistToHip": 145,
"neckCircumference": 420,
"shoulderSlope": 55,
"shoulderToElbow": 410,
"shoulderToShoulder": 465,
"shoulderToWrist": 680,
"wristCircumference": 190,
"seatCircumference": 1080,
"inseam": 910,
"seatDepth": 200,
"hipsToUpperLeg": 220,
"upperLegCircumference": 630,
"headCircumference": 590,
"naturalWaistToFloor": 1310,
"naturalWaistToSeat": 280
},
layout: false
};
let settings1 = { ...settings};
settings1.sample = {
type: "models",
models: {
a: {
"bicepsCircumference": 335,
"centerBackNeckToWaist": 520,
"chestCircumference": 1080,
"hipsCircumference": 990,
"naturalWaist": 925,
"naturalWaistToHip": 145,
"neckCircumference": 420,
"shoulderSlope": 55,
"shoulderToElbow": 410,
"shoulderToShoulder": 465,
"shoulderToWrist": 680,
"wristCircumference": 190,
"seatCircumference": 1080,
"inseam": 910,
"seatDepth": 200,
"hipsToUpperLeg": 220,
"upperLegCircumference": 630,
"headCircumference": 590,
"naturalWaistToFloor": 1310,
"naturalWaistToSeat": 280
},
b: {
"bicepsCircumference": 33.5,
"centerBackNeckToWaist": 52,
"chestCircumference": 108,
"hipsCircumference": 99,
"naturalWaist": 92,
"naturalWaistToHip": 14,
"neckCircumference": 42,
"shoulderSlope": 5,
"shoulderToElbow": 41,
"shoulderToShoulder": 46,
"shoulderToWrist": 68,
"wristCircumference": 19,
"seatCircumference": 108,
"inseam": 91,
"seatDepth": 20,
"hipsToUpperLeg": 22,
"upperLegCircumference": 63,
"headCircumference": 59,
"naturalWaistToFloor": 131,
"naturalWaistToSeat": 28
}}
}
var pattern1 = new freesewing.patterns.Aaron(settings1);
pattern1.use(freesewing.plugins.theme);
pattern1.use(freesewing.plugins.designer);
pattern1.draft();
document.getElementById("svg1").innerHTML = pattern1.render();
function pointHover(evt) {
var point = evt.target;
var id = point.id;
var cx = point.getAttribute('x');
var cy = point.getAttribute('y');
var name = point.getAttribute('data-point');
var part = point.getAttribute('data-part');
console.log(name+' ('+cx+', '+cy+') @ '+part);
var scale = 2;
cx = cx-scale*cx;
cy = cy-scale*cy;
point.setAttribute("transform", 'matrix('+scale+', 0, 0, '+scale+', '+cx+', '+cy+')');
pointUnhover(id);
}
function pointUnhover(id) {
setTimeout(function(){
document.getElementById(id).removeAttribute("transform", '');
}, 500);
}
</script>
</body>
</html>