Skip to content

Commit

Permalink
fix(canvas) Correct Pin Outline Positioning (#6595)
Browse files Browse the repository at this point in the history
- Shift pin outlines up and to the left by 0.5, scaled to the scale.
  • Loading branch information
seanparsons authored Oct 29, 2024
1 parent bcbd2e5 commit 764f258
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions editor/src/components/canvas/controls/position-outline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,22 +191,27 @@ interface PinOutlineProps {
scale: number
}

const PinOutlineUnscaledSize = 1

const PinOutline = React.memo((props: PinOutlineProps): JSX.Element => {
const colorTheme = useColorTheme()
const width = props.isHorizontalLine ? props.size : 0
const height = props.isHorizontalLine ? 0 : props.size
const borderTop = props.isHorizontalLine
? `${1 / props.scale}px dashed ${colorTheme.primary.value}`
? `${PinOutlineUnscaledSize / props.scale}px dashed ${colorTheme.primary.value}`
: 'none'
const borderLeft = props.isHorizontalLine
? 'none'
: `${1 / props.scale}px dashed ${colorTheme.primary.value}`
: `${PinOutlineUnscaledSize / props.scale}px dashed ${colorTheme.primary.value}`
const lineLeft = props.startX - PinOutlineUnscaledSize / 2 / props.scale
const lineTop = props.startY - PinOutlineUnscaledSize / 2 / props.scale

return (
<div
style={{
position: 'absolute',
left: props.startX,
top: props.startY,
left: lineLeft,
top: lineTop,
width: width,
height: height,
borderTop: borderTop,
Expand Down

0 comments on commit 764f258

Please sign in to comment.