diff --git a/packages/react-components/src/pattern/group.mjs b/packages/react-components/src/pattern/group.mjs index 51690f21ecb..9eac8c43a21 100644 --- a/packages/react-components/src/pattern/group.mjs +++ b/packages/react-components/src/pattern/group.mjs @@ -1,4 +1,4 @@ -import { forwardRef } from 'react' +import React, { forwardRef } from 'react' export const Group = forwardRef((props, ref) => ( diff --git a/packages/react-components/src/pattern/index.mjs b/packages/react-components/src/pattern/index.mjs index 2c211f3f366..cd9da146dbd 100644 --- a/packages/react-components/src/pattern/index.mjs +++ b/packages/react-components/src/pattern/index.mjs @@ -1,4 +1,4 @@ -import { forwardRef } from 'react' +import React, { forwardRef } from 'react' // Components that can be swizzled import { Svg as DefaultSvg } from './svg.mjs' import { Defs as DefaultDefs } from './defs.mjs' diff --git a/packages/react-components/src/pattern/utils.mjs b/packages/react-components/src/pattern/utils.mjs index 4c7a88e6ac3..faf9fed0605 100644 --- a/packages/react-components/src/pattern/utils.mjs +++ b/packages/react-components/src/pattern/utils.mjs @@ -1,3 +1,5 @@ +import React from 'react' + export const getProps = (obj) => { /** I can't believe it but there seems to be no method on NPM todo this */ const cssKey = (key) => { @@ -36,16 +38,6 @@ export const getProps = (obj) => { return props } -export const dx = (pointA, pointB) => pointB.x - pointA.x -export const dy = (pointA, pointB) => pointB.y - pointA.y -export const rad2deg = (radians) => radians * 57.29577951308232 -export const angle = (pointA, pointB) => { - let rad = Math.atan2(-1 * dy(pointA, pointB), dx(pointA, pointB)) - while (rad < 0) rad += 2 * Math.PI - - return rad2deg(rad) -} - export const withinPartBounds = (point, part) => point.x >= part.topLeft.x && point.x <= part.bottomRight.x && diff --git a/sites/shared/components/workbench/pattern/movable/stack.mjs b/sites/shared/components/workbench/pattern/movable/stack.mjs index 17f5618adb5..599e03cd693 100644 --- a/sites/shared/components/workbench/pattern/movable/stack.mjs +++ b/sites/shared/components/workbench/pattern/movable/stack.mjs @@ -45,7 +45,8 @@ */ import { useRef, useState, useEffect, useCallback } from 'react' import { generateStackTransform, getTransformedBounds } from '@freesewing/core' -import { getProps, angle } from 'pkgs/react-components/src/pattern/utils.mjs' +import { getProps } from 'pkgs/react-components/src/pattern/utils.mjs' +import { angle } from '../utils.mjs' import { drag } from 'd3-drag' import { select } from 'd3-selection' import { Buttons } from './transform-buttons.mjs'