fix(sandy): Typo and prefer const to let
This commit is contained in:
parent
49b5538930
commit
be7a4b2617
5 changed files with 17 additions and 16 deletions
|
@ -6,7 +6,7 @@ export default function (part) {
|
||||||
* and intenal radius and angle calculated from measurements
|
* and intenal radius and angle calculated from measurements
|
||||||
* and options
|
* and options
|
||||||
*/
|
*/
|
||||||
let {
|
const {
|
||||||
utils,
|
utils,
|
||||||
store,
|
store,
|
||||||
sa,
|
sa,
|
||||||
|
@ -25,7 +25,8 @@ export default function (part) {
|
||||||
// Calculate the angle of the ring sector and the radius of the upper arc
|
// Calculate the angle of the ring sector and the radius of the upper arc
|
||||||
const an =
|
const an =
|
||||||
utils.rad2deg(store.get('bottomCircumference') - store.get('topCircumference')) /
|
utils.rad2deg(store.get('bottomCircumference') - store.get('topCircumference')) /
|
||||||
absuluteOptions.waistbandWidth
|
absoluteOptions.waistbandWidth
|
||||||
|
|
||||||
|
|
||||||
const rad = store.get('topCircumference') / utils.deg2rad(an)
|
const rad = store.get('topCircumference') / utils.deg2rad(an)
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
const draftRingSector = (part, rot, an, radIn, radEx, rotate = false) => {
|
const draftRingSector = (part, rot, an, radIn, radEx, rotate = false) => {
|
||||||
let { utils, Point, points, Path } = part.shorthand()
|
const { utils, Point, points, Path } = part.shorthand()
|
||||||
|
|
||||||
const roundExtended = (radius, angle = 90) => {
|
const roundExtended = (radius, angle = 90) => {
|
||||||
let arg = utils.deg2rad(angle / 2)
|
const arg = utils.deg2rad(angle / 2)
|
||||||
|
|
||||||
return (radius * 4 * (1 - Math.cos(arg))) / Math.sin(arg) / 3
|
return (radius * 4 * (1 - Math.cos(arg))) / Math.sin(arg) / 3
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,8 @@ const draftRingSector = (part, rot, an, radIn, radEx, rotate = false) => {
|
||||||
* Calculates the distance of the control point for the internal
|
* Calculates the distance of the control point for the internal
|
||||||
* and external arcs using bezierCircleExtended
|
* and external arcs using bezierCircleExtended
|
||||||
*/
|
*/
|
||||||
let distIn = roundExtended(radIn, an / 2)
|
const distIn = roundExtended(radIn, an / 2)
|
||||||
let distEx = roundExtended(radEx, an / 2)
|
const distEx = roundExtended(radEx, an / 2)
|
||||||
// The centre of the circles
|
// The centre of the circles
|
||||||
points.center = new Point(0, 0)
|
points.center = new Point(0, 0)
|
||||||
|
|
||||||
|
@ -64,11 +64,11 @@ const draftRingSector = (part, rot, an, radIn, radEx, rotate = false) => {
|
||||||
points.ex2C = points.ex2.shift(an / 2 + 180, distEx)
|
points.ex2C = points.ex2.shift(an / 2 + 180, distEx)
|
||||||
|
|
||||||
// Flip all the points to generate the full ring sector
|
// Flip all the points to generate the full ring sector
|
||||||
for (let id of ['in2', 'in2C', 'in1C', 'ex1C', 'ex2C', 'ex2'])
|
for (const id of ['in2', 'in2C', 'in1C', 'ex1C', 'ex2C', 'ex2'])
|
||||||
points[id + 'Flipped'] = points[id].flipX()
|
points[id + 'Flipped'] = points[id].flipX()
|
||||||
|
|
||||||
// Rotate all the points an angle rot
|
// Rotate all the points an angle rot
|
||||||
for (let id of [
|
for (const id of [
|
||||||
'in1',
|
'in1',
|
||||||
'in1C',
|
'in1C',
|
||||||
'in2',
|
'in2',
|
||||||
|
@ -88,8 +88,8 @@ const draftRingSector = (part, rot, an, radIn, radEx, rotate = false) => {
|
||||||
|
|
||||||
if (rotate) {
|
if (rotate) {
|
||||||
// Rotate all points so the line from in1Rotated to ex1Rotated is vertical
|
// Rotate all points so the line from in1Rotated to ex1Rotated is vertical
|
||||||
let deg = 270 - points.in2Flipped.angle(points.ex2Flipped)
|
const deg = 270 - points.in2Flipped.angle(points.ex2Flipped)
|
||||||
for (let id in points) {
|
for (const id in points) {
|
||||||
points[id] = points[id].rotate(deg, points.in2Flipped)
|
points[id] = points[id].rotate(deg, points.in2Flipped)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import draftRingSector from './shared'
|
import draftRingSector from './shared'
|
||||||
|
|
||||||
export default function (part) {
|
export default function (part) {
|
||||||
let {
|
const {
|
||||||
utils,
|
utils,
|
||||||
store,
|
store,
|
||||||
sa,
|
sa,
|
||||||
|
@ -75,7 +75,7 @@ export default function (part) {
|
||||||
* fabric
|
* fabric
|
||||||
*/
|
*/
|
||||||
if (an > 90 && sa) {
|
if (an > 90 && sa) {
|
||||||
let maxAn = utils.rad2deg(Math.atan(radiusWaist / sa))
|
const maxAn = utils.rad2deg(Math.atan(radiusWaist / sa))
|
||||||
if (an > 90 + maxAn) an = 90 + maxAn
|
if (an > 90 + maxAn) an = 90 + maxAn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,14 +83,14 @@ export default function (part) {
|
||||||
* The radius of the hem arc is the radius of the waist
|
* The radius of the hem arc is the radius of the waist
|
||||||
* arc with the length of the skirt added
|
* arc with the length of the skirt added
|
||||||
*/
|
*/
|
||||||
let radiusHem =
|
const radiusHem =
|
||||||
radiusWaist + store.get('fullLength') * options.lengthBonus - absoluteOptions.waistbandWidth
|
radiusWaist + store.get('fullLength') * options.lengthBonus - absoluteOptions.waistbandWidth
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ring sector will be rotated an angle an/2 so we
|
* The ring sector will be rotated an angle an/2 so we
|
||||||
* display the part with one edge of the skirt vertical
|
* display the part with one edge of the skirt vertical
|
||||||
*/
|
*/
|
||||||
let rot = an / 2
|
const rot = an / 2
|
||||||
|
|
||||||
// Call draftRingSector to draft the part
|
// Call draftRingSector to draft the part
|
||||||
paths.seam = draftRingSector(part, rot, an, radiusWaist, radiusHem, true).attr('class', 'fabric')
|
paths.seam = draftRingSector(part, rot, an, radiusWaist, radiusHem, true).attr('class', 'fabric')
|
||||||
|
|
|
@ -3,7 +3,7 @@ export default function (part) {
|
||||||
* The straight waistband is just a rectangle with the width
|
* The straight waistband is just a rectangle with the width
|
||||||
* of double the waistband width, since it will be folded
|
* of double the waistband width, since it will be folded
|
||||||
*/
|
*/
|
||||||
let {
|
const {
|
||||||
store,
|
store,
|
||||||
sa,
|
sa,
|
||||||
Point,
|
Point,
|
||||||
|
|
|
@ -2,7 +2,7 @@ import straightWaistband from './straight-waistband'
|
||||||
import curvedWaistband from './curved-waistband'
|
import curvedWaistband from './curved-waistband'
|
||||||
|
|
||||||
export default (part) => {
|
export default (part) => {
|
||||||
let { options } = part.shorthand()
|
const { options } = part.shorthand()
|
||||||
|
|
||||||
if (options.waistbandShape === 'curved') return curvedWaistband(part)
|
if (options.waistbandShape === 'curved') return curvedWaistband(part)
|
||||||
else return straightWaistband(part)
|
else return straightWaistband(part)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue