1
0
Fork 0

documenting code

This commit is contained in:
Enoch Riese 2022-08-14 16:50:16 -05:00
parent 1f19883455
commit 4a0f3f65a6
12 changed files with 69 additions and 27 deletions

View file

@ -5,9 +5,15 @@ import Part from './part'
import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch"
const Draft = props => {
const { patternProps, gist, updateGist, app, bgProps={}, fitLayoutPart = false, layoutType="printLayout"} = props
const { draft, patternProps, gist, updateGist, app, bgProps={}, fitLayoutPart = false, layoutType="printingLayout"} = props
// keep a fresh copy of the layout because we might manipulate it without saving to the gist
let layout = draft.settings.layout === true ? {
...patternProps.autoLayout,
width: patternProps.width,
height: patternProps.height
} : {...draft.settings.layout}
let layout = {...props.layout}
const svgRef = useRef(null);
if (!patternProps) return null
@ -43,7 +49,7 @@ const Draft = props => {
if (history) {
updateGist(['layouts', layoutType], newLayout, history)
} else {
// we don't put it in the gist if it shouldn't contribute to history because we need some the data calculated here for rendering purposes on the initial layout, but we don't want to actually save a layout until the user manipulates it
// we don't put it in the gist if it shouldn't contribute to history because we need some of the data calculated here for rendering purposes on the initial layout, but we don't want to actually save a layout until the user manipulates it. This is what allows the layout to respond appropriately to settings changes. Once the user has starting playing with the layout, all bets are off
layout = newLayout
}
}