index f386aefcce57e575905f56b19e3676b46537c147..bac6854a13e873d874e65526fc3a0bee10c7788c 100644 (file)
void
EditWidget::viewSetPosition (NR::Point p)
{
void
EditWidget::viewSetPosition (NR::Point p)
{
- p -= _namedview->gridorigin;
+ // p -= _namedview->gridorigin;
+ /// \todo Why was the origin corrected for the grid origin? (johan)
+
double lo, up, pos, max;
_top_ruler.get_range (lo, up, pos, max);
_top_ruler.set_range (lo, up, p[NR::X], max);
double lo, up, pos, max;
_top_ruler.get_range (lo, up, pos, max);
_top_ruler.set_range (lo, up, p[NR::X], max);
void
EditWidget::updateRulers()
{
void
EditWidget::updateRulers()
{
- NR::Point origin = _namedview->gridorigin;
-
+ //NR::Point gridorigin = _namedview->gridorigin;
+ /// \todo Why was the origin corrected for the grid origin? (johan)
+
NR::Rect const viewbox = _svg_canvas.spobj()->getViewbox();
double lo, up, pos, max;
double const scale = _desktop->current_zoom();
NR::Rect const viewbox = _svg_canvas.spobj()->getViewbox();
double lo, up, pos, max;
double const scale = _desktop->current_zoom();
- double s = viewbox.min()[NR::X] / scale - origin[NR::X];
- double e = viewbox.max()[NR::X] / scale - origin[NR::X];
+ double s = viewbox.min()[NR::X] / scale; //- gridorigin[NR::X];
+ double e = viewbox.max()[NR::X] / scale; //- gridorigin[NR::X];
_top_ruler.get_range(lo, up, pos, max);
_top_ruler.set_range(s, e, pos, e);
_top_ruler.get_range(lo, up, pos, max);
_top_ruler.set_range(s, e, pos, e);
- s = viewbox.min()[NR::Y] / -scale - origin[NR::Y];
- e = viewbox.max()[NR::Y] / -scale - origin[NR::Y];
- _left_ruler.set_range(s, e, origin[NR::Y], e);
+ s = viewbox.min()[NR::Y] / -scale; //- gridorigin[NR::Y];
+ e = viewbox.max()[NR::Y] / -scale; //- gridorigin[NR::Y];
+ _left_ruler.set_range(s, e, 0 /*gridorigin[NR::Y]*/, e);
/// \todo is that correct?
}
/// \todo is that correct?
}
/* The desktop region we always show unconditionally */
SPDocument *doc = _desktop->doc();
/* The desktop region we always show unconditionally */
SPDocument *doc = _desktop->doc();
- NR::Rect const r = sp_item_bbox_desktop(SP_ITEM(SP_DOCUMENT_ROOT(doc)));
- NR::Rect darea(NR::Point(MIN(r.min()[NR::X], -sp_document_width(doc)),
- MIN(r.min()[NR::Y], -sp_document_height(doc))),
- NR::Point(MAX(r.max()[NR::X], 2 * sp_document_width(doc)),
- MAX(r.max()[NR::Y], 2 * sp_document_height(doc))));
+ NR::Rect darea = NR::Rect(NR::Point(-sp_document_width(doc),
+ -sp_document_height(doc)),
+ NR::Point(2 * sp_document_width(doc),
+ 2 * sp_document_height(doc)));
+ darea = NR::union_bounds(darea, sp_item_bbox_desktop(SP_ITEM(SP_DOCUMENT_ROOT(doc))));
/* Canvas region we always show unconditionally */
NR::Rect carea(NR::Point(darea.min()[NR::X] * scale - 64,
/* Canvas region we always show unconditionally */
NR::Rect carea(NR::Point(darea.min()[NR::X] * scale - 64,
NR::Rect d(NR::Point(0, 0),
NR::Point(sp_document_width(_desktop->doc()), sp_document_height(_desktop->doc())));
NR::Rect d(NR::Point(0, 0),
NR::Point(sp_document_width(_desktop->doc()), sp_document_height(_desktop->doc())));
- if (fabs(d.dimensions()[NR::X]) < 1.0 || fabs(d.dimensions()[NR::Y]) < 1.0) {
+ if (d.isEmpty(1.0)) {
return;
}
return;
}