131 lines
3.8 KiB
HTML
131 lines
3.8 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Brian</title>
|
|
</head>
|
|
<body>
|
|
<div id="svg"></div>
|
|
<script type="text/javascript" src="freesewing.js"></script>
|
|
<script type="text/javascript" src="tmp/cutonfold.js"></script>
|
|
<script type="text/javascript" src="tmp/dimension.js"></script>
|
|
<script type="text/javascript" src="tmp/logo.js"></script>
|
|
<script type="text/javascript" src="tmp/title.js"></script>
|
|
<script type="text/javascript" src="dist/browser.js"></script>
|
|
<script type="text/javascript" src="tmp/theme.js"></script>
|
|
<script type="text/javascript" src="tmp/designer.js"></script>
|
|
<script type="text/javascript" src="tmp/models.js"></script>
|
|
<script type="text/javascript" src="tmp/antmantest.js"></script>
|
|
<script>
|
|
var debug = {
|
|
name: 'debug',
|
|
hooks: {
|
|
debug: function (next, d='',e='',b='',u='',g='') {
|
|
console.log('%cDebug', 'color: #dd69dd; font-weight: bold', d,e,b,u,g);
|
|
next();
|
|
}
|
|
}
|
|
};
|
|
var pattern = freesewing.patterns.brian
|
|
.with(debug)
|
|
.with(freesewing.plugins.theme)
|
|
.with(freesewing.plugins.designer)
|
|
/*
|
|
pattern.on('preSample', function(next) {
|
|
console.log('preSample hook');
|
|
next();
|
|
});
|
|
|
|
pattern.on('postSample', function(next) {
|
|
console.log('postSample hook');
|
|
next();
|
|
});
|
|
|
|
pattern.on('preDraft', function(next) {
|
|
console.log('preDraft hook', JSON.parse(JSON.stringify(this)));
|
|
next();
|
|
});
|
|
|
|
pattern.on('postDraft', function(next) {
|
|
console.log('postDraft hook', JSON.parse(JSON.stringify(this)));
|
|
next();
|
|
});
|
|
|
|
pattern.on('preRender', function(next) {
|
|
console.log('preRender hook', this);
|
|
next();
|
|
});
|
|
|
|
pattern.on('postRender', function(next) {
|
|
console.log('postRender hook', this);
|
|
next();
|
|
});
|
|
|
|
pattern.on('preDraft', function(next) {
|
|
console.log('%cpreDraft hook', 'color: red', this);
|
|
next();
|
|
});
|
|
|
|
pattern.on('postDraft', function(next) {
|
|
console.log('%cpostDraft hook', 'color: red', this);
|
|
next();
|
|
});
|
|
|
|
pattern.on('insertText', function(next) {
|
|
console.log('%cinsertText hook', 'color: red', this.text);
|
|
this.text = this.text.toUpperCase();
|
|
next();
|
|
});
|
|
*/
|
|
pattern.on('preDraft', function(next) {
|
|
console.log('%cpreDraft hook', 'color: red', this);
|
|
for(let m in this.config.measurements) {
|
|
let measurement = this.config.measurements[m];
|
|
if(!this.context.settings.measurements[measurement]) {
|
|
this.debug('Missing measurement:', measurement);
|
|
this.debug('All measurements:', this.settings.measurements);
|
|
throw `Missing measurement: ${measurement}`;
|
|
}
|
|
}
|
|
next();
|
|
});
|
|
|
|
//pattern.settings.paperless = true;
|
|
|
|
pattern.settings.measurements = freesewing.models.men.manSize36;
|
|
|
|
pattern.settings.sa = 10;
|
|
pattern.settings.units = 'metric';
|
|
pattern.settings.sample = {
|
|
type: 'measurement',
|
|
measurement: 'shoulderToShoulder'
|
|
}
|
|
pattern.debug('debug test from index', 'foo');
|
|
//pattern.sampleOption('sleeveLengthBonus');
|
|
//pattern.sampleMeasurement('bicepsCircumference');
|
|
//pattern.sampleModels(freesewing.antmantest);
|
|
pattern.draft();
|
|
document.getElementById("svg").innerHTML = pattern.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>
|