From: mjwybrow Date: Sun, 28 May 2006 04:03:35 +0000 (+0000) Subject: * src/sp-conn-end-pair.cpp: Detach connectors from empty groups X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=031a094cece1123331bae8b916d3f79e805372d2;p=inkscape.git * src/sp-conn-end-pair.cpp: Detach connectors from empty groups before trying to route connectors to them. This is required since empty groups have no physical position. Fixes bug #1448811. --- diff --git a/ChangeLog b/ChangeLog index e98febc31..7b5fafb86 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-05-28 Michael Wybrow + + * src/sp-conn-end-pair.cpp: Detach connectors from empty groups + before trying to route connectors to them. This is required + since empty groups have no physical position. Fixes bug #1448811. + 2006-05-27 Kees Cook * src/extension/implementation/script.cpp: allow output extension diff --git a/src/sp-conn-end-pair.cpp b/src/sp-conn-end-pair.cpp index a1c4697e5..c5cc75251 100644 --- a/src/sp-conn-end-pair.cpp +++ b/src/sp-conn-end-pair.cpp @@ -19,6 +19,7 @@ #include "libavoid/vertices.h" #include "libavoid/router.h" #include "document.h" +#include "sp-item-group.h" SPConnEndPair::SPConnEndPair(SPPath *const owner) @@ -138,6 +139,20 @@ void SPConnEndPair::getAttachedItems(SPItem *h2attItem[2]) const { for (unsigned h = 0; h < 2; ++h) { h2attItem[h] = this->_connEnd[h]->ref.getObject(); + + // Deal with the case of the attached object being an empty group. + // A group containing no items does not have a valid bbox, so + // causes problems for the auto-routing code. Also, since such a + // group no longer has an onscreen representation and can only be + // selected through the XML editor, it makes sense just to detach + // connectors from them. + if (SP_IS_GROUP(h2attItem[h])) { + if (SP_GROUP(h2attItem[h])->group->getItemCount() == 0) { + // This group is empty, so detach. + sp_conn_end_detach(_path, h); + h2attItem[h] = NULL; + } + } } }