Sketcher: ViewProviderSketch remove unecessary updateColor and applyCursor.
This commit is contained in:
committed by
Chris Hennes
parent
eb3ce44b58
commit
fbd7f7090c
@@ -743,7 +743,9 @@ void ViewProviderSketch::preselectAtPoint(Base::Vector2d point)
|
||||
|
||||
std::unique_ptr<SoPickedPoint> Point(this->getPointOnRay(screencoords, viewer));
|
||||
|
||||
detectAndShowPreselection(Point.get(), screencoords);
|
||||
if (detectAndShowPreselection(Point.get(), screencoords) && sketchHandler) {
|
||||
sketchHandler->applyCursor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1082,7 +1084,6 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe
|
||||
}
|
||||
setPreselectPoint(drag.DragPoint);
|
||||
drag.DragPoint = Drag::InvalidPoint;
|
||||
// updateColor();
|
||||
}
|
||||
resetPositionText();
|
||||
Mode = STATUS_NONE;
|
||||
@@ -1155,7 +1156,6 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe
|
||||
}
|
||||
preselection.PreselectCurve = drag.DragCurve;
|
||||
drag.DragCurve = Drag::InvalidCurve;
|
||||
// updateColor();
|
||||
}
|
||||
resetPositionText();
|
||||
Mode = STATUS_NONE;
|
||||
@@ -1500,7 +1500,7 @@ bool ViewProviderSketch::mouseMove(const SbVec2s& cursorPos, Gui::View3DInventor
|
||||
case STATUS_NONE:
|
||||
if (preselectChanged) {
|
||||
editCoinManager->drawConstraintIcons();
|
||||
this->updateColor();
|
||||
updateColor();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -1709,7 +1709,8 @@ bool ViewProviderSketch::mouseMove(const SbVec2s& cursorPos, Gui::View3DInventor
|
||||
sketchHandler->mouseMove(Base::Vector2d(x, y));
|
||||
if (preselectChanged) {
|
||||
editCoinManager->drawConstraintIcons();
|
||||
this->updateColor();
|
||||
sketchHandler->applyCursor();
|
||||
updateColor();
|
||||
}
|
||||
return true;
|
||||
case STATUS_SKETCH_StartRubberBand: {
|
||||
@@ -2087,7 +2088,7 @@ void ViewProviderSketch::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
selection.SelCurvSet.clear();
|
||||
selection.SelConstraintSet.clear();
|
||||
editCoinManager->drawConstraintIcons();
|
||||
this->updateColor();
|
||||
updateColor();
|
||||
}
|
||||
}
|
||||
else if (msg.Type == Gui::SelectionChanges::AddSelection) {
|
||||
@@ -2099,38 +2100,32 @@ void ViewProviderSketch::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
if (shapetype.size() > 4 && shapetype.substr(0, 4) == "Edge") {
|
||||
int GeoId = std::atoi(&shapetype[4]) - 1;
|
||||
selection.SelCurvSet.insert(GeoId);
|
||||
this->updateColor();
|
||||
}
|
||||
else if (shapetype.size() > 12 && shapetype.substr(0, 12) == "ExternalEdge") {
|
||||
int GeoId = std::atoi(&shapetype[12]) - 1;
|
||||
GeoId = -GeoId - 3;
|
||||
selection.SelCurvSet.insert(GeoId);
|
||||
this->updateColor();
|
||||
}
|
||||
else if (shapetype.size() > 6 && shapetype.substr(0, 6) == "Vertex") {
|
||||
int VtId = std::atoi(&shapetype[6]) - 1;
|
||||
addSelectPoint(VtId);
|
||||
this->updateColor();
|
||||
}
|
||||
else if (shapetype == "RootPoint") {
|
||||
addSelectPoint(Selection::RootPoint);
|
||||
this->updateColor();
|
||||
}
|
||||
else if (shapetype == "H_Axis") {
|
||||
selection.SelCurvSet.insert(Selection::HorizontalAxis);
|
||||
this->updateColor();
|
||||
}
|
||||
else if (shapetype == "V_Axis") {
|
||||
selection.SelCurvSet.insert(Selection::VerticalAxis);
|
||||
this->updateColor();
|
||||
}
|
||||
else if (shapetype.size() > 10 && shapetype.substr(0, 10) == "Constraint") {
|
||||
int ConstrId =
|
||||
Sketcher::PropertyConstraintList::getIndexFromConstraintName(shapetype);
|
||||
selection.SelConstraintSet.insert(ConstrId);
|
||||
editCoinManager->drawConstraintIcons();
|
||||
this->updateColor();
|
||||
}
|
||||
updateColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2146,31 +2141,25 @@ void ViewProviderSketch::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
if (shapetype.size() > 4 && shapetype.substr(0, 4) == "Edge") {
|
||||
int GeoId = std::atoi(&shapetype[4]) - 1;
|
||||
selection.SelCurvSet.erase(GeoId);
|
||||
this->updateColor();
|
||||
}
|
||||
else if (shapetype.size() > 12
|
||||
&& shapetype.substr(0, 12) == "ExternalEdge") {
|
||||
int GeoId = std::atoi(&shapetype[12]) - 1;
|
||||
GeoId = -GeoId - 3;
|
||||
selection.SelCurvSet.erase(GeoId);
|
||||
this->updateColor();
|
||||
}
|
||||
else if (shapetype.size() > 6 && shapetype.substr(0, 6) == "Vertex") {
|
||||
int VtId = std::atoi(&shapetype[6]) - 1;
|
||||
removeSelectPoint(VtId);
|
||||
this->updateColor();
|
||||
}
|
||||
else if (shapetype == "RootPoint") {
|
||||
removeSelectPoint(Sketcher::GeoEnum::RtPnt);
|
||||
this->updateColor();
|
||||
}
|
||||
else if (shapetype == "H_Axis") {
|
||||
selection.SelCurvSet.erase(Sketcher::GeoEnum::HAxis);
|
||||
this->updateColor();
|
||||
}
|
||||
else if (shapetype == "V_Axis") {
|
||||
selection.SelCurvSet.erase(Sketcher::GeoEnum::VAxis);
|
||||
this->updateColor();
|
||||
}
|
||||
else if (shapetype.size() > 10 && shapetype.substr(0, 10) == "Constraint") {
|
||||
int ConstrId =
|
||||
@@ -2178,8 +2167,8 @@ void ViewProviderSketch::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
shapetype);
|
||||
selection.SelConstraintSet.erase(ConstrId);
|
||||
editCoinManager->drawConstraintIcons();
|
||||
this->updateColor();
|
||||
}
|
||||
updateColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2211,37 +2200,22 @@ void ViewProviderSketch::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
int GeoId = std::atoi(&shapetype[4]) - 1;
|
||||
resetPreselectPoint();
|
||||
preselection.PreselectCurve = GeoId;
|
||||
|
||||
if (sketchHandler)
|
||||
sketchHandler->applyCursor();
|
||||
this->updateColor();
|
||||
}
|
||||
else if (shapetype.size() > 12 && shapetype.substr(0, 12) == "ExternalEdge") {
|
||||
int GeoId = std::atoi(&shapetype[12]) - 1;
|
||||
GeoId = -GeoId - 3;
|
||||
resetPreselectPoint();
|
||||
preselection.PreselectCurve = GeoId;
|
||||
|
||||
if (sketchHandler)
|
||||
sketchHandler->applyCursor();
|
||||
this->updateColor();
|
||||
}
|
||||
else if (shapetype.size() > 6 && shapetype.substr(0, 6) == "Vertex") {
|
||||
int PtIndex = std::atoi(&shapetype[6]) - 1;
|
||||
setPreselectPoint(PtIndex);
|
||||
|
||||
if (sketchHandler)
|
||||
sketchHandler->applyCursor();
|
||||
this->updateColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (msg.Type == Gui::SelectionChanges::RmvPreselect) {
|
||||
resetPreselectPoint();
|
||||
if (sketchHandler)
|
||||
sketchHandler->applyCursor();
|
||||
this->updateColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2267,8 +2241,6 @@ bool ViewProviderSketch::detectAndShowPreselection(SoPickedPoint* Point, const S
|
||||
if (accepted) {
|
||||
setPreselectPoint(result.PointIndex);
|
||||
|
||||
if (sketchHandler)
|
||||
sketchHandler->applyCursor();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -2290,8 +2262,6 @@ bool ViewProviderSketch::detectAndShowPreselection(SoPickedPoint* Point, const S
|
||||
resetPreselectPoint();
|
||||
preselection.PreselectCurve = result.GeoIndex;
|
||||
|
||||
if (sketchHandler)
|
||||
sketchHandler->applyCursor();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -2325,8 +2295,6 @@ bool ViewProviderSketch::detectAndShowPreselection(SoPickedPoint* Point, const S
|
||||
preselection.PreselectCross =
|
||||
static_cast<Preselection::Axes>(static_cast<int>(result.Cross));
|
||||
|
||||
if (sketchHandler)
|
||||
sketchHandler->applyCursor();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -2352,8 +2320,6 @@ bool ViewProviderSketch::detectAndShowPreselection(SoPickedPoint* Point, const S
|
||||
resetPreselectPoint();
|
||||
preselection.PreselectConstraintSet = result.ConstrIndices;
|
||||
|
||||
if (sketchHandler)
|
||||
sketchHandler->applyCursor();
|
||||
return true;// Preselection changed
|
||||
}
|
||||
}
|
||||
@@ -2367,8 +2333,7 @@ bool ViewProviderSketch::detectAndShowPreselection(SoPickedPoint* Point, const S
|
||||
// we have just left a preselection
|
||||
resetPreselectPoint();
|
||||
preselection.blockedPreselection = false;
|
||||
if (sketchHandler)
|
||||
sketchHandler->applyCursor();
|
||||
|
||||
return true;
|
||||
}
|
||||
Gui::Selection().setPreselectCoord(
|
||||
@@ -2379,8 +2344,7 @@ bool ViewProviderSketch::detectAndShowPreselection(SoPickedPoint* Point, const S
|
||||
|| preselection.blockedPreselection) {
|
||||
resetPreselectPoint();
|
||||
preselection.blockedPreselection = false;
|
||||
if (sketchHandler)
|
||||
sketchHandler->applyCursor();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user