summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2014-11-15 23:36:30 +0000
committerJabiertxof <jtx@jtx.marker.es>2014-11-15 23:36:30 +0000
commitcb34932037da3ac780f327c10d3cb5bdab529d9f (patch)
tree4587d61b155c14df27c7bfc61391f3c9fb6e66e4 /src
parentin rev 13590, use 'root->height.unit' instead of namedview 'units'. (diff)
downloadinkscape-cb34932037da3ac780f327c10d3cb5bdab529d9f.tar.gz
inkscape-cb34932037da3ac780f327c10d3cb5bdab529d9f.zip
add snap to fillet/chamfer knots. Fixed a bug whith 180 degree node angle
(bzr r13716)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/lpe-fillet-chamfer.cpp4
-rw-r--r--src/live_effects/parameter/filletchamferpointarray.cpp25
2 files changed, 5 insertions, 24 deletions
diff --git a/src/live_effects/lpe-fillet-chamfer.cpp b/src/live_effects/lpe-fillet-chamfer.cpp
index 85b4ba5b2..680b4f763 100644
--- a/src/live_effects/lpe-fillet-chamfer.cpp
+++ b/src/live_effects/lpe-fillet-chamfer.cpp
@@ -578,7 +578,9 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in)
} else {
type = std::abs(filletChamferData[counter + 1][Y]);
}
- if (type >= 3000 && type < 4000) {
+ if(are_near(middle_point(startArcPoint,endArcPoint),curve_it1->finalPoint(), 0.0001)){
+ path_out.appendNew<Geom::LineSegment>(endArcPoint);
+ } else if (type >= 3000 && type < 4000) {
unsigned int chamferSubs = type-3000;
Geom::Path path_chamfer;
path_chamfer.start(path_out.finalPoint());
diff --git a/src/live_effects/parameter/filletchamferpointarray.cpp b/src/live_effects/parameter/filletchamferpointarray.cpp
index 4e2be6e88..b23145db1 100644
--- a/src/live_effects/parameter/filletchamferpointarray.cpp
+++ b/src/live_effects/parameter/filletchamferpointarray.cpp
@@ -693,28 +693,6 @@ void FilletChamferPointArrayParam::set_oncanvas_looks(SPKnotShapeType shape,
knot_mode = mode;
knot_color = color;
}
-/*
-class FilletChamferPointArrayParamKnotHolderEntity : public KnotHolderEntity {
-public:
- FilletChamferPointArrayParamKnotHolderEntity(FilletChamferPointArrayParam
-*p, unsigned int index);
- virtual ~FilletChamferPointArrayParamKnotHolderEntity() {}
-
- virtual void knot_set(Point const &p, Point const &origin, guint state);
- virtual Point knot_get() const;
- virtual void knot_click(guint state);
- virtual void knot_doubleclicked(guint state);
-
- /Checks whether the index falls within the size of the parameter's vector/
- bool valid_index(unsigned int index) const {
- return (_pparam->_vector.size() > index);
- };
-
-private:
- FilletChamferPointArrayParam *_pparam;
- unsigned int _index;
-};
-/*/
FilletChamferPointArrayParamKnotHolderEntity::
FilletChamferPointArrayParamKnotHolderEntity(
@@ -733,8 +711,9 @@ void FilletChamferPointArrayParamKnotHolderEntity::knot_set(Point const &p,
/// @todo how about item transforms???
Piecewise<D2<SBasis> > const &pwd2 = _pparam->get_pwd2();
//todo: add snapping
- Geom::Point const s = snap_knot_position(p, state);
double t = nearest_point(p, pwd2[_index]);
+ Geom::Point const s = snap_knot_position(pwd2[_index].valueAt(t), state);
+ t = nearest_point(s, pwd2[_index]);
if (t == 1) {
t = 0.9999;
}