X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fseltrans.cpp;h=8ff00d60ae902f654b23e21055e657220d66f1ed;hb=07deead54b814f1bcae352a059bc3eea74233a1b;hp=1087ec7b56da9064a9dde913e800bd435b2ddb27;hpb=183f55e315abe617940e3b8c3d741a9ad5f55b52;p=inkscape.git diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 1087ec7b5..8ff00d60a 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -408,8 +408,9 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s // Optionally, show the snap source if (!(_state == STATE_ROTATE && x != 0.5 && y != 0.5)) { // but not when we're dragging a rotation handle, because that won't snap // Now either _bbox_points or _snap_points has a single element, the other one has zero..... or both have zero elements - g_assert((_snap_points.size() + _bbox_points.size() + _bbox_points_for_translating.size()) == 1); - if (m.snapprefs.getSnapEnabledGlobally()) { + if ((_snap_points.size() + _bbox_points.size() + _bbox_points_for_translating.size()) > 1) { + g_warning("too many snap sources to display, please fix this"); + } else if (m.snapprefs.getSnapEnabledGlobally()) { if (_bbox_points.size() == 1) { _desktop->snapindicator->set_new_snapsource(_bbox_points.at(0)); } else if (_bbox_points_for_translating.size() == 1) { @@ -1629,10 +1630,17 @@ Geom::Point Inkscape::SelTrans::_calcAbsAffineGeom(Geom::Scale const geom_scale) Inkscape::Preferences *prefs = Inkscape::Preferences::get(); bool const transform_stroke = prefs->getBool("/options/transform/stroke", true); - Geom::Rect visual_bbox = get_visual_bbox(_geometric_bbox, _absolute_affine, _strokewidth, transform_stroke); + if (_geometric_bbox) { + Geom::Rect visual_bbox = get_visual_bbox(_geometric_bbox, _absolute_affine, _strokewidth, transform_stroke); + // return the new handle position + return visual_bbox.min() + visual_bbox.dimensions() * Geom::Scale(_handle_x, _handle_y); + } - // return the new handle position - return visual_bbox.min() + visual_bbox.dimensions() * Geom::Scale(_handle_x, _handle_y); + // Fall back scenario, in case we don't have a geometric bounding box at hand; + // (Due to some bugs related to bounding boxes having at least one zero dimension; For more details + // see https://bugs.launchpad.net/inkscape/+bug/318726) + g_warning("No geometric bounding box has been calculated; this is a bug that needs fixing!"); + return _calcAbsAffineDefault(geom_scale); // this is bogus, but we must return _something_ } void Inkscape::SelTrans::_keepClosestPointOnly(std::vector > &points, const Geom::Point &reference)