diff options
| author | Thomas Holder <speleo3@users.sourceforge.net> | 2008-12-07 21:25:14 +0000 |
|---|---|---|
| committer | speleo3 <speleo3@users.sourceforge.net> | 2008-12-07 21:25:14 +0000 |
| commit | 8dfb5d6c5b3394c500a823cd19370fde5fa3b88c (patch) | |
| tree | 21ed3fe8769e3e1cae90801555353ceae5a05cfc /src/document.cpp | |
| parent | Fix a typo that causes a runtime error during the preferences test. (diff) | |
| download | inkscape-8dfb5d6c5b3394c500a823cd19370fde5fa3b88c.tar.gz inkscape-8dfb5d6c5b3394c500a823cd19370fde5fa3b88c.zip | |
Bug #167682 (resizing page must also resize viewBox)
(bzr r6968)
Diffstat (limited to 'src/document.cpp')
| -rw-r--r-- | src/document.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/document.cpp b/src/document.cpp index d38d5423f..a2923c086 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -510,6 +510,7 @@ sp_document_set_width (SPDocument *document, gdouble width, const SPUnit *unit) if (root->width.unit == SVGLength::PERCENT && root->viewBox_set) { // set to viewBox= root->viewBox.x1 = root->viewBox.x0 + sp_units_get_pixels (width, *unit); } else { // set to width= + gdouble old_computed = root->width.computed; root->width.computed = sp_units_get_pixels (width, *unit); /* SVG does not support meters as a unit, so we must translate meters to * cm when writing */ @@ -520,6 +521,9 @@ sp_document_set_width (SPDocument *document, gdouble width, const SPUnit *unit) root->width.value = width; root->width.unit = (SVGLength::Unit) sp_unit_get_svg_unit(unit); } + + if (root->viewBox_set) + root->viewBox.x1 = root->viewBox.x0 + (root->width.computed / old_computed) * (root->viewBox.x1 - root->viewBox.x0); } SP_OBJECT (root)->updateRepr(); @@ -532,6 +536,7 @@ void sp_document_set_height (SPDocument * document, gdouble height, const SPUnit if (root->height.unit == SVGLength::PERCENT && root->viewBox_set) { // set to viewBox= root->viewBox.y1 = root->viewBox.y0 + sp_units_get_pixels (height, *unit); } else { // set to height= + gdouble old_computed = root->height.computed; root->height.computed = sp_units_get_pixels (height, *unit); /* SVG does not support meters as a unit, so we must translate meters to * cm when writing */ @@ -542,6 +547,9 @@ void sp_document_set_height (SPDocument * document, gdouble height, const SPUnit root->height.value = height; root->height.unit = (SVGLength::Unit) sp_unit_get_svg_unit(unit); } + + if (root->viewBox_set) + root->viewBox.y1 = root->viewBox.y0 + (root->height.computed / old_computed) * (root->viewBox.y1 - root->viewBox.y0); } SP_OBJECT (root)->updateRepr(); |
