Code

two picking optimizations: 1 use our canvas' viewbox so that invisible segments can...
[inkscape.git] / src / display / sp-canvas.cpp
index 75ffeed846cb82c530a7133d855be596c36e8e0d..fef2fcc0c1f4653ba54b02a3a3dff92cd079ce11 100644 (file)
@@ -744,11 +744,16 @@ sp_canvas_group_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned i
         }
     }
 
-    NR::Rect const &bounds = corners.bounds();
-    item->x1 = bounds.min()[NR::X];
-    item->y1 = bounds.min()[NR::Y];
-    item->x2 = bounds.max()[NR::X];
-    item->y2 = bounds.max()[NR::Y];
+    NR::Maybe<NR::Rect> const bounds = corners.bounds();
+    if (bounds) {
+        item->x1 = bounds->min()[NR::X];
+        item->y1 = bounds->min()[NR::Y];
+        item->x2 = bounds->max()[NR::X];
+        item->y2 = bounds->max()[NR::Y];
+    } else {
+        // FIXME ?
+        item->x1 = item->x2 = item->y1 = item->y2 = 0;
+    }
 }
 
 /**
@@ -2313,7 +2318,7 @@ bool sp_canvas_world_pt_inside_window(SPCanvas const *canvas, NR::Point const &w
 }
 
 /**
- * Return canvas window coordinates as NRRect.
+ * Return canvas window coordinates as NR::Rect.
  */
 NR::Rect SPCanvas::getViewbox() const
 {