fix borders when element is selected

This commit is contained in:
1ilit 2023-09-19 15:51:11 +03:00
parent 1dd645f1a7
commit 13a2eab410
5 changed files with 43 additions and 22 deletions

View File

@ -61,10 +61,13 @@ export default function Area(props) {
onMouseDown={props.onMouseDown} onMouseDown={props.onMouseDown}
> >
<div <div
className={`${ className={`border-2 ${
hovered hovered
? "border-4 border-dashed border-[#5891db]" ? "border-dashed border-blue-500"
: "border-2 border-slate-400" : selectedElement.element === ObjectType.AREA &&
selectedElement.id === props.areaData.id
? "border-blue-500"
: "border-slate-400"
} w-full h-full cursor-move rounded relative`} } w-full h-full cursor-move rounded relative`}
> >
<div <div
@ -310,7 +313,7 @@ export default function Area(props) {
r={6} r={6}
fill={settings.mode === "light" ? "white" : "rgb(28, 31, 35)"} fill={settings.mode === "light" ? "white" : "rgb(28, 31, 35)"}
stroke="#5891db" stroke="#5891db"
strokeWidth={3} strokeWidth={2}
cursor="nwse-resize" cursor="nwse-resize"
onMouseDown={(e) => handleMouseDown(e, "tl")} onMouseDown={(e) => handleMouseDown(e, "tl")}
/> />
@ -320,7 +323,7 @@ export default function Area(props) {
r={6} r={6}
fill={settings.mode === "light" ? "white" : "rgb(28, 31, 35)"} fill={settings.mode === "light" ? "white" : "rgb(28, 31, 35)"}
stroke="#5891db" stroke="#5891db"
strokeWidth={3} strokeWidth={2}
cursor="nesw-resize" cursor="nesw-resize"
onMouseDown={(e) => handleMouseDown(e, "tr")} onMouseDown={(e) => handleMouseDown(e, "tr")}
/> />
@ -330,7 +333,7 @@ export default function Area(props) {
r={6} r={6}
fill={settings.mode === "light" ? "white" : "rgb(28, 31, 35)"} fill={settings.mode === "light" ? "white" : "rgb(28, 31, 35)"}
stroke="#5891db" stroke="#5891db"
strokeWidth={3} strokeWidth={2}
cursor="nesw-resize" cursor="nesw-resize"
onMouseDown={(e) => handleMouseDown(e, "bl")} onMouseDown={(e) => handleMouseDown(e, "bl")}
/> />
@ -340,7 +343,7 @@ export default function Area(props) {
r={6} r={6}
fill={settings.mode === "light" ? "white" : "rgb(28, 31, 35)"} fill={settings.mode === "light" ? "white" : "rgb(28, 31, 35)"}
stroke="#5891db" stroke="#5891db"
strokeWidth={3} strokeWidth={2}
cursor="nwse-resize" cursor="nwse-resize"
onMouseDown={(e) => handleMouseDown(e, "br")} onMouseDown={(e) => handleMouseDown(e, "br")}
/> />

View File

@ -837,9 +837,6 @@ export default function ControlPanel(props) {
function: resetView, function: resetView,
shortcut: "Ctrl+R", shortcut: "Ctrl+R",
}, },
"View schema": {
function: () => {},
},
Grid: { Grid: {
function: viewGrid, function: viewGrid,
shortcut: "Ctrl+Shift+G", shortcut: "Ctrl+Shift+G",

View File

@ -53,9 +53,17 @@ export default function Note(props) {
props.data.y + props.data.height - r props.data.y + props.data.height - r
} L${props.data.x} ${props.data.y + fold}`} } L${props.data.x} ${props.data.y + fold}`}
fill={props.data.color} fill={props.data.color}
stroke="#665b25" stroke={
hovered
? "rgb(59 130 246)"
: selectedElement.element === ObjectType.NOTE &&
selectedElement.id === props.data.id
? "rgb(59 130 246)"
: "rgb(168 162 158)"
}
strokeDasharray={hovered ? 4 : 0}
strokeLinejoin="round" strokeLinejoin="round"
strokeWidth="0.6" strokeWidth="1.2"
/> />
<path <path
d={`M${props.data.x} ${props.data.y + fold} L${ d={`M${props.data.x} ${props.data.y + fold} L${
@ -66,9 +74,17 @@ export default function Note(props) {
props.data.y + fold props.data.y + fold
} Z`} } Z`}
fill={props.data.color} fill={props.data.color}
stroke="#665b25" stroke={
hovered
? "rgb(59 130 246)"
: selectedElement.element === ObjectType.NOTE &&
selectedElement.id === props.data.id
? "rgb(59 130 246)"
: "rgb(168 162 158)"
}
strokeDasharray={hovered ? 4 : 0}
strokeLinejoin="round" strokeLinejoin="round"
strokeWidth="0.6" strokeWidth="1.2"
/> />
<foreignObject <foreignObject
x={props.data.x} x={props.data.x}

View File

@ -23,6 +23,7 @@ import {
TextArea, TextArea,
Card, Card,
Checkbox, Checkbox,
InputNumber,
TagInput, TagInput,
Row, Row,
Col, Col,
@ -77,10 +78,13 @@ export default function Table(props) {
}} }}
> >
<div <div
className={`border-2 border-gray-400 ${ className={`border-2 ${
props.active && !props.moving && "border-blue-500 border-4" isHovered
} ${ ? "border-dashed border-blue-500"
props.moving && "border-blue-500 border-4 border-dashed" : selectedElement.element === ObjectType.TABLE &&
selectedElement.id === props.tableData.id
? "border-blue-500"
: "border-slate-400"
} select-none rounded-lg w-full ${ } select-none rounded-lg w-full ${
settings.mode === "light" settings.mode === "light"
? "bg-zinc-100 text-zinc-800" ? "bg-zinc-100 text-zinc-800"
@ -519,8 +523,8 @@ export default function Table(props) {
{f.type === "VARCHAR" && ( {f.type === "VARCHAR" && (
<> <>
<div className="font-semibold">Length</div> <div className="font-semibold">Length</div>
<Input <InputNumber
className="my-2" className="my-2 w-full"
placeholder="Set length" placeholder="Set length"
value={f.length} value={f.length}
onChange={(value) => onChange={(value) =>

View File

@ -15,6 +15,7 @@ import {
Button, Button,
Card, Card,
TagInput, TagInput,
InputNumber,
Popover, Popover,
Checkbox, Checkbox,
Select, Select,
@ -342,8 +343,8 @@ export default function TableOverview(props) {
{f.type === "VARCHAR" && ( {f.type === "VARCHAR" && (
<> <>
<div className="font-semibold">Length</div> <div className="font-semibold">Length</div>
<Input <InputNumber
className="my-2" className="my-2 w-full"
placeholder="Set length" placeholder="Set length"
value={f.length} value={f.length}
onChange={(value) => onChange={(value) =>