get pages to render properly on pdf export when settings.only is an array
This commit is contained in:
parent
b12696dcfa
commit
4bdbddb3d6
3 changed files with 20 additions and 2 deletions
|
@ -241,6 +241,7 @@ Pattern.prototype.getRenderProps = function () {
|
|||
})),
|
||||
}
|
||||
|
||||
svg.__runHooks('postRender')
|
||||
return props
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ const Stack = (props) => {
|
|||
const { layout, stack, stackName, gist } = props
|
||||
|
||||
const stackLayout = layout.stacks?.[stackName]
|
||||
const stackExists = typeof stackLayout?.move?.x !== 'undefined'
|
||||
|
||||
// Use a ref for direct DOM manipulation
|
||||
const stackRef = useRef(null)
|
||||
|
@ -75,12 +76,12 @@ const Stack = (props) => {
|
|||
// Initialize drag handler
|
||||
useEffect(() => {
|
||||
// don't drag the pages
|
||||
if (props.isLayoutPart) return
|
||||
if (props.isLayoutPart || !stackExists) return
|
||||
handleDrag(select(stackRef.current))
|
||||
}, [rotate, stackRef, stackLayout])
|
||||
|
||||
// // Don't just assume this makes sense
|
||||
if (typeof stackLayout?.move?.x === 'undefined') return null
|
||||
if (!stackExists) return null
|
||||
|
||||
// These are kept as vars because re-rendering on drag would kill performance
|
||||
// Managing the difference between re-render and direct DOM updates makes this
|
||||
|
|
|
@ -165,6 +165,22 @@ const basePlugin = ({
|
|||
pattern.height = sheetHeight * generatedPageData.rows
|
||||
}
|
||||
},
|
||||
preRender: function (svg) {
|
||||
const pattern = svg.pattern
|
||||
const only = pattern.settings[pattern.activeStack || 0].only
|
||||
// add the layout part to the include list if there is one so that it gets rendered
|
||||
if (Array.isArray(only) && !only.includes(partName)) {
|
||||
pattern.settings[pattern.activeStack || 0].only.push(partName)
|
||||
}
|
||||
},
|
||||
postRender: function (svg) {
|
||||
const pattern = svg.pattern
|
||||
const only = pattern.settings[pattern.activeStack || 0].only
|
||||
// remove the layout part from the include list if there is one so that we don't pollute the settings
|
||||
if (Array.isArray(only) && only.includes(partName)) {
|
||||
pattern.settings[pattern.activeStack || 0].only.splice(only.indexOf(partName), 1)
|
||||
}
|
||||
},
|
||||
},
|
||||
macros: {
|
||||
/** draft the pages */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue