From: Greg Burri Date: Mon, 22 Mar 2021 13:18:42 +0000 (+0100) Subject: Use an absolute value for thickness and font size X-Git-Tag: 1.0.13 X-Git-Url: http://git.euphorik.ch/?p=master-thesis.git;a=commitdiff_plain;h=5d1a08f1b121d660228b08d9f931edaed619fdb9;hp=be048d85a1519bd45f516a88720a629d693a2be2 Use an absolute value for thickness and font size --- diff --git a/Parasitemia/ParasitemiaUI/GUI.fs b/Parasitemia/ParasitemiaUI/GUI.fs index 74aba27..c85017f 100644 --- a/Parasitemia/ParasitemiaUI/GUI.fs +++ b/Parasitemia/ParasitemiaUI/GUI.fs @@ -50,11 +50,11 @@ let run (defaultConfig : Config) (fileToOpen : string option) = frame.manuallyAdded.Fill <- color frame.border.Stroke <- color - let frameStrokeThickness (averageRBCSize : float) = - max 1. (averageRBCSize / 60.) + let frameStrokeThickness () = + state.CurrentImage |> Option.map (fun img -> max 1. (img.AverageRBCSize / 100.)) |> Option.defaultValue 1. - let frameFontSize (averageRBCSize : float) = - max 1. (averageRBCSize / 6.) + let frameFontSize () = + state.CurrentImage |> Option.map (fun img -> max 1. (img.AverageRBCSize / 6.)) |> Option.defaultValue 1. let createRBCFrameFromExisting (srcImg : SourceImage) (rbc : RBC) (frame : RBCFrame) (frameThickness : float) (fontSize : float) (isTextBelow : bool) : RBCFrame = frame.Visibility <- Visibility.Visible @@ -82,16 +82,15 @@ let run (defaultConfig : Config) (fileToOpen : string option) = statusMessageTimer.Start () let highlightRBC (rbc : RBC) (highlight : bool) = - // let rbc = frame.Tag :?> RBC - // Find the two frames in previews and current image. + let strokeThickness = frameStrokeThickness () for rbcFrame in (win.stackRBC.Children |> Seq.cast).Concat(win.canvasCurrentImage.Children |> Seq.cast) do if (rbcFrame.Tag :?> RBC) = rbc then if highlight then - rbcFrame.border.StrokeThickness <- 3. * rbcFrame.border.StrokeThickness + rbcFrame.border.StrokeThickness <- 3. * strokeThickness if not rbc.infected && not rbc.setManually && not displayHealthy then rbcFrame.Opacity <- 1. else - rbcFrame.border.StrokeThickness <- rbcFrame.border.StrokeThickness / 3. + rbcFrame.border.StrokeThickness <- strokeThickness if not rbc.infected && not rbc.setManually && not displayHealthy then rbcFrame.Opacity <- 0. let zoomToRBC (rbc : RBC) = @@ -232,8 +231,8 @@ let run (defaultConfig : Config) (fileToOpen : string option) = match state.CurrentImage with | Some srcImg -> let mutable currentCanvas = 0 - let strokeThickness = frameStrokeThickness srcImg.AverageRBCSize - let fontSize = frameFontSize srcImg.AverageRBCSize + let strokeThickness = frameStrokeThickness () + let fontSize = frameFontSize () for rbc in srcImg.RBCs do let frame = if currentCanvas < win.canvasCurrentImage.Children.Count then