[TD]fix double draw on position change
This commit is contained in:
committed by
WandererFan
parent
54ffceea51
commit
78c22e33de
@@ -77,8 +77,8 @@ DrawView::DrawView(void):
|
||||
mouseMove(false)
|
||||
{
|
||||
static const char *group = "Base";
|
||||
ADD_PROPERTY_TYPE(X, (0.0), group, (App::PropertyType)(App::Prop_None | App::Prop_NoRecompute), "X position");
|
||||
ADD_PROPERTY_TYPE(Y, (0.0), group, (App::PropertyType)(App::Prop_None | App::Prop_NoRecompute), "Y position");
|
||||
ADD_PROPERTY_TYPE(X, (0.0), group, (App::PropertyType)(App::Prop_Output), "X position");
|
||||
ADD_PROPERTY_TYPE(Y, (0.0), group, (App::PropertyType)(App::Prop_Output), "Y position");
|
||||
ADD_PROPERTY_TYPE(LockPosition, (false), group, App::Prop_Output, "Lock View position to parent Page or Group");
|
||||
ADD_PROPERTY_TYPE(Rotation, (0.0), group, App::Prop_Output, "Rotation in degrees counterclockwise");
|
||||
|
||||
@@ -103,8 +103,6 @@ App::DocumentObjectExecReturn *DrawView::execute(void)
|
||||
return App::DocumentObject::execute();
|
||||
}
|
||||
handleXYLock();
|
||||
requestPaint();
|
||||
//documentObject::recompute causes an infinite loop.
|
||||
//should not be necessary to purgeTouched here, but it prevents a superfluous feature recompute
|
||||
purgeTouched(); //this should not be necessary!
|
||||
return App::DocumentObject::execute();
|
||||
@@ -159,10 +157,7 @@ void DrawView::onChanged(const App::Property* prop)
|
||||
requestPaint();
|
||||
} else if ((prop == &X) ||
|
||||
(prop == &Y)) {
|
||||
// Base::Console().Message("DV::onChanged(X or Y)\n");
|
||||
DrawView::execute();
|
||||
X.purgeTouched();
|
||||
Y.purgeTouched();
|
||||
//X,Y changes are only interesting to DPGI and Gui side
|
||||
}
|
||||
}
|
||||
App::DocumentObject::onChanged(prop);
|
||||
@@ -417,8 +412,14 @@ void DrawView::setPosition(double x, double y, bool force)
|
||||
// Base::Console().Message("DV::setPosition(%.3f,%.3f) - \n",x,y,getNameInDocument());
|
||||
if ( (!isLocked()) ||
|
||||
(force) ) {
|
||||
X.setValue(x);
|
||||
Y.setValue(y);
|
||||
double currX = X.getValue();
|
||||
double currY = X.getValue();
|
||||
if (!DrawUtil::fpCompare(currX, x, 0.001)) { // 0.001mm tolerance
|
||||
X.setValue(x);
|
||||
}
|
||||
if (!DrawUtil::fpCompare(currY, y, 0.001)) {
|
||||
Y.setValue(y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -418,12 +418,12 @@ void QGIView::toggleCache(bool state)
|
||||
void QGIView::draw()
|
||||
{
|
||||
// Base::Console().Message("QGIV::draw()\n");
|
||||
double x, y;
|
||||
double xFeat, yFeat;
|
||||
if (getViewObject() != nullptr) {
|
||||
x = Rez::guiX(getViewObject()->X.getValue());
|
||||
y = Rez::guiX(getViewObject()->Y.getValue());
|
||||
xFeat = Rez::guiX(getViewObject()->X.getValue());
|
||||
yFeat = Rez::guiX(getViewObject()->Y.getValue());
|
||||
if (!getViewObject()->LockPosition.getValue()) {
|
||||
setPosition(x, y);
|
||||
setPosition(xFeat, yFeat);
|
||||
}
|
||||
}
|
||||
if (isVisible()) {
|
||||
|
||||
@@ -214,15 +214,23 @@ void ViewProviderDrawingView::finishRestoring()
|
||||
|
||||
void ViewProviderDrawingView::updateData(const App::Property* prop)
|
||||
{
|
||||
if (prop == &(getViewObject()->Rotation) ||
|
||||
prop == &(getViewObject()->X) ||
|
||||
prop == &(getViewObject()->Y) ) {
|
||||
//redrawn the whole view on Rotation change
|
||||
if (prop == &(getViewObject()->Rotation)) {
|
||||
QGIView* qgiv = getQView();
|
||||
if (qgiv) {
|
||||
qgiv->updateView(true);
|
||||
}
|
||||
}
|
||||
|
||||
//only move the view on X,Y change
|
||||
if (prop == &(getViewObject()->X) ||
|
||||
prop == &(getViewObject()->Y) ){
|
||||
QGIView* qgiv = getQView();
|
||||
if (qgiv) {
|
||||
qgiv->QGIView::updateView(true);
|
||||
}
|
||||
}
|
||||
|
||||
Gui::ViewProviderDocumentObject::updateData(prop);
|
||||
}
|
||||
|
||||
@@ -257,7 +265,7 @@ Gui::MDIView *ViewProviderDrawingView::getMDIView() const
|
||||
|
||||
void ViewProviderDrawingView::onGuiRepaint(const TechDraw::DrawView* dv)
|
||||
{
|
||||
// Base::Console().Message("VPDV::onGuiRepaint(%s)\n", dv->getNameInDocument());
|
||||
// Base::Console().Message("VPDV::onGuiRepaint(%s)\n", dv->getNameInDocument());
|
||||
if (dv == getViewObject()) {
|
||||
if (!dv->isRemoving() &&
|
||||
!dv->isRestoring()) {
|
||||
|
||||
Reference in New Issue
Block a user