Sketcher.scale: Scale label of modified constraints (#26442)

* Sketcher.scale: Scale label of modified constraints

* Sketcher.scale: Narrowing conversion on constraint index
This commit is contained in:
theo-vt
2025-12-29 15:38:12 -05:00
committed by GitHub
parent 3dce4c831d
commit cc60502708
2 changed files with 40 additions and 16 deletions

View File

@@ -436,26 +436,11 @@ void EditDatumDialog::performAutoScale(double newDatum)
double oldDatum = sketch->getDatum(ConstrNbr);
double scaleFactor = newDatum / oldDatum;
float initLabelDistance = sketch->Constraints[ConstrNbr]->LabelDistance;
float initLabelPosition = sketch->Constraints[ConstrNbr]->LabelPosition;
centerScale(scaleFactor);
// Some constraints cannot be scaled so the actual datum constraint
// might change index
ConstrNbr = sketch->getSingleScaleDefiningConstraint();
sketch->setLabelDistance(ConstrNbr, initLabelDistance * scaleFactor);
// Label position or radii and diameters represent an angle, so
// they should not be scaled
Sketcher::ConstraintType type = sketch->Constraints[ConstrNbr]->Type;
if (type == Sketcher::ConstraintType::Radius
|| type == Sketcher::ConstraintType::Diameter) {
sketch->setLabelPosition(ConstrNbr, initLabelPosition);
}
else {
sketch->setLabelPosition(ConstrNbr, initLabelPosition * scaleFactor);
}
}
catch (const Base::Exception& e) {
Base::Console().error("Exception performing autoscale: %s\n", e.what());