From: Krzysztof KosiƄski Date: Tue, 6 Apr 2010 14:11:54 +0000 (+0200) Subject: Revert the inverted coordinate system fix. 3D Boxes and guides X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d703e5d08553a3dd5eb4f0a11040de79071bdcfb;p=inkscape.git Revert the inverted coordinate system fix. 3D Boxes and guides require an XML-level backwards compatibility mechanism to fix properly, and it's too late in the 0.48 cycle to introduce it. --- diff --git a/src/desktop.cpp b/src/desktop.cpp index 6690e0af1..52f172577 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -158,7 +158,7 @@ SPDesktop::SPDesktop() : _active( false ), _w2d(), _d2w(), - _doc2dt( Geom::identity() ), + _doc2dt( Geom::Scale(1, -1) ), grids_visible( false ) { _d2w.setIdentity(); @@ -272,6 +272,7 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas, Inkscape::UI::View::EditWid /* Connect event for page resize */ + _doc2dt[5] = sp_document_height (document); sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (drawing), _doc2dt); _modified_connection = namedview->connectModified(sigc::bind<2>(sigc::ptr_fun(&_namedview_modified), this)); @@ -724,8 +725,8 @@ SPDesktop::point() const if (p[Geom::X] >= r0[Geom::X] && p[Geom::X] <= r1[Geom::X] && - p[Geom::Y] >= r0[Geom::Y] && - p[Geom::Y] <= r1[Geom::Y]) + p[Geom::Y] >= r1[Geom::Y] && + p[Geom::Y] <= r0[Geom::Y]) { return p; } else { @@ -792,8 +793,8 @@ SPDesktop::set_display_area (double x0, double y0, double x1, double y1, double int clear = FALSE; if (!NR_DF_TEST_CLOSE (newscale, scale, 1e-4 * scale)) { // zoom changed - set new zoom factors - _d2w = Geom::Scale(newscale); - _w2d = Geom::Scale(1/newscale); + _d2w = Geom::Scale(newscale, -newscale); + _w2d = Geom::Scale(1/newscale, 1/-newscale); sp_canvas_item_affine_absolute(SP_CANVAS_ITEM(main), _d2w); clear = TRUE; signal_zoom_changed.emit(_d2w.descrim()); @@ -801,10 +802,10 @@ SPDesktop::set_display_area (double x0, double y0, double x1, double y1, double /* Calculate top left corner (in document pixels) */ x0 = cx - 0.5 * viewbox.dimensions()[Geom::X] / newscale; - y0 = cy - 0.5 * viewbox.dimensions()[Geom::Y] / newscale; + y1 = cy + 0.5 * viewbox.dimensions()[Geom::Y] / newscale; /* Scroll */ - sp_canvas_scroll_to (canvas, x0 * newscale - border, y0 * newscale - border, clear); + sp_canvas_scroll_to (canvas, x0 * newscale - border, y1 * -newscale - border, clear); /* update perspective lines if we are in the 3D box tool (so that infinite ones are shown correctly) */ sp_box3d_context_update_lines(event_context); @@ -828,7 +829,8 @@ Geom::Rect SPDesktop::get_display_area() const double const scale = _d2w[0]; - return viewbox * (1./scale); + return Geom::Rect(Geom::Point(viewbox.min()[Geom::X] / scale, viewbox.max()[Geom::Y] / -scale), + Geom::Point(viewbox.max()[Geom::X] / scale, viewbox.min()[Geom::Y] / -scale)); } /** @@ -1543,6 +1545,7 @@ SPDesktop::onDocumentURISet (gchar const* uri) void SPDesktop::onDocumentResized (gdouble width, gdouble height) { + _doc2dt[5] = height; sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (drawing), _doc2dt); Geom::Rect const a(Geom::Point(0, 0), Geom::Point(width, height)); SP_CTRLRECT(page)->setRectangle(a); diff --git a/src/document.cpp b/src/document.cpp index aeafaf1f9..101c54e30 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -327,7 +327,7 @@ sp_document_create(Inkscape::XML::Document *rdoc, document->base = NULL; document->name = g_strdup(name); - sp_object_repr_build_tree(document, rroot); + document->root = sp_object_repr_build_tree(document, rroot); /* fixme: Not sure about this, but lets assume ::build updates */ rroot->setAttribute("inkscape:version", Inkscape::version_string); @@ -662,6 +662,7 @@ void SPDocument::fitToRect(Geom::Rect const &rect, bool with_margins) double const w = rect.width(); double const h = rect.height(); + double const old_height = sp_document_height(this); SPUnit const &px(sp_unit_get_by_id(SP_UNIT_PX)); /* in px */ @@ -695,14 +696,16 @@ void SPDocument::fitToRect(Geom::Rect const &rect, bool with_margins) } Geom::Rect const rect_with_margins( - rect.min() - Geom::Point(margin_left, margin_top), - rect.max() + Geom::Point(margin_right, margin_bottom)); + rect.min() - Geom::Point(margin_left, margin_bottom), + rect.max() + Geom::Point(margin_right, margin_top)); sp_document_set_width(this, rect_with_margins.width(), &px); sp_document_set_height(this, rect_with_margins.height(), &px); - Geom::Translate const tr(-to_2geom(rect_with_margins.min())); + Geom::Translate const tr( + Geom::Point(0, old_height - rect_with_margins.height()) + - to_2geom(rect_with_margins.min())); SP_GROUP(root)->translateChildItems(tr); if(nv) { @@ -710,7 +713,7 @@ void SPDocument::fitToRect(Geom::Rect const &rect, bool with_margins) nv->translateGuides(tr2); // update the viewport so the drawing appears to stay where it was - nv->scrollAllDesktops(-tr2[0], -tr2[1], false); + nv->scrollAllDesktops(-tr2[0], tr2[1], false); } } diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index 52f070591..6e4bb3b7e 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -631,8 +631,12 @@ CairoRenderer::setupDocument(CairoRenderContext *ctx, SPDocument *doc, bool page if (ret && !pageBoundingBox) { + double high = sp_document_height(doc); + if (ctx->_vector_based_target) + high *= PT_PER_PX; + Geom::Matrix tp(Geom::Translate(-d.x0 * (ctx->_vector_based_target ? PX_PER_PT : 1.0), - -d.y0 * (ctx->_vector_based_target ? PX_PER_PT : 1.0))); + (d.y1 - high) * (ctx->_vector_based_target ? PX_PER_PT : 1.0))); ctx->transform(&tp); } diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index deef367a4..d4b35b261 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -46,12 +46,13 @@ Grid::load (Inkscape::Extension::Extension */*module*/) namespace { -void build_lines(int axis, Geom::Rect bounding_area, float offset, - float spacing, SVG::PathString &path_data) +Glib::ustring build_lines(int axis, Geom::Rect bounding_area, + float offset, float spacing) { Geom::Point point_offset(0.0, 0.0); point_offset[axis] = offset; + SVG::PathString path_data; for (Geom::Point start_point = bounding_area.min(); start_point[axis] + offset <= (bounding_area.max())[axis]; start_point[axis] += spacing) { @@ -61,6 +62,8 @@ void build_lines(int axis, Geom::Rect bounding_area, float offset, path_data.moveTo(start_point + point_offset) .lineTo(end_point + point_offset); } + + return path_data; } } @@ -86,8 +89,10 @@ Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc if (bounds) { bounding_area = *bounds; } - Geom::Rect temprec = Geom::Rect(Geom::Point(bounding_area.min()[Geom::X], bounding_area.min()[Geom::Y]), - Geom::Point(bounding_area.max()[Geom::X], bounding_area.max()[Geom::Y])); + + gdouble doc_height = sp_document_height(document->doc()); + Geom::Rect temprec = Geom::Rect(Geom::Point(bounding_area.min()[Geom::X], doc_height - bounding_area.min()[Geom::Y]), + Geom::Point(bounding_area.max()[Geom::X], doc_height - bounding_area.max()[Geom::Y])); bounding_area = temprec; } @@ -98,9 +103,10 @@ Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc float offsets[2] = { module->get_param_float("xoffset"), module->get_param_float("yoffset") }; - SVG::PathString path_data; + Glib::ustring path_data(""); for ( int axis = 0 ; axis < 2 ; ++axis ) { - build_lines(axis, bounding_area, offsets[axis], spacings[axis], path_data); + path_data += build_lines(axis, bounding_area, + offsets[axis], spacings[axis]); } Inkscape::XML::Document * xml_doc = sp_document_repr_doc(document->doc()); diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp index 1fdf1d7fd..28bba1beb 100644 --- a/src/extension/internal/latex-text-renderer.cpp +++ b/src/extension/internal/latex-text-renderer.cpp @@ -501,8 +501,7 @@ LaTeXTextRenderer::setupDocument(SPDocument *doc, bool pageBoundingBox, SPItem * if (!pageBoundingBox) { - Geom::Translate t(-d->min()[Geom::X], d->max()[Geom::Y] - sp_document_height(doc)); - push_transform( t ); + push_transform( Geom::Translate( - d->min() ) ); } // flip y-axis diff --git a/src/flood-context.cpp b/src/flood-context.cpp index 910b5dd80..612ae1cfc 100644 --- a/src/flood-context.cpp +++ b/src/flood-context.cpp @@ -798,7 +798,7 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even unsigned int height = (int)ceil(screen.height() * zoom_scale * padding); Geom::Point origin(screen.min()[Geom::X], - screen.min()[Geom::Y]); + sp_document_height(document) - screen.height() - screen.min()[Geom::Y]); origin[Geom::X] = origin[Geom::X] + (screen.width() * ((1 - padding) / 2)); origin[Geom::Y] = origin[Geom::Y] + (screen.height() * ((1 - padding) / 2)); @@ -905,7 +905,7 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even } for (unsigned int i = 0; i < fill_points.size(); i++) { - Geom::Point pw = Geom::Point(fill_points[i][Geom::X] / zoom_scale, (fill_points[i][Geom::Y] / zoom_scale)) * affine; + Geom::Point pw = Geom::Point(fill_points[i][Geom::X] / zoom_scale, sp_document_height(document) + (fill_points[i][Geom::Y] / zoom_scale)) * affine; pw[Geom::X] = (int)MIN(width - 1, MAX(0, pw[Geom::X])); pw[Geom::Y] = (int)MIN(height - 1, MAX(0, pw[Geom::Y])); diff --git a/src/helper/pixbuf-ops.cpp b/src/helper/pixbuf-ops.cpp index c26d55b8b..3be63aa68 100644 --- a/src/helper/pixbuf-ops.cpp +++ b/src/helper/pixbuf-ops.cpp @@ -113,7 +113,7 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/, double padding = 1.0; Geom::Point origin(screen.min()[Geom::X], - screen.min()[Geom::Y]); + sp_document_height(doc) - screen[Geom::Y].extent() - screen.min()[Geom::Y]); origin[Geom::X] = origin[Geom::X] + (screen[Geom::X].extent() * ((1 - padding) / 2)); origin[Geom::Y] = origin[Geom::Y] + (screen[Geom::Y].extent() * ((1 - padding) / 2)); diff --git a/src/helper/png-write.cpp b/src/helper/png-write.cpp index 8eb9e27bf..b1c135db0 100644 --- a/src/helper/png-write.cpp +++ b/src/helper/png-write.cpp @@ -424,9 +424,24 @@ sp_export_png_file(SPDocument *doc, gchar const *filename, sp_document_ensure_up_to_date(doc); - /* Calculate translation */ - Geom::Point translation = Geom::Point(-area[Geom::X][0], -area[Geom::Y][0]); - + /* Calculate translation by transforming to document coordinates (flipping Y)*/ + Geom::Point translation = Geom::Point(-area[Geom::X][0], area[Geom::Y][1] - sp_document_height(doc)); + + /* This calculation is only valid when assumed that (x0,y0)= area.corner(0) and (x1,y1) = area.corner(2) + * 1) a[0] * x0 + a[2] * y1 + a[4] = 0.0 + * 2) a[1] * x0 + a[3] * y1 + a[5] = 0.0 + * 3) a[0] * x1 + a[2] * y1 + a[4] = width + * 4) a[1] * x0 + a[3] * y0 + a[5] = height + * 5) a[1] = 0.0; + * 6) a[2] = 0.0; + * + * (1,3) a[0] * x1 - a[0] * x0 = width + * a[0] = width / (x1 - x0) + * (2,4) a[3] * y0 - a[3] * y1 = height + * a[3] = height / (y0 - y1) + * (1) a[4] = -a[0] * x0 + * (2) a[5] = -a[3] * y1 + */ Geom::Matrix const affine(Geom::Translate(translation) * Geom::Scale(width / area.width(), diff --git a/src/knot-holder-entity.cpp b/src/knot-holder-entity.cpp index 6fcb26247..2d0d5eb02 100644 --- a/src/knot-holder-entity.cpp +++ b/src/knot-holder-entity.cpp @@ -135,16 +135,21 @@ KnotHolderEntity::snap_knot_position_constrained(Geom::Point const &p, Inkscape: /* TODO: this pattern manipulation is not able to handle general transformation matrices. Only matrices that are the result of a pure scale times a pure rotation. */ -Geom::Point -PatternKnotHolderEntityXY::knot_get() +static gdouble sp_pattern_extract_theta(SPPattern *pat) { - SPPattern *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style)); + Geom::Matrix transf = pat->patternTransform; + return Geom::atan2(transf.xAxis()); +} - gdouble x = 0; - gdouble y = -pattern_height(pat); +static Geom::Point sp_pattern_extract_scale(SPPattern *pat) +{ + Geom::Matrix transf = pat->patternTransform; + return Geom::Point( transf.expansionX(), transf.expansionY() ); +} - Geom::Point delta = Geom::Point(x,y) * pat->patternTransform; - return delta; +static Geom::Point sp_pattern_extract_trans(SPPattern const *pat) +{ + return Geom::Point(pat->patternTransform[4], pat->patternTransform[5]); } void @@ -164,23 +169,32 @@ PatternKnotHolderEntityXY::knot_set(Geom::Point const &p, Geom::Point const &ori } if (state) { - Geom::Point knot_relpos(0, -pattern_height(pat)); - Geom::Point const q = p_snapped - (knot_relpos * pat->patternTransform); + Geom::Point const q = p_snapped - sp_pattern_extract_trans(pat); sp_item_adjust_pattern(item, Geom::Matrix(Geom::Translate(q))); } item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } +Geom::Point +PatternKnotHolderEntityXY::knot_get() +{ + SPPattern const *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style)); + return sp_pattern_extract_trans(pat); +} + Geom::Point PatternKnotHolderEntityAngle::knot_get() { SPPattern *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style)); - gdouble x = pattern_width(pat); - gdouble y = -pattern_height(pat); - - Geom::Point delta = Geom::Point(x,y) * pat->patternTransform; + gdouble x = (pattern_width(pat)); + gdouble y = 0; + Geom::Point delta = Geom::Point(x,y); + Geom::Point scale = sp_pattern_extract_scale(pat); + gdouble theta = sp_pattern_extract_theta(pat); + delta = delta * Geom::Matrix(Geom::Scale(scale))*Geom::Matrix(Geom::Rotate(theta)); + delta = delta + sp_pattern_extract_trans(pat); return delta; } @@ -192,38 +206,24 @@ PatternKnotHolderEntityAngle::knot_set(Geom::Point const &p, Geom::Point const & SPPattern *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style)); - // rotate pattern around XY knot position - Geom::Point knot_relpos(pattern_width(pat), -pattern_height(pat)); - Geom::Point xy_knot_relpos(0, -pattern_height(pat)); - Geom::Point transform_origin = xy_knot_relpos * pat->patternTransform; - - Geom::Point oldp = (knot_relpos * pat->patternTransform) - transform_origin; - Geom::Point newp = p - transform_origin; - - gdouble theta = Geom::angle_between(oldp, newp); + // get the angle from pattern 0,0 to the cursor pos + Geom::Point delta = p - sp_pattern_extract_trans(pat); + gdouble theta = atan2(delta); if ( state & GDK_CONTROL_MASK ) { theta = sp_round(theta, M_PI/snaps); } - Geom::Matrix rot = Geom::Matrix(Geom::Translate(-transform_origin)) - * Geom::Rotate(theta) - * Geom::Translate(transform_origin); - sp_item_adjust_pattern(item, rot); + // get the scale from the current transform so we can keep it. + Geom::Point scl = sp_pattern_extract_scale(pat); + Geom::Matrix rot = Geom::Matrix(Geom::Scale(scl)) * Geom::Matrix(Geom::Rotate(theta)); + Geom::Point const t = sp_pattern_extract_trans(pat); + rot[4] = t[Geom::X]; + rot[5] = t[Geom::Y]; + sp_item_adjust_pattern(item, rot, true); item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } -Geom::Point -PatternKnotHolderEntityScale::knot_get() -{ - SPPattern *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style)); - - gdouble x = pattern_width(pat); - gdouble y = 0; - Geom::Point delta = Geom::Point(x,y) * pat->patternTransform; - return delta; -} - void PatternKnotHolderEntityScale::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) { @@ -232,32 +232,49 @@ PatternKnotHolderEntityScale::knot_set(Geom::Point const &p, Geom::Point const & // FIXME: this snapping should be done together with knowing whether control was pressed. If GDK_CONTROL_MASK, then constrained snapping should be used. Geom::Point p_snapped = snap_knot_position(p); - Geom::Point knot_relpos(pattern_width(pat), 0); - Geom::Point xy_knot_relpos(0, -pattern_height(pat)); - Geom::Point transform_origin = xy_knot_relpos * pat->patternTransform; - - // do the scaling in pattern coordinate space - Geom::Point oldp = knot_relpos - xy_knot_relpos; - Geom::Point newp = p_snapped * pat->patternTransform.inverse() - xy_knot_relpos; - - if (Geom::are_near(newp.length(), 0)) return; + // get angle from current transform + gdouble theta = sp_pattern_extract_theta(pat); - Geom::Scale s(1); - if (state & GDK_CONTROL_MASK) { - // uniform scaling - s = Geom::Scale(oldp * (newp.length() * oldp.length())); + // Get the new scale from the position of the knotholder + Geom::Point d = p_snapped - sp_pattern_extract_trans(pat); + gdouble pat_x = pattern_width(pat); + gdouble pat_y = pattern_height(pat); + Geom::Scale scl(1); + if ( state & GDK_CONTROL_MASK ) { + // if ctrl is pressed: use 1:1 scaling + gdouble pat_h = hypot(pat_x, pat_y); + scl = Geom::Scale(d.length() / pat_h); } else { - s = Geom::Scale(newp[Geom::X] / oldp[Geom::X], newp[Geom::Y] / oldp[Geom::Y]); + d *= Geom::Rotate(-theta); + scl = Geom::Scale(d[Geom::X] / pat_x, d[Geom::Y] / pat_y); } - Geom::Matrix scl = Geom::Matrix(Geom::Translate(-xy_knot_relpos)) - * s - * Geom::Translate(xy_knot_relpos) - * pat->patternTransform; - sp_item_adjust_pattern(item, scl, true); + Geom::Matrix rot = (Geom::Matrix)scl * Geom::Rotate(theta); + + Geom::Point const t = sp_pattern_extract_trans(pat); + rot[4] = t[Geom::X]; + rot[5] = t[Geom::Y]; + sp_item_adjust_pattern(item, rot, true); item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } + +Geom::Point +PatternKnotHolderEntityScale::knot_get() +{ + SPPattern *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style)); + + gdouble x = pattern_width(pat); + gdouble y = pattern_height(pat); + Geom::Point delta = Geom::Point(x,y); + Geom::Matrix a = pat->patternTransform; + a[4] = 0; + a[5] = 0; + delta = delta * a; + delta = delta + sp_pattern_extract_trans(pat); + return delta; +} + /* Local Variables: mode:c++ diff --git a/src/select-context.cpp b/src/select-context.cpp index 9035021d6..028c8634b 100644 --- a/src/select-context.cpp +++ b/src/select-context.cpp @@ -765,12 +765,12 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event) gint mul = 1 + gobble_key_events( get_group0_keyval(&event->key), 0); // with any mask if (MOD__ALT) { // alt - if (MOD__SHIFT) sp_selection_move_screen(desktop, 0, mul*-10); // shift - else sp_selection_move_screen(desktop, 0, mul*-1); // no shift + if (MOD__SHIFT) sp_selection_move_screen(desktop, 0, mul*10); // shift + else sp_selection_move_screen(desktop, 0, mul*1); // no shift } else { // no alt - if (MOD__SHIFT) sp_selection_move(desktop, 0, mul*-10*nudge); // shift - else sp_selection_move(desktop, 0, mul*-nudge); // no shift + if (MOD__SHIFT) sp_selection_move(desktop, 0, mul*10*nudge); // shift + else sp_selection_move(desktop, 0, mul*nudge); // no shift } ret = TRUE; } @@ -799,12 +799,12 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event) gint mul = 1 + gobble_key_events( get_group0_keyval(&event->key), 0); // with any mask if (MOD__ALT) { // alt - if (MOD__SHIFT) sp_selection_move_screen(desktop, 0, mul*10); // shift - else sp_selection_move_screen(desktop, 0, mul*1); // no shift + if (MOD__SHIFT) sp_selection_move_screen(desktop, 0, mul*-10); // shift + else sp_selection_move_screen(desktop, 0, mul*-1); // no shift } else { // no alt - if (MOD__SHIFT) sp_selection_move(desktop, 0, mul*10*nudge); // shift - else sp_selection_move(desktop, 0, mul*nudge); // no shift + if (MOD__SHIFT) sp_selection_move(desktop, 0, mul*-10*nudge); // shift + else sp_selection_move(desktop, 0, mul*-nudge); // no shift } ret = TRUE; } @@ -842,9 +842,9 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event) get_group0_keyval(&event->key), 0); // with any mask sp_selection_rotate_screen(selection, mul*1); } else if (MOD__CTRL) { - sp_selection_rotate(selection, -90); + sp_selection_rotate(selection, 90); } else if (snaps) { - sp_selection_rotate(selection, -180/snaps); + sp_selection_rotate(selection, 180/snaps); } ret = TRUE; break; @@ -854,9 +854,9 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event) get_group0_keyval(&event->key), 0); // with any mask sp_selection_rotate_screen(selection, -1*mul); } else if (MOD__CTRL) { - sp_selection_rotate(selection, 90); + sp_selection_rotate(selection, -90); } else if (snaps) { - sp_selection_rotate(selection, 180/snaps); + sp_selection_rotate(selection, -180/snaps); } ret = TRUE; break; diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 452a4ff9d..730467ee5 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -2273,8 +2273,9 @@ void sp_selection_to_marker(SPDesktop *desktop, bool apply) } // calculate the transform to be applied to objects to move them to 0,0 - Geom::Point move_p = -*c; - Geom::Matrix move = Geom::Translate(move_p); + Geom::Point move_p = Geom::Point(0, sp_document_height(doc)) - *c; + move_p[Geom::Y] = -move_p[Geom::Y]; + Geom::Matrix move = Geom::Matrix(Geom::Translate(move_p)); GSList *items = g_slist_copy((GSList *) selection->itemList()); @@ -2395,7 +2396,8 @@ sp_selection_tile(SPDesktop *desktop, bool apply) } // calculate the transform to be applied to objects to move them to 0,0 - Geom::Point move_p = -(r->min() + Geom::Point(0, r->dimensions()[Geom::Y])); + Geom::Point move_p = Geom::Point(0, sp_document_height(doc)) - (r->min() + Geom::Point(0, r->dimensions()[Geom::Y])); + move_p[Geom::Y] = -move_p[Geom::Y]; Geom::Matrix move = Geom::Matrix(Geom::Translate(move_p)); GSList *items = g_slist_copy((GSList *) selection->itemList()); @@ -2746,12 +2748,12 @@ sp_selection_create_bitmap_copy(SPDesktop *desktop) Geom::Matrix t; double shift_x = bbox.x0; - double shift_y = bbox.y0; + double shift_y = bbox.y1; if (res == PX_PER_IN) { // for default 90 dpi, snap it to pixel grid shift_x = round(shift_x); - shift_y = round(shift_y); + shift_y = -round(-shift_y); // this gets correct rounding despite coordinate inversion, remove the negations when the inversion is gone } - t = Geom::Translate(shift_x, shift_y) * eek.inverse(); + t = Geom::Scale(1, -1) * Geom::Translate(shift_x, shift_y) * eek.inverse(); // Do the export sp_export_png_file(document, filepath, diff --git a/src/seltrans-handles.cpp b/src/seltrans-handles.cpp index ba18b2a5b..95b680c5e 100644 --- a/src/seltrans-handles.cpp +++ b/src/seltrans-handles.cpp @@ -5,24 +5,24 @@ SPSelTransHandle const handles_scale[] = { //anchor cursor control action request x y - {GTK_ANCHOR_NE, GDK_TOP_LEFT_CORNER, 1, sp_sel_trans_scale, sp_sel_trans_scale_request, 0, 1}, - {GTK_ANCHOR_N, GDK_TOP_SIDE, 3, sp_sel_trans_stretch, sp_sel_trans_stretch_request, 0.5, 1}, - {GTK_ANCHOR_NW, GDK_TOP_RIGHT_CORNER, 0, sp_sel_trans_scale, sp_sel_trans_scale_request, 1, 1}, + {GTK_ANCHOR_SE, GDK_TOP_LEFT_CORNER, 0, sp_sel_trans_scale, sp_sel_trans_scale_request, 0, 1}, + {GTK_ANCHOR_S, GDK_TOP_SIDE, 3, sp_sel_trans_stretch, sp_sel_trans_stretch_request, 0.5, 1}, + {GTK_ANCHOR_SW, GDK_TOP_RIGHT_CORNER, 1, sp_sel_trans_scale, sp_sel_trans_scale_request, 1, 1}, {GTK_ANCHOR_W, GDK_RIGHT_SIDE, 2, sp_sel_trans_stretch, sp_sel_trans_stretch_request, 1, 0.5}, - {GTK_ANCHOR_SW, GDK_BOTTOM_RIGHT_CORNER, 1, sp_sel_trans_scale, sp_sel_trans_scale_request, 1, 0}, - {GTK_ANCHOR_S, GDK_BOTTOM_SIDE, 3, sp_sel_trans_stretch, sp_sel_trans_stretch_request, 0.5, 0}, - {GTK_ANCHOR_SE, GDK_BOTTOM_LEFT_CORNER, 0, sp_sel_trans_scale, sp_sel_trans_scale_request, 0, 0}, + {GTK_ANCHOR_NW, GDK_BOTTOM_RIGHT_CORNER, 0, sp_sel_trans_scale, sp_sel_trans_scale_request, 1, 0}, + {GTK_ANCHOR_N, GDK_BOTTOM_SIDE, 3, sp_sel_trans_stretch, sp_sel_trans_stretch_request, 0.5, 0}, + {GTK_ANCHOR_NE, GDK_BOTTOM_LEFT_CORNER, 1, sp_sel_trans_scale, sp_sel_trans_scale_request, 0, 0}, {GTK_ANCHOR_E, GDK_LEFT_SIDE, 2, sp_sel_trans_stretch, sp_sel_trans_stretch_request, 0, 0.5} }; SPSelTransHandle const handles_rotate[] = { - {GTK_ANCHOR_NE, GDK_EXCHANGE, 10, sp_sel_trans_rotate, sp_sel_trans_rotate_request, 0, 1}, - {GTK_ANCHOR_N, GDK_SB_H_DOUBLE_ARROW, 5, sp_sel_trans_skew, sp_sel_trans_skew_request, 0.5, 1}, - {GTK_ANCHOR_NW, GDK_EXCHANGE, 8, sp_sel_trans_rotate, sp_sel_trans_rotate_request, 1, 1}, + {GTK_ANCHOR_SE, GDK_EXCHANGE, 4, sp_sel_trans_rotate, sp_sel_trans_rotate_request, 0, 1}, + {GTK_ANCHOR_S, GDK_SB_H_DOUBLE_ARROW, 5, sp_sel_trans_skew, sp_sel_trans_skew_request, 0.5, 1}, + {GTK_ANCHOR_SW, GDK_EXCHANGE, 6, sp_sel_trans_rotate, sp_sel_trans_rotate_request, 1, 1}, {GTK_ANCHOR_W, GDK_SB_V_DOUBLE_ARROW, 7, sp_sel_trans_skew, sp_sel_trans_skew_request, 1, 0.5}, - {GTK_ANCHOR_SW, GDK_EXCHANGE, 6, sp_sel_trans_rotate, sp_sel_trans_rotate_request, 1, 0}, - {GTK_ANCHOR_S, GDK_SB_H_DOUBLE_ARROW, 9, sp_sel_trans_skew, sp_sel_trans_skew_request, 0.5, 0}, - {GTK_ANCHOR_SE, GDK_EXCHANGE, 4, sp_sel_trans_rotate, sp_sel_trans_rotate_request, 0, 0}, + {GTK_ANCHOR_NW, GDK_EXCHANGE, 8, sp_sel_trans_rotate, sp_sel_trans_rotate_request, 1, 0}, + {GTK_ANCHOR_N, GDK_SB_H_DOUBLE_ARROW, 9, sp_sel_trans_skew, sp_sel_trans_skew_request, 0.5, 0}, + {GTK_ANCHOR_NE, GDK_EXCHANGE, 10, sp_sel_trans_rotate, sp_sel_trans_rotate_request, 0, 0}, {GTK_ANCHOR_E, GDK_SB_V_DOUBLE_ARROW, 11, sp_sel_trans_skew, sp_sel_trans_skew_request, 0, 0.5} }; diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp index def039937..f5edf7d97 100644 --- a/src/sp-guide.cpp +++ b/src/sp-guide.cpp @@ -217,14 +217,12 @@ static void sp_guide_set(SPObject *object, unsigned int key, const gchar *value) success += sp_svg_number_read_d(strarray[1], &newy); g_strfreev (strarray); if (success == 2) { - // Desktop coords fix - guide->point_on_line = Geom::Point(newx, sp_document_height(guide->document) - newy); + guide->point_on_line = Geom::Point(newx, newy); } else if (success == 1) { // before 0.46 style guideline definition. const gchar *attr = SP_OBJECT_REPR(object)->attribute("orientation"); if (attr && !strcmp(attr, "horizontal")) { - // Desktop coords fix - guide->point_on_line = Geom::Point(0, sp_document_height(guide->document) - newx); + guide->point_on_line = Geom::Point(0, newx); } else { guide->point_on_line = Geom::Point(newx, 0); } diff --git a/src/sp-item.cpp b/src/sp-item.cpp index f60a2b27a..c4411e47d 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -1574,7 +1574,8 @@ Geom::Matrix sp_item_i2d_affine(SPItem const *item) g_assert(SP_IS_ITEM(item)); Geom::Matrix const ret( sp_item_i2doc_affine(item) - ); + * Geom::Scale(1, -1) + * Geom::Translate(0, sp_document_height(SP_OBJECT_DOCUMENT(item))) ); return ret; } @@ -1587,7 +1588,8 @@ void sp_item_set_i2d_affine(SPItem *item, Geom::Matrix const &i2dt) if (SP_OBJECT_PARENT(item)) { dt2p = sp_item_i2d_affine((SPItem *) SP_OBJECT_PARENT(item)).inverse(); } else { - dt2p = ( Geom::identity() ); + dt2p = ( Geom::Translate(0, -sp_document_height(SP_OBJECT_DOCUMENT(item))) + * Geom::Scale(1, -1) ); } Geom::Matrix const i2p( i2dt * dt2p ); diff --git a/src/sp-object-repr.cpp b/src/sp-object-repr.cpp index e32819746..62143e3ab 100644 --- a/src/sp-object-repr.cpp +++ b/src/sp-object-repr.cpp @@ -91,9 +91,9 @@ static unsigned const N_NAME_TYPES = SODIPODI_TYPE + 1; static GType name_to_gtype(NameType name_type, gchar const *name); /** - * Construct an SPRoot and all its descendents from the given XML representation. + * Construct an SPRoot and all its descendents from the given repr. */ -void +SPObject * sp_object_repr_build_tree(SPDocument *document, Inkscape::XML::Node *repr) { g_assert(document != NULL); @@ -103,14 +103,13 @@ sp_object_repr_build_tree(SPDocument *document, Inkscape::XML::Node *repr) g_assert(name != NULL); GType const type = name_to_gtype(REPR_NAME, name); g_assert(g_type_is_a(type, SP_TYPE_ROOT)); + gpointer newobj = g_object_new(type, 0); + g_assert(newobj != NULL); + SPObject *const object = SP_OBJECT(newobj); + g_assert(object != NULL); + sp_object_invoke_build(object, document, repr, FALSE); - // create and assign root - SPObject *root = SP_OBJECT(g_object_new(type, 0)); - g_assert(root != NULL); - document->root = root; - - // recursively create SP tree elements - sp_object_invoke_build(root, document, repr, FALSE); + return object; } GType diff --git a/src/sp-object-repr.h b/src/sp-object-repr.h index 43aead41e..f3a80f83c 100644 --- a/src/sp-object-repr.h +++ b/src/sp-object-repr.h @@ -21,7 +21,7 @@ class Node; } -void sp_object_repr_build_tree (SPDocument *document, Inkscape::XML::Node *repr); +SPObject *sp_object_repr_build_tree (SPDocument *document, Inkscape::XML::Node *repr); GType sp_repr_type_lookup (Inkscape::XML::Node *repr); diff --git a/src/spray-context.cpp b/src/spray-context.cpp index 9b9caee15..2bdac197f 100644 --- a/src/spray-context.cpp +++ b/src/spray-context.cpp @@ -501,7 +501,7 @@ bool sp_spray_recursive(SPDesktop *desktop, sp_spray_rotate_rel(center,desktop,item_copied, Geom::Rotate(angle)); //Move the cursor p Geom::Point move = (Geom::Point(cos(tilt)*cos(dp)*dr/(1-ratio)+sin(tilt)*sin(dp)*dr/(1+ratio),-sin(tilt)*cos(dp)*dr/(1-ratio)+cos(tilt)*sin(dp)*dr/(1+ratio)))+(p-a->midpoint()); - sp_item_move_rel(item_copied, Geom::Translate(move[Geom::X], move[Geom::Y])); + sp_item_move_rel(item_copied, Geom::Translate(move[Geom::X], -move[Geom::Y])); did = true; } } @@ -556,7 +556,7 @@ bool sp_spray_recursive(SPDesktop *desktop, sp_spray_scale_rel(center,desktop,item_copied, Geom::Scale(_scale,_scale)); sp_spray_scale_rel(center,desktop,item_copied, Geom::Scale(scale,scale)); sp_spray_rotate_rel(center,desktop,item_copied, Geom::Rotate(angle)); - sp_item_move_rel(item_copied, Geom::Translate(move[Geom::X], move[Geom::Y])); + sp_item_move_rel(item_copied, Geom::Translate(move[Geom::X], -move[Geom::Y])); // union and duplication selection->clear(); @@ -593,7 +593,7 @@ bool sp_spray_recursive(SPDesktop *desktop, sp_spray_scale_rel(center,desktop,item_copied, Geom::Scale(scale,scale)); sp_spray_rotate_rel(center,desktop,item_copied, Geom::Rotate(angle)); Geom::Point move = (Geom::Point(cos(tilt)*cos(dp)*dr/(1-ratio)+sin(tilt)*sin(dp)*dr/(1+ratio),-sin(tilt)*cos(dp)*dr/(1-ratio)+cos(tilt)*sin(dp)*dr/(1+ratio)))+(p-a->midpoint()); - sp_item_move_rel(item_copied, Geom::Translate(move[Geom::X], move[Geom::Y])); + sp_item_move_rel(item_copied, Geom::Translate(move[Geom::X], -move[Geom::Y])); Inkscape::GC::release(clone); diff --git a/src/text-context.cpp b/src/text-context.cpp index 984876f78..4f89bd1e1 100644 --- a/src/text-context.cpp +++ b/src/text-context.cpp @@ -684,7 +684,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons // Cursor height is defined by the new text object's font size; it needs to be set // articifically here, for the text object does not exist yet: double cursor_height = sp_desktop_get_font_size_tool(desktop); - sp_ctrlline_set_coords(SP_CTRLLINE(tc->cursor), dtp, dtp - Geom::Point(0, cursor_height)); + sp_ctrlline_set_coords(SP_CTRLLINE(tc->cursor), dtp, dtp + Geom::Point(0, cursor_height)); event_context->_message_context->set(Inkscape::NORMAL_MESSAGE, _("Type text; Enter to start new line.")); // FIXME:: this is a copy of a string from _update_cursor below, do not desync event_context->within_tolerance = false; diff --git a/src/tweak-context.cpp b/src/tweak-context.cpp index a34a61f53..13299b5a4 100644 --- a/src/tweak-context.cpp +++ b/src/tweak-context.cpp @@ -448,7 +448,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P if (a->contains(p)) x = 0; if (x < 1) { Geom::Point move = force * 0.5 * (cos(M_PI * x) + 1) * vector; - sp_item_move_rel(item, Geom::Translate(move[Geom::X], move[Geom::Y])); + sp_item_move_rel(item, Geom::Translate(move[Geom::X], -move[Geom::Y])); did = true; } } @@ -462,7 +462,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P if (x < 1) { Geom::Point move = force * 0.5 * (cos(M_PI * x) + 1) * (reverse? (a->midpoint() - p) : (p - a->midpoint())); - sp_item_move_rel(item, Geom::Translate(move[Geom::X], move[Geom::Y])); + sp_item_move_rel(item, Geom::Translate(move[Geom::X], -move[Geom::Y])); did = true; } } @@ -477,7 +477,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P if (a->contains(p)) x = 0; if (x < 1) { Geom::Point move = force * 0.5 * (cos(M_PI * x) + 1) * Geom::Point(cos(dp)*dr, sin(dp)*dr); - sp_item_move_rel(item, Geom::Translate(move[Geom::X], move[Geom::Y])); + sp_item_move_rel(item, Geom::Translate(move[Geom::X], -move[Geom::Y])); did = true; } } @@ -502,7 +502,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P double x = Geom::L2(a->midpoint() - p)/radius; if (a->contains(p)) x = 0; if (x < 1) { - double angle = (reverse? -force : force) * 0.05 * (cos(M_PI * x) + 1) * M_PI; + double angle = (reverse? force : -force) * 0.05 * (cos(M_PI * x) + 1) * M_PI; sp_item_rotate_rel(item, Geom::Rotate(angle)); did = true; } diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index f27c49f61..a75a8d68d 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -252,11 +252,11 @@ ActionAlign::Coeffs const ActionAlign::_allCoeffs[10] = { {.5, .5, 0., 0., .5, .5, 0., 0.}, {0., 1., 0., 0., 0., 1., 0., 0.}, {0., 1., 0., 0., 1., 0., 0., 0.}, - {0., 0., 1., 0., 0., 0., 0., 1.}, - {0., 0., 1., 0., 0., 0., 1., 0.}, - {0., 0., .5, .5, 0., 0., .5, .5}, + {0., 0., 0., 1., 0., 0., 1., 0.}, {0., 0., 0., 1., 0., 0., 0., 1.}, - {0., 0., 0., 1., 0., 0., 1., 0.} + {0., 0., .5, .5, 0., 0., .5, .5}, + {0., 0., 1., 0., 0., 0., 1., 0.}, + {0., 0., 1., 0., 0., 0., 0., 1.} }; BBoxSort::BBoxSort(SPItem *pItem, Geom::Rect bounds, Geom::Dim2 orientation, double kBegin, double kEnd) : @@ -866,13 +866,13 @@ AlignAndDistribute::AlignAndDistribute() addDistributeButton(INKSCAPE_ICON_DISTRIBUTE_VERTICAL_TOP, _("Distribute top edges equidistantly"), - 1, 1, false, Geom::Y, 1., 0.); + 1, 1, false, Geom::Y, 0, 1); addDistributeButton(INKSCAPE_ICON_DISTRIBUTE_VERTICAL_CENTER, _("Distribute centers equidistantly vertically"), 1, 2, false, Geom::Y, .5, .5); addDistributeButton(INKSCAPE_ICON_DISTRIBUTE_VERTICAL_BOTTOM, _("Distribute bottom edges equidistantly"), - 1, 3, false, Geom::Y, 0., 1.); + 1, 3, false, Geom::Y, 1., 0.); //Baseline distribs addBaselineButton(INKSCAPE_ICON_DISTRIBUTE_HORIZONTAL_BASELINE, diff --git a/src/ui/tool/control-point-selection.cpp b/src/ui/tool/control-point-selection.cpp index c7fc8a3cc..f880d2ddf 100644 --- a/src/ui/tool/control-point-selection.cpp +++ b/src/ui/tool/control-point-selection.cpp @@ -545,11 +545,11 @@ bool ControlPointSelection::event(GdkEvent *event) case GDK_Up: case GDK_KP_Up: case GDK_KP_8: - return _keyboardMove(event->key, Geom::Point(0, -1)); + return _keyboardMove(event->key, Geom::Point(0, 1)); case GDK_Down: case GDK_KP_Down: case GDK_KP_2: - return _keyboardMove(event->key, Geom::Point(0, 1)); + return _keyboardMove(event->key, Geom::Point(0, -1)); case GDK_Right: case GDK_KP_Right: case GDK_KP_6: @@ -561,9 +561,9 @@ bool ControlPointSelection::event(GdkEvent *event) // rotates case GDK_bracketleft: - return _keyboardRotate(event->key, -1); - case GDK_bracketright: return _keyboardRotate(event->key, 1); + case GDK_bracketright: + return _keyboardRotate(event->key, -1); // scaling case GDK_less: diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index 392518207..2025a12d7 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -470,10 +470,12 @@ bool MultiPathManipulator::event(GdkEvent *event) // single handle functions // rotation case GDK_bracketleft: - pm.rotateHandle(n, which, -1, one_pixel); + case GDK_braceleft: + pm.rotateHandle(n, which, 1, one_pixel); break; case GDK_bracketright: - pm.rotateHandle(n, which, 1, one_pixel); + case GDK_braceright: + pm.rotateHandle(n, which, -1, one_pixel); break; // adjust length case GDK_period: diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index a50be873a..66f72f379 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1193,7 +1193,7 @@ void PathManipulator::_updateOutline() Geom::Point at = j->pointAt(0.5); Geom::Point ut = j->unitTangentAt(0.5); // rotate the point - ut *= Geom::Rotate(210.0 / 180.0 * M_PI); + ut *= Geom::Rotate(150.0 / 180.0 * M_PI); Geom::Point arrow_end = _desktop->w2d( _desktop->d2w(at) + Geom::unit_vector(_desktop->d2w(ut)) * 10.0); diff --git a/src/ui/tool/transform-handle-set.cpp b/src/ui/tool/transform-handle-set.cpp index 4cbc5ed4d..1af848b96 100644 --- a/src/ui/tool/transform-handle-set.cpp +++ b/src/ui/tool/transform-handle-set.cpp @@ -34,17 +34,17 @@ namespace UI { namespace { Gtk::AnchorType corner_to_anchor(unsigned c) { switch (c % 4) { - case 0: return Gtk::ANCHOR_SE; - case 1: return Gtk::ANCHOR_SW; - case 2: return Gtk::ANCHOR_NW; - default: return Gtk::ANCHOR_NE; + case 0: return Gtk::ANCHOR_NE; + case 1: return Gtk::ANCHOR_NW; + case 2: return Gtk::ANCHOR_SW; + default: return Gtk::ANCHOR_SE; } } Gtk::AnchorType side_to_anchor(unsigned s) { switch (s % 4) { - case 0: return Gtk::ANCHOR_S; + case 0: return Gtk::ANCHOR_N; case 1: return Gtk::ANCHOR_W; - case 2: return Gtk::ANCHOR_N; + case 2: return Gtk::ANCHOR_S; default: return Gtk::ANCHOR_E; } } @@ -208,8 +208,8 @@ private: static Glib::RefPtr _corner_to_pixbuf(unsigned c) { sp_select_context_get_type(); switch (c % 2) { - case 0: return Glib::wrap(handles[0], true); - default: return Glib::wrap(handles[1], true); + case 0: return Glib::wrap(handles[1], true); + default: return Glib::wrap(handles[0], true); } } Geom::Point _sc_center; @@ -332,10 +332,10 @@ private: static Glib::RefPtr _corner_to_pixbuf(unsigned c) { sp_select_context_get_type(); switch (c % 4) { - case 0: return Glib::wrap(handles[4], true); - case 1: return Glib::wrap(handles[6], true); - case 2: return Glib::wrap(handles[8], true); - default: return Glib::wrap(handles[10], true); + case 0: return Glib::wrap(handles[10], true); + case 1: return Glib::wrap(handles[8], true); + case 2: return Glib::wrap(handles[6], true); + default: return Glib::wrap(handles[4], true); } } Geom::Point _rot_center; diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 48317aa3e..ab440595f 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -1493,8 +1493,8 @@ sp_desktop_widget_update_vruler (SPDesktopWidget *dtw) NR::IRect viewbox = dtw->canvas->getViewboxIntegers(); double const scale = dtw->desktop->current_zoom(); - double s = viewbox.min()[Geom::Y] / scale - dtw->ruler_origin[Geom::Y]; - double e = viewbox.max()[Geom::Y] / scale - dtw->ruler_origin[Geom::Y]; + double s = viewbox.min()[Geom::Y] / -scale - dtw->ruler_origin[Geom::Y]; + double e = viewbox.max()[Geom::Y] / -scale - dtw->ruler_origin[Geom::Y]; gtk_ruler_set_range(GTK_RULER(dtw->vruler), s, e, GTK_RULER(dtw->vruler)->position, (e - s)); } @@ -1809,8 +1809,8 @@ sp_desktop_widget_update_scrollbars (SPDesktopWidget *dtw, double scale) Geom::OptRect deskarea = Geom::unify(darea, sp_item_bbox_desktop(item)); /* Canvas region we always show unconditionally */ - Geom::Rect carea( Geom::Point(deskarea->left() * scale - 64, deskarea->top() * scale - 64), - Geom::Point(deskarea->right() * scale + 64, deskarea->bottom() * scale + 64) ); + Geom::Rect carea( Geom::Point(deskarea->min()[Geom::X] * scale - 64, deskarea->max()[Geom::Y] * -scale - 64), + Geom::Point(deskarea->max()[Geom::X] * scale + 64, deskarea->min()[Geom::Y] * -scale + 64) ); Geom::Rect viewbox = dtw->canvas->getViewbox();