From 8eceff928f2c7cad83d5d680a0bdb4f5adb01127 Mon Sep 17 00:00:00 2001 From: Piotr Rogowski Date: Sat, 25 Dec 2021 12:58:36 +0100 Subject: [PATCH] Better scale for composite logger --- src/components/TriggerLog/CompositeCanvas.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/TriggerLog/CompositeCanvas.tsx b/src/components/TriggerLog/CompositeCanvas.tsx index b783d15..fcc4762 100644 --- a/src/components/TriggerLog/CompositeCanvas.tsx +++ b/src/components/TriggerLog/CompositeCanvas.tsx @@ -12,6 +12,10 @@ import { Colors } from '../../utils/colors'; const { useBreakpoint } = Grid; +const scale = 2; +const secondaryTranslate = 2.6; +const primaryTranslate = 1; + interface Props { data: CompositeLogEntry[]; width: number; @@ -31,10 +35,10 @@ const CompositeCanvas = ({ data, width, height }: Props) => { data.forEach((entry, index) => { const prevSecondary = data[index - 1] ? data[index - 1].secondaryLevel : 0; - const currentSecondary = (entry.secondaryLevel + 3) * 2; // apply scale + const currentSecondary = (entry.secondaryLevel + secondaryTranslate) * scale; const prevPrimary = data[index - 1] ? data[index - 1].primaryLevel : 0; - const currentPrimary = (entry.primaryLevel + 1) * 2; + const currentPrimary = (entry.primaryLevel + primaryTranslate) * scale; const prevSync = data[index - 1] ? data[index - 1].sync : 0; const currentSync = entry.sync; @@ -74,7 +78,7 @@ const CompositeCanvas = ({ data, width, height }: Props) => { points: { show: false }, stroke: Colors.GREEN, scale: '', - value: (_self, rawValue) => (rawValue / 2) - 3, + value: (_self, rawValue) => (rawValue / scale) - secondaryTranslate, width: 2, }, { @@ -82,7 +86,7 @@ const CompositeCanvas = ({ data, width, height }: Props) => { points: { show: false }, stroke: Colors.BLUE, scale: '', - value: (_self, rawValue) => (rawValue / 2) - 1, + value: (_self, rawValue) => (rawValue / scale) - primaryTranslate, width: 2, }, {