From 73289b8a675e099df20894b0a07064ac7552e799 Mon Sep 17 00:00:00 2001 From: Konstantin Leontev Date: Fri, 10 May 2024 11:49:43 +0100 Subject: [PATCH] [bos #32216][CEA] GUI ergonomic. Fixed scaling of Sketcher symbols because of using integer for pixel rate. --- src/SketcherPrs/SketcherPrs_Coincident.cpp | 2 +- src/SketcherPrs/SketcherPrs_SymbolPrs.cpp | 2 +- src/SketcherPrs/SketcherPrs_Tools.cpp | 6 +++--- src/SketcherPrs/SketcherPrs_Tools.h | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/SketcherPrs/SketcherPrs_Coincident.cpp b/src/SketcherPrs/SketcherPrs_Coincident.cpp index 65ca0fc0d..a44813838 100644 --- a/src/SketcherPrs/SketcherPrs_Coincident.cpp +++ b/src/SketcherPrs/SketcherPrs_Coincident.cpp @@ -143,7 +143,7 @@ void SketcherPrs_Coincident::Compute( Quantity_Color aExternalColor = aIsEdge ? aMainColor : Quantity_NOC_YELLOW; Quantity_Color aInternalColor = aIsEdge ? Quantity_NOC_YELLOW : aMainColor; - int aRatio = SketcherPrs_Tools::pixelRatio(); + const double aRatio = SketcherPrs_Tools::pixelRatio(); // Create the presentation as a combination of standard point markers // The external yellow contour diff --git a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp index efc2cc546..de2569009 100644 --- a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp +++ b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp @@ -178,7 +178,7 @@ Handle(Image_AlienPixMap) SketcherPrs_SymbolPrs::icon() aFile += iconName(); Handle(Image_AlienPixMap) aPixMap = new Image_AlienPixMap(); if (aPixMap->Load(aFile.c_str())) { - int aRatio = SketcherPrs_Tools::pixelRatio(); + const double aRatio = SketcherPrs_Tools::pixelRatio(); if (aRatio > 1) { Handle(Image_AlienPixMap) aSizedMap = new Image_AlienPixMap(); Standard_Size aWidth = aPixMap->Width() * aRatio; diff --git a/src/SketcherPrs/SketcherPrs_Tools.cpp b/src/SketcherPrs/SketcherPrs_Tools.cpp index 03fb0c44b..841679cf0 100644 --- a/src/SketcherPrs/SketcherPrs_Tools.cpp +++ b/src/SketcherPrs/SketcherPrs_Tools.cpp @@ -288,14 +288,14 @@ std::shared_ptr getProjectionPoint(const FeaturePtr theLine, return aLin2d.project(thePoint); } -static int MyPixelRatio = 1; +static double MyPixelRatio = 1.0; -void setPixelRatio(int theRatio) +void setPixelRatio(const double theRatio) { MyPixelRatio = theRatio; } -int pixelRatio() +double pixelRatio() { return MyPixelRatio; } diff --git a/src/SketcherPrs/SketcherPrs_Tools.h b/src/SketcherPrs/SketcherPrs_Tools.h index 254605ba2..da6bac84f 100644 --- a/src/SketcherPrs/SketcherPrs_Tools.h +++ b/src/SketcherPrs/SketcherPrs_Tools.h @@ -180,9 +180,9 @@ namespace SketcherPrs_Tools { SKETCHERPRS_EXPORT void sendEmptyPresentationError(ModelAPI_Feature* theFeature, const std::string theError); - SKETCHERPRS_EXPORT void setPixelRatio(int theRatio); + SKETCHERPRS_EXPORT void setPixelRatio(const double theRatio); - SKETCHERPRS_EXPORT int pixelRatio(); + SKETCHERPRS_EXPORT double pixelRatio(); }; #endif -- 2.39.2