Skip to content

Commit

Permalink
[TD]Fix CosmeticVertex size
Browse files Browse the repository at this point in the history
  • Loading branch information
WandererFan committed Jun 9, 2020
1 parent 134f5fd commit dd0273f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/Mod/TechDraw/App/Cosmetic.cpp
Expand Up @@ -137,7 +137,7 @@ CosmeticVertex::CosmeticVertex() : TechDraw::Vertex()
permaPoint = Base::Vector3d(0.0, 0.0, 0.0);
linkGeom = -1;
color = Preferences::vertexColor();
size = 3.0;
size = Preferences::vertexScale();
style = 1;
visible = true;
hlrVisible = true;
Expand Down Expand Up @@ -165,8 +165,7 @@ CosmeticVertex::CosmeticVertex(Base::Vector3d loc) : TechDraw::Vertex(loc)
permaPoint = loc;
linkGeom = -1;
color = Preferences::vertexColor();
//TODO: size = hGrp->getFloat("VertexSize",30.0);
size = 30.0;
size = Preferences::vertexScale();
style = 1; //TODO: implement styled vertexes
visible = true;
hlrVisible = true;
Expand Down
2 changes: 2 additions & 0 deletions src/Mod/TechDraw/App/CosmeticVertexPyImp.cpp
Expand Up @@ -206,6 +206,8 @@ void CosmeticVertexPy::setSize(Py::Object arg)
PyObject* p = arg.ptr();
if (PyFloat_Check(p)) {
size = PyFloat_AsDouble(p);
} else if (PyLong_Check(p)) {
size = (double) PyLong_AsLong(p);
} else {
throw Py::TypeError("expected (float)");
}
Expand Down
9 changes: 9 additions & 0 deletions src/Mod/TechDraw/App/Preferences.cpp
Expand Up @@ -126,6 +126,15 @@ App::Color Preferences::vertexColor()
return fcColor;
}

double Preferences::vertexScale()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
GetGroup("Preferences")->GetGroup("Mod/TechDraw/General");
double result = hGrp->GetFloat("VertexScale", 3.0);
return result;
}



//lightgray #D3D3D3

Expand Down
1 change: 1 addition & 0 deletions src/Mod/TechDraw/App/Preferences.h
Expand Up @@ -53,6 +53,7 @@ static App::Color normalColor();
static App::Color selectColor();
static App::Color preselectColor();
static App::Color vertexColor();
static double vertexScale();

static bool useGlobalDecimals();
static bool keepPagesUpToDate();
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/TechDraw/Gui/QGIViewPart.cpp
Expand Up @@ -658,7 +658,7 @@ void QGIViewPart::drawViewPart()
// TechDraw::CosmeticVertex* cv = viewPart->getCosmeticVertexByGeom(i);
if (cv != nullptr) {
item->setNormalColor(cv->color.asValue<QColor>());
item->setRadius(cv->size);
item->setRadius(Rez::guiX(cv->size));
} else {
item->setNormalColor(vertexColor);
item->setFillColor(vertexColor);
Expand Down

0 comments on commit dd0273f

Please sign in to comment.