diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2008-07-02 18:29:19 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2008-07-02 18:29:19 +0000 |
| commit | 4f728a9e9ab3254544dbfdc75b854dce2484f872 (patch) | |
| tree | e427480bbd5513df0c5ee3ac18b74f0931d8373e /src/pen-context.cpp | |
| parent | lpe-skeleton: add boilerplate code to create knotholder handles for LPEs (diff) | |
| download | inkscape-4f728a9e9ab3254544dbfdc75b854dce2484f872.tar.gz inkscape-4f728a9e9ab3254544dbfdc75b854dce2484f872.zip | |
2geomify deletion of node in pen-context.cpp
(bzr r6123)
Diffstat (limited to 'src/pen-context.cpp')
| -rw-r--r-- | src/pen-context.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/pen-context.cpp b/src/pen-context.cpp index f91db7018..e62d45192 100644 --- a/src/pen-context.cpp +++ b/src/pen-context.cpp @@ -1090,20 +1090,21 @@ pen_handle_key_press(SPPenContext *const pc, GdkEvent *event) pc->green_bpaths = g_slist_remove(pc->green_bpaths, pc->green_bpaths->data); } /* Get last segment */ - NArtBpath const *const p = SP_CURVE_BPATH(pc->green_curve); - gint const e = SP_CURVE_LENGTH(pc->green_curve); - if ( e < 2 ) { - g_warning("Green curve length is %d", e); + if ( pc->green_curve->is_empty() ) { + g_warning("pen_handle_key_press, case GDK_KP_Delete: Green curve is empty"); break; } - pc->p[0] = p[e - 2].c(3); - if (p[e - 1].code == NR_CURVETO) { - pc->p[1] = p[e - 1].c(1); + // The code below assumes that pc->green_curve has only ONE path ! + Geom::Path const & path = pc->green_curve->get_pathvector().back(); + Geom::Curve const * crv = &path.back_default(); + pc->p[0] = crv->initialPoint(); + if ( Geom::CubicBezier const * cubic = dynamic_cast<Geom::CubicBezier const *>(crv)) { + pc->p[1] = from_2geom( (*cubic)[1] ); } else { pc->p[1] = pc->p[0]; } NR::Point const pt(( pc->npoints < 4 - ? p[e - 1].c(3) + ? crv->finalPoint() : pc->p[3] )); pc->npoints = 2; pc->green_curve->backspace(); |
