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 * {
|
.tl-container * {
|
||||||
user-select: none;
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,30 @@ export const Rectangle = new ShapeUtil<RectangleShape, SVGSVGElement, TLDrawMeta
|
||||||
},
|
},
|
||||||
|
|
||||||
Indicator({ shape }) {
|
Indicator({ 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 <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) {
|
getBounds(shape) {
|
||||||
|
|
|
@ -162,6 +162,7 @@ export const Text = new ShapeUtil<TextShape, HTMLDivElement, TLDrawMeta>(() => (
|
||||||
style={{
|
style={{
|
||||||
font,
|
font,
|
||||||
color: styles.stroke,
|
color: styles.stroke,
|
||||||
|
userSelect: isEditing ? 'all' : 'none',
|
||||||
}}
|
}}
|
||||||
name="text"
|
name="text"
|
||||||
defaultValue={text}
|
defaultValue={text}
|
||||||
|
|
Ładowanie…
Reference in New Issue