Ensure DrawView picks up DrawPage Scale at creation
This commit is contained in:
@@ -267,6 +267,8 @@ int DrawPage::addView(App::DocumentObject *docObj)
|
||||
view->ScaleType.setValue("Automatic");
|
||||
}
|
||||
|
||||
view->checkScale();
|
||||
|
||||
return Views.getSize();
|
||||
}
|
||||
|
||||
|
||||
@@ -94,14 +94,22 @@ DrawView::~DrawView()
|
||||
|
||||
App::DocumentObjectExecReturn *DrawView::execute(void)
|
||||
{
|
||||
// TechDraw::DrawPage *page = findParentPage();
|
||||
// if(page &&
|
||||
// keepUpdated()) {
|
||||
// //nothing for DrawView to do
|
||||
// }
|
||||
return App::DocumentObject::StdReturn; //DO::execute returns 0
|
||||
}
|
||||
|
||||
void DrawView::checkScale(void)
|
||||
{
|
||||
TechDraw::DrawPage *page = findParentPage();
|
||||
if(page &&
|
||||
keepUpdated()) {
|
||||
if (ScaleType.isValue("Page")) {
|
||||
if(std::abs(page->Scale.getValue() - getScale()) > FLT_EPSILON) {
|
||||
Scale.setValue(page->Scale.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DrawView::onChanged(const App::Property* prop)
|
||||
{
|
||||
if (!isRestoring()) {
|
||||
@@ -136,9 +144,6 @@ void DrawView::onChanged(const App::Property* prop)
|
||||
} else if (prop == &X || //nothing needs to be calculated, just the graphic needs to be shifted.
|
||||
prop == &Y) {
|
||||
requestPaint();
|
||||
// if (isMouseMove()) { //actually "has mouse moved this item?"
|
||||
// setAutoPos(false);
|
||||
// }
|
||||
}
|
||||
}
|
||||
App::DocumentObject::onChanged(prop);
|
||||
|
||||
@@ -87,6 +87,7 @@ public:
|
||||
bool keepUpdated(void);
|
||||
boost::signal<void (const DrawView*)> signalGuiPaint;
|
||||
virtual double getScale(void) const;
|
||||
void checkScale(void);
|
||||
|
||||
protected:
|
||||
void onChanged(const App::Property* prop);
|
||||
|
||||
Reference in New Issue
Block a user