[Bugfix]Sketcher: some user colors aren't taken into account

This commit is contained in:
0penBrain
2022-09-02 10:33:03 +02:00
committed by Uwe
parent 285fc1065f
commit 3d7fa720e6
3 changed files with 11 additions and 34 deletions

View File

@@ -56,24 +56,4 @@ SbColor DrawingParameters::NonDrivingConstrDimColor (0.0f,0.149f
SbColor DrawingParameters::ExprBasedConstrDimColor (1.0f,0.5f,0.149f); // #FF7F26 -> (255, 127,38)
SbColor DrawingParameters::DeactivatedConstrDimColor (0.8f,0.8f,0.8f); // #CCCCCC -> (204,204,204)
QColor DrawingParameters::constrIcoColor( (int)(DrawingParameters::ConstrIcoColor [0] * 255.0f),
(int)(DrawingParameters::ConstrIcoColor[1] * 255.0f),
(int)(DrawingParameters::ConstrIcoColor[2] * 255.0f));
QColor DrawingParameters::nonDrivingConstrIcoColor( (int)(DrawingParameters::NonDrivingConstrDimColor[0] * 255.0f),
(int)(DrawingParameters::NonDrivingConstrDimColor[1] * 255.0f),
(int)(DrawingParameters::NonDrivingConstrDimColor[2] * 255.0f));
QColor DrawingParameters::constrIconSelColor ( (int)(DrawingParameters::SelectColor[0] * 255.0f),
(int)(DrawingParameters::SelectColor[1] * 255.0f),
(int)(DrawingParameters::SelectColor[2] * 255.0f));
QColor DrawingParameters::constrIconPreselColor ( (int)(DrawingParameters::PreselectColor[0] * 255.0f),
(int)(DrawingParameters::PreselectColor[1] * 255.0f),
(int)(DrawingParameters::PreselectColor[2] * 255.0f));
QColor DrawingParameters::constrIconDisabledColor ( (int)(DrawingParameters::DeactivatedConstrDimColor[0] * 255.0f),
(int)(DrawingParameters::DeactivatedConstrDimColor[1] * 255.0f),
(int)(DrawingParameters::DeactivatedConstrDimColor[2] * 255.0f));
const MultiFieldId MultiFieldId::Invalid = MultiFieldId();

View File

@@ -119,15 +119,6 @@ struct DrawingParameters {
static SbColor DeactivatedConstrDimColor; // Color used for deactivated dimensional constraints
//@}
/** @name Rendering Icon colors **/
//@{
static QColor constrIcoColor; // Icon color for constraints
static QColor nonDrivingConstrIcoColor; // Icon color for references (non-driving constraints)
static QColor constrIconSelColor; // Icon color for selected constraints
static QColor constrIconPreselColor; // Icon color for preselected constraints
static QColor constrIconDisabledColor; // Icon color for disabled constraints
//@}
/** @name Rendering sizes (also to support HDPI monitors) **/
//@{
double pixelScalingFactor = 1.0; // Scaling factor to be used for pixels

View File

@@ -2366,18 +2366,24 @@ void EditModeConstraintCoinManager::clearCoinImage(SoImage *soImagePtr)
QColor EditModeConstraintCoinManager::constrColor(int constraintId)
{
auto toQColor = [](auto sbcolor) -> QColor {
return QColor( (int)(sbcolor[0] * 255.0f),
(int)(sbcolor[1] * 255.0f),
(int)(sbcolor[2] * 255.0f));
};
const auto constraints = ViewProviderSketchCoinAttorney::getConstraints(viewProvider);
if (ViewProviderSketchCoinAttorney::isConstraintPreselected(viewProvider,constraintId))
return drawingParameters.constrIconPreselColor;
return toQColor(drawingParameters.PreselectColor);
else if (ViewProviderSketchCoinAttorney::isConstraintSelected(viewProvider, constraintId))
return drawingParameters.constrIconSelColor;
return toQColor(drawingParameters.SelectColor);
else if (!constraints[constraintId]->isActive)
return drawingParameters.constrIconDisabledColor;
return toQColor(drawingParameters.DeactivatedConstrDimColor);
else if (!constraints[constraintId]->isDriving)
return drawingParameters.nonDrivingConstrIcoColor;
return toQColor(drawingParameters.NonDrivingConstrDimColor);
else
return drawingParameters.constrIcoColor;
return toQColor(drawingParameters.ConstrIcoColor);
}