Skip to content

Commit 397bbcf

Browse files
committed
roll top initial generator
1 parent 68bfaec commit 397bbcf

File tree

3 files changed

+185
-159
lines changed

3 files changed

+185
-159
lines changed

Notes.md

+3-11
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,11 @@ Replace built in gallery lightbox with poptrox
2121

2222
## Community Build Galleries -- Done
2323

24-
* resize images to 540x720 for portrait, 800x600 for landscape
25-
* `gallery style1 small`
26-
27-
2824
## Page Status
2925

30-
| Page | poptrox | footer | community builds | complete |
31-
|---|:-:|:-:|:-:|:-:|
32-
| bpStembag | x | x | x | x |
33-
| edcFannyPack | x | x | x | x |
34-
| runningBelt | x | x | x | x |
35-
| trailrunpack | x | x | x | x |
36-
| index | | | | x |
26+
Cinch Sack - done
27+
Stuff Sack - done
28+
Roll Top - redo based on cinch sack
3729

3830

3931
## Future

assets/js/rolltopsack.js

+52-54
Original file line numberDiff line numberDiff line change
@@ -9,55 +9,45 @@ function roundToEigthInch (number) {
99
return number;
1010
}
1111

12-
function patternSize(units,collar,bL,bW,h) {
12+
function patternSize(units,bL,bW,h) {
1313
if (units==1) { // METRIC
14-
var csA = 4; // cord channel height (4cm)
15-
var rt = 9; // roll top height (9 cm)
16-
var hemA = 1; // single fold hem allowance on each end of channel (1 cm)
17-
var hemRt = 4; // double fold hem allowance at top edge of roll top for 20mm webbing
18-
var sA = 1; // general seam allowance (1 cm)
14+
var rt = 12; // roll-top collar height (12 cm)
15+
var hem = 4; // double fold hem allowance at top of collar (20 mm webbing)
16+
var sA = 1.5; // general seam allowance (1.5 cm) for french seams
1917
}
2018
else { // IMPERIAL
21-
var csA = 1.5; // cord channel height (1.5")
22-
var rt = 3.5; // roll top height (3.5")
23-
var hemA = 0.5; // single fold hem allowance on each end of channel (0.5")
24-
var hemRt = 1.5; // double fold hem allowance at top edge of roll top for 3/4" webbing
25-
var sA = 0.5; // general seam allowance (0.5")
19+
var rt = 4.5; // roll-top collar height (4.5") 3/4" webbing rolled 4 times
20+
var hem = 1.5; // double fold hem allowance at top of collar (0.75" webbing)
21+
var sA = 5/8; // general seam allowance (5/8") for french seams
2622
}
2723

28-
if (collar==1) { // roll-top
29-
var collarh = rt; // open height minus roll top
30-
var channelH = collarh + 2*hemRt + sA; //roll top height with hem and SA
31-
var fabricH = h + bW + (2*sA); // height
32-
}
33-
else { // drawcord cinch
34-
var collarh = 2*csA; // cSA folded on itself
35-
var channelH = collarh + (2*sA); // SA on top and bottom
36-
var fabricH = h + bW - csA + (2*sA); // height accounts for width and channel
37-
}
3824

39-
if (bL,bW > 0) {
40-
//main body fabric panel
41-
var fabricL = 2*bL + 2*bW + 2*sA;
42-
43-
// separate cord channel
44-
var channelL = 2*bL + 2*bW + 2*hemA; //hem on each end
25+
// body fabric panel
26+
var fabricL = 2*bL + (2*bW) + (2*sA);
27+
var rollTopH = rt + hem; // roll-top height + top hem
28+
var webbingL = bL + bW + 2*hem; //adds hem on each end to fold under
4529

46-
if (units==1) {
47-
var fabricL = fabricL.toFixed(1); //trimming to closest mm
48-
var fabricH = fabricH.toFixed(1);
49-
var channelL = channelL.toFixed(1);
50-
var channelH = channelH.toFixed(1);
30+
if (bW > 3) { // add material so top will close when bW is wide
31+
var fabricH = h + bW + sA + rollTopH; // adds (1/2bW) to top of fabricH to make up additional width
32+
}
33+
else {
34+
var fabricH = h + (0.5*bW) + sA + rollTopH; // 1/2bW is the corner cut off bottom to make rectangular
5135
}
52-
else {
53-
var fabricL = roundToEigthInch(fabricL); //rounding to nearest 1/8" increment
54-
var fabricH = roundToEigthInch(fabricH);
55-
var channelL = roundToEigthInch(channelL);
56-
var channelH = roundToEigthInch(channelH);
57-
}
58-
59-
return [fabricL, fabricH, channelL, channelH, sA]; //
36+
37+
38+
39+
// rounding dimensions for output
40+
if (units==1) {
41+
var fabricL = fabricL.toFixed(1); //trimming to closest mm
42+
var fabricH = fabricH.toFixed(1);
6043
}
44+
else {
45+
var fabricL = roundToEigthInch(fabricL); //rounding to nearest 1/8" increment
46+
var fabricH = roundToEigthInch(fabricH);
47+
}
48+
49+
return [fabricL, fabricH, sA, hem, webbingL];
50+
6151
};
6252

6353

@@ -71,34 +61,42 @@ $('document').ready(function () {
7161
$('.dimension').change(function () { //when any .dimension changes (input loses focus), function runs
7262

7363
var units = $( "input[type=radio][name=units]:checked" ).val(); // inches (val=0) or cm (val=1)
74-
var collar = $( "input[type=radio][name=collar]:checked" ).val(); // cinch (val=0) or roll-top (val=1)
7564

76-
// assign variables based on input id values from html form
77-
var bottomLength = Number($('#bottomLength').val());
78-
var bottomWidth = Number($('#bottomWidth').val());
79-
var totalHeight = Number($('#height').val());
65+
// assign variables based on input id values from html form.
66+
//Ensure object is number otherwise arithmetic is screwy
67+
var bottomLength = Number( $('#bottomLength').val() );
68+
var bottomWidth = Number( $('#bottomWidth').val() );
69+
var sackHeight = Number( $('#height').val() );
70+
71+
var halfBottomWidth = bottomWidth / 2; //used to size bottom corner within instructions
72+
var halfTop = bottomLength + bottomWidth; //used to size length of webbing along roll-top
8073

81-
if (bottomLength, bottomWidth, totalHeight != 0) {
82-
var scrap = patternSize(units,collar,bottomLength,bottomWidth,totalHeight);
74+
if (bottomLength > 1 && bottomWidth > 0 && sackHeight > 1) { // html input min=1, crappy validation but works
75+
var scrap = patternSize(units, bottomLength, bottomWidth, sackHeight);
8376
var fabricL = scrap[0];
8477
var fabricH = scrap[1];
85-
var channelL = scrap[2];
86-
var channelH = scrap[3];
8778
if (units == 1) {
8879
var unitText = " cm";
89-
var sA = scrap[4];
80+
var sA = scrap[2];
81+
var hem = scrap[3];
9082
}
9183
else {
9284
var unitText = " in";
93-
var sA = scrap[4];
85+
var sA = "5/8";
86+
var hem = scrap[3];
9487
}
88+
var webbingLength = scrap[4];
9589

96-
/* html id returns */
90+
// html id returns
9791
$('.patternLength').html(fabricL + unitText);
9892
$('.patternHeight').html(fabricH + unitText);
99-
$('.channelLength').html(channelL + unitText);
100-
$('.channelHeight').html(channelH + unitText);
10193
$('.sA').html(sA + unitText);
94+
$('.hem').html(hem + unitText);
95+
$('.bottomWidth').html(bottomWidth + unitText);
96+
$('.halfBottomWidth').html(halfBottomWidth + unitText);
97+
$('.bottomLength').html(bottomLength + unitText);
98+
$('.webbingLength').html(webbingLength + unitText);
99+
$('.halfTop').html(halfTop + unitText);
102100

103101
}
104102
});

0 commit comments

Comments
 (0)