mirror of
https://github.com/stan-smith/FossFLOW.git
synced 2025-12-24 06:58:48 -05:00
feat: Add option to toggle connector arrows
Implements a toggle switch in the connector controls menu that allows users to show or hide arrows on individual connectors. Arrows are shown by default for new connectors but can be toggled off for each connector independently. Closes #74
This commit is contained in:
@@ -6,7 +6,9 @@ import {
|
||||
Select,
|
||||
MenuItem,
|
||||
TextField,
|
||||
IconButton as MUIIconButton
|
||||
IconButton as MUIIconButton,
|
||||
FormControlLabel,
|
||||
Switch
|
||||
} from '@mui/material';
|
||||
import { useConnector } from 'src/hooks/useConnector';
|
||||
import { ColorSelector } from 'src/components/ColorSelector/ColorSelector';
|
||||
@@ -97,6 +99,21 @@ export const ConnectorControls = ({ id }: Props) => {
|
||||
})}
|
||||
</Select>
|
||||
</Section>
|
||||
<Section>
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Switch
|
||||
checked={connector.showArrow !== false}
|
||||
onChange={(e) => {
|
||||
updateConnector(connector.id, {
|
||||
showArrow: e.target.checked
|
||||
});
|
||||
}}
|
||||
/>
|
||||
}
|
||||
label="Show Arrow"
|
||||
/>
|
||||
</Section>
|
||||
<Section>
|
||||
<Box>
|
||||
<DeleteButton
|
||||
|
||||
@@ -144,7 +144,7 @@ export const Connector = ({ connector: _connector, isSelected }: Props) => {
|
||||
);
|
||||
})}
|
||||
|
||||
{directionIcon && (
|
||||
{directionIcon && connector.showArrow !== false && (
|
||||
<g transform={`translate(${directionIcon.x}, ${directionIcon.y})`}>
|
||||
<g transform={`rotate(${directionIcon.rotation})`}>
|
||||
<polygon
|
||||
|
||||
@@ -49,7 +49,8 @@ export const CONNECTOR_DEFAULTS: Required<Omit<Connector, 'id' | 'color'>> = {
|
||||
width: 10,
|
||||
description: '',
|
||||
anchors: [],
|
||||
style: 'SOLID'
|
||||
style: 'SOLID',
|
||||
showArrow: true
|
||||
};
|
||||
|
||||
// The boundaries of the search area for the pathfinder algorithm
|
||||
|
||||
@@ -20,5 +20,6 @@ export const connectorSchema = z.object({
|
||||
color: id.optional(),
|
||||
width: z.number().optional(),
|
||||
style: z.enum(connectorStyleOptions).optional(),
|
||||
showArrow: z.boolean().optional(),
|
||||
anchors: z.array(anchorSchema)
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user