diff options
| author | Diederik van Lierop <mail@diedenrezi.nl> | 2011-06-30 20:46:15 +0000 |
|---|---|---|
| committer | Diederik van Lierop <mail@diedenrezi.nl> | 2011-06-30 20:46:15 +0000 |
| commit | 8911d9a8ca0c7f4ef1476b2f056adf2afa4e99cd (patch) | |
| tree | bc14be1ac41f82196fc5a07ac99ff3613eeb4cd7 /src/sp-text.cpp | |
| parent | Minimise GTK version changes in text-edit dialog (diff) | |
| download | inkscape-8911d9a8ca0c7f4ef1476b2f056adf2afa4e99cd.tar.gz inkscape-8911d9a8ca0c7f4ef1476b2f056adf2afa4e99cd.zip | |
Implement decent snapping to text (baseline & anchor), and provide a toggle button for this (as requested in LP bug #727281 )
(bzr r10392)
Diffstat (limited to 'src/sp-text.cpp')
| -rw-r--r-- | src/sp-text.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/sp-text.cpp b/src/sp-text.cpp index 3f30c2422..f7ba7592b 100644 --- a/src/sp-text.cpp +++ b/src/sp-text.cpp @@ -441,15 +441,17 @@ static char * sp_text_description(SPItem *item) return ret; } -static void sp_text_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const */*snapprefs*/) +static void sp_text_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) { - // Choose a point on the baseline for snapping from or to, with the horizontal position - // of this point depending on the text alignment (left vs. right) - Inkscape::Text::Layout const *layout = te_get_layout((SPItem *) item); - if (layout != NULL && layout->outputExists()) { - boost::optional<Geom::Point> pt = layout->baselineAnchorPoint(); - if (pt) { - p.push_back(Inkscape::SnapCandidatePoint((*pt) * item->i2d_affine(), Inkscape::SNAPSOURCE_TEXT_BASELINE, Inkscape::SNAPTARGET_TEXT_BASELINE)); + if (snapprefs->getSnapTextBaseline()) { + // Choose a point on the baseline for snapping from or to, with the horizontal position + // of this point depending on the text alignment (left vs. right) + Inkscape::Text::Layout const *layout = te_get_layout((SPItem *) item); + if (layout != NULL && layout->outputExists()) { + boost::optional<Geom::Point> pt = layout->baselineAnchorPoint(); + if (pt) { + p.push_back(Inkscape::SnapCandidatePoint((*pt) * item->i2d_affine(), Inkscape::SNAPSOURCE_TEXT_ANCHOR, Inkscape::SNAPTARGET_TEXT_ANCHOR)); + } } } } |
