diff --git a/src/object/box3d.cpp b/src/object/box3d.cpp index 90222e010d2316565363f0a3880f59ca26d84d8f..59b2493242cd8ca37655be37cc54b9653abf5b9d 100644 --- a/src/object/box3d.cpp +++ b/src/object/box3d.cpp @@ -250,6 +250,18 @@ void SPBox3D::position_set() } } +static void set_transform_box3d_child_item(SPItem *childitem, Geom::Affine const &xform, gdouble scale) +{ + // Adjust stroke width. If stroke-width is unset, SPItem::adjust_stroke will create one (typically with value 1*scale) + childitem->adjust_stroke(scale); + + // Adjust pattern fill + childitem->adjust_pattern(xform); + + // Adjust gradient fill + childitem->adjust_gradient(xform); +} + Geom::Affine SPBox3D::set_transform(Geom::Affine const &xform) { // We don't apply the transform to the box directly but instead to its perspective (which is // done in sp_selection_apply_affine). Here we only adjust strokes, patterns, etc. @@ -257,20 +269,15 @@ Geom::Affine SPBox3D::set_transform(Geom::Affine const &xform) { Geom::Affine ret(Geom::Affine(xform).withoutTranslation()); gdouble const sw = hypot(ret[0], ret[1]); gdouble const sh = hypot(ret[2], ret[3]); + gdouble const scale = sqrt(fabs(sw * sh)); for (auto& child: children) { auto childitem = cast(&child); if (childitem) { - // Adjust stroke width - childitem->adjust_stroke(sqrt(fabs(sw * sh))); - - // Adjust pattern fill - childitem->adjust_pattern(xform); - - // Adjust gradient fill - childitem->adjust_gradient(xform); + set_transform_box3d_child_item(childitem, xform, scale); } } + set_transform_box3d_child_item(this, xform, scale); return Geom::identity(); } diff --git a/src/object/sp-item.cpp b/src/object/sp-item.cpp index 36e91b8383c822ad19518ed54cdfd006247fbcb5..22f30c8e5ccabb5949469bb22c5230309bfb291a 100644 --- a/src/object/sp-item.cpp +++ b/src/object/sp-item.cpp @@ -1482,10 +1482,14 @@ void SPItem::adjust_stroke( gdouble ex ) if (freeze_stroke_width) { return; } - SPStyle *style = this->style; if (style && !Geom::are_near(ex, 1.0, Geom::EPSILON) && !style->stroke_extensions.hairline) { + + // If there are any pending attribute updates, SPStyle::read overwrites the new stroke_width when + // updateRepr applies those other attributes. Write out any pending updates before adjusting stroke. + updateRepr(); + style->stroke_width.computed *= ex; style->stroke_width.set = TRUE; diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index b1914f38be3f947244c7d7ea3f6764d9fbe1d4d7..470c3f84d9c3483f920597d5b58a50c9cedf1c7f 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -78,7 +78,7 @@ static char const preferences_skeleton[] = - + diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 2c7e432b135b76b99e67a469ee5f9b6ecaf8a38b..36ac69704c4c15cc2f4dfce7f56a49a0fd87eb94 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -1808,7 +1808,7 @@ void ObjectSet::applyAffine(Geom::Affine const &affine, bool set_i2d, bool compe if (set_i2d) { item->set_i2d_affine(item->i2dt_affine() * (Geom::Affine)affine); } - item->doWriteTransform(item->transform, nullptr, compensate); + item->doWriteTransform(item->transform, &item->transform, compensate); } if (adjust_transf_center) { // The transformation center should not be touched in case of pasting or importing, which is allowed by this if clause diff --git a/src/ui/tools/box3d-tool.cpp b/src/ui/tools/box3d-tool.cpp index 2c9f2b479413780e6b8f89910af36b88d8ccb3dd..8f075c70f0e53c68a5b5c2061f336a2e316ba2e6 100644 --- a/src/ui/tools/box3d-tool.cpp +++ b/src/ui/tools/box3d-tool.cpp @@ -429,7 +429,7 @@ void Box3dTool::drag() // Create object auto newbox3d = SPBox3D::createBox3D(currentLayer()); - // Set style + // Set group style. This style isn't visible, since only the faces are visible. _desktop->applyCurrentOrToolStyle(newbox3d, "/tools/shapes/3dbox", false); box3d = newbox3d; @@ -455,6 +455,7 @@ void Box3dTool::drag() side->updateRepr(); // calls Box3DSide::write() and updates, e.g., the axes string description } + box3d->transform = currentLayer()->i2doc_affine().inverse(); box3d->set_z_orders(); box3d->updateRepr(); @@ -502,6 +503,7 @@ void Box3dTool::finishItem() box3d->orig_corner7 = drag_ptC_proj; box3d->updateRepr(); + box3d->doWriteTransform(box3d->transform, nullptr, true); box3d->relabel_corners();