pass partname to part pieces
This commit is contained in:
parent
11e29e1447
commit
2e09f31c99
2 changed files with 5 additions and 5 deletions
|
@ -76,7 +76,7 @@ const Draft = props => {
|
|||
].map(list => list.map(name => (
|
||||
<Part {...{
|
||||
key:name,
|
||||
name,
|
||||
partName: name,
|
||||
part: patternProps.parts[name],
|
||||
layout,
|
||||
app,
|
||||
|
|
|
@ -78,9 +78,9 @@ const Buttons = ({ transform, flip, rotate, setRotate, resetPart }) => {
|
|||
}
|
||||
|
||||
const Part = props => {
|
||||
const { layout, name, part} = props
|
||||
const { layout, part, partName} = props
|
||||
|
||||
const partLayout = layout.parts?.[name]
|
||||
const partLayout = layout.parts?.[partName]
|
||||
|
||||
// Don't just assume this makes sense
|
||||
if (typeof partLayout?.move?.x === 'undefined') return null
|
||||
|
@ -176,7 +176,7 @@ const Part = props => {
|
|||
const tl = domToSvg({x: partRect.left, y: partRect.top});
|
||||
const br = domToSvg({x: partRect.right, y: partRect.bottom});
|
||||
|
||||
props.updateLayout(name, {
|
||||
props.updateLayout(partName, {
|
||||
move: {
|
||||
x: translateX,
|
||||
y: translateY,
|
||||
|
@ -199,7 +199,7 @@ const Part = props => {
|
|||
return (
|
||||
<g
|
||||
{...getProps(part)}
|
||||
id={`part-${name}`}
|
||||
id={`part-${partName}`}
|
||||
ref={props.name === 'pages' ? null : partRef}
|
||||
onClick={toggleDragRotate}
|
||||
transform-origin={`${center.x} ${center.y}`}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue