SoShapeScale: Fix SoShapeScale does not take DPI scaling into account

This commit is contained in:
PaddleStroke
2024-12-09 14:26:28 +01:00
committed by wwmayer
parent dbdbc9934e
commit 1c9ce3e028
6 changed files with 116 additions and 2 deletions

View File

@@ -51,11 +51,10 @@
#endif
#include "SoAxisCrossKit.h"
#include "SoDevicePixelRatioElement.h"
using namespace Gui;
SO_KIT_SOURCE(SoShapeScale)
// Constructor.
@@ -101,6 +100,9 @@ SoShapeScale::GLRender(SoGLRenderAction * action)
float nsize = this->scaleFactor.getValue() / float(vp.getViewportSizePixels()[0]);
SoModelMatrixElement::get(state).multVecMatrix(center, center); // world coords
float sf = vv.getWorldToScreenScale(center, nsize);
sf *= SoDevicePixelRatioElement::get(state);
SbVec3f v(sf, sf, sf);
if (scale->scaleFactor.getValue() != v){
scale->scaleFactor = v;