Fix outline on non-draw-style rectangles

fix-deleted-arrows
Steve Ruiz 2021-09-24 12:02:49 +01:00
rodzic 31638c7c90
commit 639f2412d1
3 zmienionych plików z 25 dodań i 2 usunięć

Wyświetl plik

@ -130,7 +130,6 @@ const tlcss = css`
}
.tl-container * {
user-select: none;
box-sizing: border-box;
}

Wyświetl plik

@ -134,7 +134,30 @@ export const Rectangle = new ShapeUtil<RectangleShape, SVGSVGElement, TLDrawMeta
},
Indicator({ shape }) {
return <path d={getRectangleIndicatorPathData(shape)} />
const {
style,
size: [width, height],
} = shape
const styles = getShapeStyle(style, false)
const strokeWidth = +styles.strokeWidth
const sw = strokeWidth
if (style.dash === DashStyle.Draw) {
return <path d={getRectangleIndicatorPathData(shape)} />
}
return (
<rect
x={sw}
y={sw}
rx={1}
ry={1}
width={Math.max(1, width - sw * 2)}
height={Math.max(1, height - sw * 2)}
/>
)
},
getBounds(shape) {

Wyświetl plik

@ -162,6 +162,7 @@ export const Text = new ShapeUtil<TextShape, HTMLDivElement, TLDrawMeta>(() => (
style={{
font,
color: styles.stroke,
userSelect: isEditing ? 'all' : 'none',
}}
name="text"
defaultValue={text}