From f435bbef848b1ad352ec4316aae40b2dde9089dd Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Feb 2024 19:58:07 +0100 Subject: [PATCH] toggle and resize detection and behaviour bars --- src/lib/typeCheck.ts | 5 +-- src/viewer/DetectionBarDetections.tsx | 4 +-- src/viewer/SideBar.tsx | 3 ++ src/viewer/Sizer.tsx | 46 +++++++++++++++++++++++++++ src/viewer/Viewer.tsx | 27 ++++++++++++---- src/viewer/appSlice.ts | 2 +- src/viewer/controls.ts | 45 ++++++++++++++++++++------ src/viewer/generalSettingsSlice.ts | 40 ++++++++++++++++++++--- src/viewer/sizer.module.css | 6 ++++ src/viewer/viewer.module.css | 21 ++++++++---- 10 files changed, 167 insertions(+), 32 deletions(-) create mode 100644 src/viewer/Sizer.tsx create mode 100644 src/viewer/sizer.module.css diff --git a/src/lib/typeCheck.ts b/src/lib/typeCheck.ts index c7173ff..7e24ebb 100644 --- a/src/lib/typeCheck.ts +++ b/src/lib/typeCheck.ts @@ -142,6 +142,7 @@ export class NumberChecker extends Checker { constructor( options?: { isInt?: boolean, + isFinite?: boolean, min?: number, max?: number, valid?: (n: number) => boolean @@ -154,12 +155,12 @@ export class NumberChecker extends Checker { } } if (options?.min !== undefined) { - if (n > options.min) { + if (n < options.min) { return false } } if (options?.max !== undefined) { - if (n < options.max) { + if (n > options.max) { return false } } diff --git a/src/viewer/DetectionBarDetections.tsx b/src/viewer/DetectionBarDetections.tsx index 852a326..449996f 100644 --- a/src/viewer/DetectionBarDetections.tsx +++ b/src/viewer/DetectionBarDetections.tsx @@ -74,7 +74,7 @@ const SCALES = [ ] as const; const TOP_SCALING_FACTOR = 2; -const BETWEEN_LAYERS_HEIGHT = 10; +const BETWEEN_LAYERS_HEIGHT_FACTOR = 0.1; export const DetectionBarDetections: FunctionComponent = () => { const currentFrameNumber = useSelector(selectCurrentFrameNumber) @@ -200,7 +200,7 @@ export const DetectionBarDetections: FunctionComponent = () => { style={{"--svgWidth": svgRect.width, "--svgHeight": svgRect.height, "--totalNumberOfFrames": totalFrames, "--maxCount": scalingInfo[0], "--currentFrame": currentFrameNumber, - "--between-layers-height": BETWEEN_LAYERS_HEIGHT, + "--between-layers-height": svgRect.height * BETWEEN_LAYERS_HEIGHT_FACTOR, "--top-scaling-factor": TOP_SCALING_FACTOR }} onMouseDown={ev => { diff --git a/src/viewer/SideBar.tsx b/src/viewer/SideBar.tsx index eca4944..1242f08 100644 --- a/src/viewer/SideBar.tsx +++ b/src/viewer/SideBar.tsx @@ -12,6 +12,9 @@ export const SideBar: FunctionComponent = () => {