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 options
|
||||
*/
|
||||
let {
|
||||
const {
|
||||
utils,
|
||||
store,
|
||||
sa,
|
||||
|
@ -25,7 +25,8 @@ export default function (part) {
|
|||
// Calculate the angle of the ring sector and the radius of the upper arc
|
||||
const an =
|
||||
utils.rad2deg(store.get('bottomCircumference') - store.get('topCircumference')) /
|
||||
absuluteOptions.waistbandWidth
|
||||
absoluteOptions.waistbandWidth
|
||||
|
||||
|
||||
const rad = store.get('topCircumference') / utils.deg2rad(an)
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
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) => {
|
||||
let arg = utils.deg2rad(angle / 2)
|
||||
const arg = utils.deg2rad(angle / 2)
|
||||
|
||||
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
|
||||
* and external arcs using bezierCircleExtended
|
||||
*/
|
||||
let distIn = roundExtended(radIn, an / 2)
|
||||
let distEx = roundExtended(radEx, an / 2)
|
||||
const distIn = roundExtended(radIn, an / 2)
|
||||
const distEx = roundExtended(radEx, an / 2)
|
||||
// The centre of the circles
|
||||
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)
|
||||
|
||||
// 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()
|
||||
|
||||
// Rotate all the points an angle rot
|
||||
for (let id of [
|
||||
for (const id of [
|
||||
'in1',
|
||||
'in1C',
|
||||
'in2',
|
||||
|
@ -88,8 +88,8 @@ const draftRingSector = (part, rot, an, radIn, radEx, rotate = false) => {
|
|||
|
||||
if (rotate) {
|
||||
// Rotate all points so the line from in1Rotated to ex1Rotated is vertical
|
||||
let deg = 270 - points.in2Flipped.angle(points.ex2Flipped)
|
||||
for (let id in points) {
|
||||
const deg = 270 - points.in2Flipped.angle(points.ex2Flipped)
|
||||
for (const id in points) {
|
||||
points[id] = points[id].rotate(deg, points.in2Flipped)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import draftRingSector from './shared'
|
||||
|
||||
export default function (part) {
|
||||
let {
|
||||
const {
|
||||
utils,
|
||||
store,
|
||||
sa,
|
||||
|
@ -75,7 +75,7 @@ export default function (part) {
|
|||
* fabric
|
||||
*/
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -83,14 +83,14 @@ export default function (part) {
|
|||
* The radius of the hem arc is the radius of the waist
|
||||
* arc with the length of the skirt added
|
||||
*/
|
||||
let radiusHem =
|
||||
const radiusHem =
|
||||
radiusWaist + store.get('fullLength') * options.lengthBonus - absoluteOptions.waistbandWidth
|
||||
|
||||
/**
|
||||
* The ring sector will be rotated an angle an/2 so we
|
||||
* display the part with one edge of the skirt vertical
|
||||
*/
|
||||
let rot = an / 2
|
||||
const rot = an / 2
|
||||
|
||||
// Call draftRingSector to draft the part
|
||||
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
|
||||
* of double the waistband width, since it will be folded
|
||||
*/
|
||||
let {
|
||||
const {
|
||||
store,
|
||||
sa,
|
||||
Point,
|
||||
|
|
|
@ -2,7 +2,7 @@ import straightWaistband from './straight-waistband'
|
|||
import curvedWaistband from './curved-waistband'
|
||||
|
||||
export default (part) => {
|
||||
let { options } = part.shorthand()
|
||||
const { options } = part.shorthand()
|
||||
|
||||
if (options.waistbandShape === 'curved') return curvedWaistband(part)
|
||||
else return straightWaistband(part)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue