Fix late repaint of secondary views
- when ScaleType=Automatic and Scale changes individual views were not being repainted until next document recompute.
This commit is contained in:
@@ -103,6 +103,7 @@ void DrawProjGroup::onChanged(const App::Property* prop)
|
||||
}
|
||||
}
|
||||
if (prop == &Scale) {
|
||||
// Base::Console().Message("TRACE - DPG::onChanged(Scale) - %s\n",getNameInDocument());
|
||||
updateChildren();
|
||||
}
|
||||
if (prop == &Source) {
|
||||
@@ -110,6 +111,7 @@ void DrawProjGroup::onChanged(const App::Property* prop)
|
||||
}
|
||||
|
||||
if (prop == &ScaleType) {
|
||||
// Base::Console().Message("TRACE - DPG::onChanged(ScaleType) - %s\n",getNameInDocument());
|
||||
double newScale = getScale();
|
||||
if (ScaleType.isValue("Automatic")) {
|
||||
//Recalculate scale if Group is too big or too small!
|
||||
@@ -132,6 +134,7 @@ void DrawProjGroup::onChanged(const App::Property* prop)
|
||||
|
||||
App::DocumentObjectExecReturn *DrawProjGroup::execute(void)
|
||||
{
|
||||
// Base::Console().Message("TRACE - DPG::execute() - %s\n",getNameInDocument());
|
||||
if (!keepUpdated()) {
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
@@ -151,6 +154,10 @@ App::DocumentObjectExecReturn *DrawProjGroup::execute(void)
|
||||
if (docObj == nullptr) {
|
||||
return DrawViewCollection::execute();
|
||||
}
|
||||
|
||||
for (auto& v: Views.getValues()) {
|
||||
v->recomputeFeature();
|
||||
}
|
||||
|
||||
for (auto& item: getViewsAsDPGI()) {
|
||||
item->autoPosition();
|
||||
|
||||
@@ -229,10 +229,19 @@ void TaskProjGroup::scaleTypeChanged(int index)
|
||||
, "Page");
|
||||
} else if(index == 1) {
|
||||
// Automatic Scale Type
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.activeDocument().%s.ScaleType = '%s'", multiView->getNameInDocument()
|
||||
, "Automatic");
|
||||
// Gui::Command::doCommand(Gui::Command::Doc, "App.activeDocument().%s.ScaleType = '%s'", multiView->getNameInDocument()
|
||||
// , "Automatic");
|
||||
// Base::Console().Message("TRACE - TPG::scaleTypeChanged - Auto\n");
|
||||
//block recompute
|
||||
multiView->ScaleType.setValue("Automatic");
|
||||
double autoScale = multiView->calculateAutomaticScale();
|
||||
multiView->Scale.setValue(autoScale);
|
||||
//unblock recompute
|
||||
// Base::Console().Message("TRACE - TPG::scaleTypeChanged - autoScale: %.3f\n",autoScale);
|
||||
|
||||
} else if(index == 2) {
|
||||
// Custom Scale Type
|
||||
//block recompute
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.activeDocument().%s.ScaleType = '%s'", multiView->getNameInDocument()
|
||||
, "Custom");
|
||||
ui->sbScaleNum->setEnabled(true);
|
||||
@@ -243,6 +252,7 @@ void TaskProjGroup::scaleTypeChanged(int index)
|
||||
double scale = (double) a / (double) b;
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.activeDocument().%s.Scale = %f", multiView->getNameInDocument()
|
||||
, scale);
|
||||
//unblock recompute
|
||||
} else {
|
||||
Base::Console().Log("Error - TaskProjGroup::scaleTypeChanged - unknown scale type: %d\n",index);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user