feat: updates connector styling

This commit is contained in:
Mark Mankarious
2023-08-18 18:27:42 +01:00
parent e21ed39c78
commit d980947e86
2 changed files with 10 additions and 8 deletions

View File

@@ -62,9 +62,9 @@ export const Connector = ({ connector }: Props) => {
const strokeDashArray = useMemo(() => {
switch (connector.style) {
case 'DASHED':
return `${connectorWidthPx * 1.5}, ${connectorWidthPx * 1.5}`;
return `${connectorWidthPx * 2}, ${connectorWidthPx * 2}`;
case 'DOTTED':
return `0, ${connectorWidthPx * 1.4}`;
return `0, ${connectorWidthPx * 1.8}`;
case 'SOLID':
default:
return 'none';
@@ -84,6 +84,7 @@ export const Connector = ({ connector }: Props) => {
strokeWidth={connectorWidthPx * 1.4}
strokeLinecap="round"
strokeLinejoin="round"
strokeOpacity={0.7}
strokeDasharray={strokeDashArray}
fill="none"
/>
@@ -104,6 +105,7 @@ export const Connector = ({ connector }: Props) => {
position={CoordsUtils.add(anchor, drawOffset)}
radius={18 * zoom}
fill={theme.palette.common.white}
fillOpacity={0.7}
/>
<Circle
position={CoordsUtils.add(anchor, drawOffset)}

View File

@@ -416,12 +416,6 @@ export const getItemAtTile = ({
if (node) return node;
const rectangle = scene.rectangles.find(({ from, to }) => {
return isWithinBounds(tile, [from, to]);
});
if (rectangle) return rectangle;
const connector = scene.connectors.find((con) => {
return con.path.tiles.find((pathTile) => {
const globalPathTile = connectorPathTileToGlobal(
@@ -435,5 +429,11 @@ export const getItemAtTile = ({
if (connector) return connector;
const rectangle = scene.rectangles.find(({ from, to }) => {
return isWithinBounds(tile, [from, to]);
});
if (rectangle) return rectangle;
return null;
};