diff --git a/src/desktop.cpp b/src/desktop.cpp
index 1ee24f9c6d35854c73c20714dd1e1450dbf52103..8b60291ef36c8c39df023a0bc1ee2037acaf3c78 100644 (file)
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
bool SPDesktop::isWithinViewport (SPItem *item) const
{
Geom::Rect const viewport = get_display_area();
- boost::optional<Geom::Rect> const bbox = sp_item_bbox_desktop(item);
+ Geom::OptRect const bbox = sp_item_bbox_desktop(item);
if (bbox) {
return viewport.contains(*bbox);
} else {
// FIXME: This 2geom idiom doesn't allow us to declare dbox const
Geom::Rect viewbox = canvas->getViewbox();
- viewbox.expandBy(border);
+ viewbox.expandBy(-border);
double scale = _d2w.descrim();
double newscale;
if (!zoomed) {
SPItem * singleItem = selection->singleItem();
if (singleItem != NULL && tools_isactive(this, TOOLS_NODES)) {
- SPNodeContext * ncontext = SP_NODE_CONTEXT(event_context);
- Inkscape::NodePath::Path * nodepath = ncontext->shape_editor->get_nodepath();
+ Inkscape::NodePath::Path * nodepath = event_context->shape_editor->get_nodepath();
// printf("I've got a nodepath, crazy\n");
Geom::Rect nodes;
}
if (!zoomed) {
- boost::optional<Geom::Rect> const d = selection->bounds();
- if (d && !d->isEmpty() && d->area() * 2.0 < _quick_zoom_stored_area.area()) {
+ Geom::OptRect const d = selection->bounds();
+ if (d && d->area() * 2.0 < _quick_zoom_stored_area.area()) {
set_display_area(*d, 10);
zoomed = true;
}
Geom::Rect d(Geom::Point(0, 0),
Geom::Point(sp_document_width(doc()), sp_document_height(doc())));
- // FIXME: the original NR::Rect::isEmpty call contained an additional threshold of 1.0; is it safe to ignore it?
- if (d.isEmpty()) {
+ if (d.minExtent() < 1.0) {
return;
}
void
SPDesktop::zoom_selection()
{
- boost::optional<Geom::Rect> const d = selection->bounds();
+ Geom::OptRect const d = selection->bounds();
- // FIXME: the original NR::Rect::isEmpty call contained an additional threshold of 0.1; is it safe to ignore it?
- if ( !d || d->isEmpty() ) {
+ if ( !d || d->minExtent() < 0.1 ) {
return;
}
SPItem *docitem = SP_ITEM (sp_document_root (doc()));
g_return_if_fail (docitem != NULL);
- boost::optional<Geom::Rect> d = sp_item_bbox_desktop(docitem);
+ Geom::OptRect d = sp_item_bbox_desktop(docitem);
/* Note that the second condition here indicates that
** there are no items in the drawing.
*/
- // FIXME: the original NR::Rect::isEmpty call contained an additional threshold of 1.0; is it safe to ignore it?
- if ( !d || d->isEmpty() ) {
+ if ( !d || d->minExtent() < 0.1 ) {
return;
}
return _doc2dt;
}
+Geom::Matrix SPDesktop::dt2doc() const
+{
+ // doc2dt is its own inverse
+ return _doc2dt;
+}
+
Geom::Point SPDesktop::doc2dt(Geom::Point const &p) const
{
return p * _doc2dt;
Geom::Point SPDesktop::dt2doc(Geom::Point const &p) const
{
- return p * _doc2dt.inverse();
+ return p * dt2doc();
}