kopia lustrzana https://github.com/Tldraw/Tldraw
Fix outline on non-draw-style rectangles
rodzic
31638c7c90
commit
639f2412d1
|
@ -130,7 +130,6 @@ const tlcss = css`
|
|||
}
|
||||
|
||||
.tl-container * {
|
||||
user-select: none;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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}
|
||||
|
|
Ładowanie…
Reference in New Issue