diff options
| author | Jabiertxof <jabier.arraiza@marker.es> | 2019-02-20 14:42:16 +0000 |
|---|---|---|
| committer | Jabiertxof <jabier.arraiza@marker.es> | 2019-02-20 14:42:16 +0000 |
| commit | 211c530b8aae569ce8d5a17abef5524394e18632 (patch) | |
| tree | 6455fec8615c3a7a4c5a3836313132114e3eb96b /src/ui/dialog/livepatheffect-editor.cpp | |
| parent | Prevent crashes in node tool (diff) | |
| download | inkscape-211c530b8aae569ce8d5a17abef5524394e18632.tar.gz inkscape-211c530b8aae569ce8d5a17abef5524394e18632.zip | |
Fix for issue 95: Crash on applying Perspective/Envelope LPE to a group
Diffstat (limited to 'src/ui/dialog/livepatheffect-editor.cpp')
| -rw-r--r-- | src/ui/dialog/livepatheffect-editor.cpp | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 13d4f3dc4..78b26093a 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -407,7 +407,25 @@ LivePathEffectEditor::setDesktop(SPDesktop *desktop) } } - +void +LivePathEffectEditor::rectsToCurves(SPItem* topitem, SPItem *item) +{ + Inkscape::Selection *sel = _getSelection(); + if ( dynamic_cast<SPRect *>(item) ) { + sel->clear(); + sel->set(item); + sel->toCurves(); + if (topitem == item) { + return; + } + } else if( SPGroup *group = dynamic_cast<SPGroup *>(item)){ + std::vector<SPItem*> const item_list = sp_item_group_item_list(group); + for (auto sub_item : item_list) { + rectsToCurves(topitem, sub_item); + } + } + sel->set(topitem); +} /*######################################################################## @@ -437,12 +455,8 @@ LivePathEffectEditor::onAdd() if (!data) { return; } - - // If item is a SPRect, convert it to path first: - if ( dynamic_cast<SPRect *>(item) ) { - sel->toCurves(); - item = sel->singleItem(); // get new item - } + rectsToCurves(item, item); + item = sel->singleItem(); // get new item LivePathEffect::Effect::createAndApply(data->key.c_str(), doc, item); |
