From f0c8fe7978d646981218b59b5e5f613cf01877ab Mon Sep 17 00:00:00 2001 From: Hendrik Hassa <65833107+HennieLP@users.noreply.github.com> Date: Fri, 27 Jun 2025 15:12:46 +0200 Subject: added the option to Flipp the bits --- src/components/Cidr.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/components/Cidr.tsx b/src/components/Cidr.tsx index ac22ea6..dfb7aa2 100644 --- a/src/components/Cidr.tsx +++ b/src/components/Cidr.tsx @@ -31,6 +31,13 @@ export default function Cidr({ embed = false }: CidrProps) { setIp(newIp); } + const toggleBit = (octetIndex: number, bitIndex: number) => { + const newIp = [...ip]; + // Toggle the bit at the specified position + newIp[octetIndex] ^= (1 << (7 - bitIndex)); + setIp(newIp); + } + // This function will now be called by our manual event listener // Note: The event type is now native WheelEvent, not React.WheelEvent const processWheelEvent = (event: WheelEvent, i: number, max: number) => { @@ -264,7 +271,12 @@ export default function Cidr({ embed = false }: CidrProps) {
{bits.map((octet, i) => - {octet.map((bit, j) => {bit})} + {octet.map((bit, j) => )} )}
-- cgit v1.3.1