Skip to content

Commit

Permalink
Sketcher: ViewProvider Grid control
Browse files Browse the repository at this point in the history
===================================

Encapsulation of grid internals in ViewProviderObject2D, while allowing control via property changes and protected functions.
  • Loading branch information
abdullahtahiriyo committed May 27, 2020
1 parent 1efe9c9 commit c457ce6
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/Mod/Sketcher/Gui/ViewProviderSketch.cpp
Expand Up @@ -4284,15 +4284,7 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer

float dMagF = exp(ceil(log(std::abs(dMg))));

MinX = -dMagF;
MaxX = dMagF;
MinY = -dMagF;
MaxY = dMagF;

if (ShowGrid.getValue())
createGrid();
else
Gui::coinRemoveAllChildren(GridRoot);
updateGridExtent(-dMagF, dMagF, -dMagF, dMagF);

edit->RootCrossCoordinate->point.set1Value(0,SbVec3f(-dMagF, 0.0f, zCross));
edit->RootCrossCoordinate->point.set1Value(1,SbVec3f(dMagF, 0.0f, zCross));
Expand Down Expand Up @@ -5599,8 +5591,6 @@ void ViewProviderSketch::setupContextMenu(QMenu *menu, QObject *receiver, const

bool ViewProviderSketch::setEdit(int ModNum)
{
Q_UNUSED(ModNum);

// When double-clicking on the item for this sketch the
// object unsets and sets its edit mode without closing
// the task panel
Expand Down Expand Up @@ -5703,6 +5693,8 @@ bool ViewProviderSketch::setEdit(int ModNum)

TightGrid.setValue(false);

ViewProvider2DObject::setEdit(ModNum); // notify to handle grid according to edit mode property

float transparency;

// set the point color
Expand Down Expand Up @@ -6134,6 +6126,8 @@ void ViewProviderSketch::unsetEdit(int ModNum)
Base::Console().Error("ViewProviderSketch::unsetEdit: visibility automation failed with an error: \n");
e.ReportException();
}

ViewProvider2DObject::unsetEdit(ModNum); // notify grid that edit mode is being left
}

void ViewProviderSketch::setEditViewer(Gui::View3DInventorViewer* viewer, int ModNum)
Expand Down

0 comments on commit c457ce6

Please sign in to comment.