Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LayoutTree: Factor out DropCliff component #2396

Open
raineorshine opened this issue Sep 14, 2024 · 0 comments
Open

LayoutTree: Factor out DropCliff component #2396

raineorshine opened this issue Sep 14, 2024 · 0 comments
Labels
refactor Refactor without changing behavior

Comments

@raineorshine
Copy link
Contributor

{/* DropEnd (cliff) */}
{dragInProgress &&
cliff < 0 &&
// do not render hidden cliffs
// rough autofocus estimate
autofocusDepth - depth < 2 &&
Array(-cliff)
.fill(0)
.map((x, i) => {
const pathEnd = -(cliff + i) < path.length ? (path.slice(0, cliff + i) as Path) : HOME_PATH
const cliffDepth = unroot(pathEnd).length
// After table col2, shift the DropEnd left by the width of col1.
// This correctly positions the drop target for dropping after the table view.
// Otherwise it would be too far to the right.
const dropEndMarginLeft =
isTableCol2 && cliffDepth - depth < 0 ? treeThoughtsPositioned[index - 1].width || 0 : 0
return (
<div
key={'DropEnd-' + head(pathEnd)}
className='z-index-subthoughts-drop-end'
style={{
position: 'relative',
top: '-0.2em',
left: `calc(${cliffDepth - depth}em - ${dropEndMarginLeft}px + ${isTouch ? -1 : 1}px)`,
transition: 'left 0.15s ease-out',
}}
>
<DropEnd
depth={pathEnd.length}
path={pathEnd}
// Extend the click area of the drop target when there is nothing below.
// The last visible drop-end will always be a dimmed thought at distance 1 (an uncle).
// Dimmed thoughts at distance 0 should not be extended, as they are dimmed siblings and sibling descendants that have thoughts below
// last={!nextChildId}
/>
</div>
)
})}

@raineorshine raineorshine added the refactor Refactor without changing behavior label Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Refactor without changing behavior
Projects
None yet
Development

No branches or pull requests

1 participant