Draft: ShapeString: improve ObliqueAngle (#10811)

Calculation of the justification required the use of `optimalBoundingBox` and should happen after applying the oblique angle.
This commit is contained in:
Roy-043
2023-09-26 12:53:53 +02:00
committed by GitHub
parent bd0a3122b6
commit 56d3d3d5b1

View File

@@ -164,11 +164,6 @@ class ShapeString(DraftObject):
if obj.ScaleToSize:
ss_shape.scale(obj.Size / cap_height)
cap_height = obj.Size
just_vec = self.justification_vector(ss_shape,
cap_height,
obj.Justification,
obj.JustificationReference,
obj.KeepLeftMargin)
if obj.ObliqueAngle:
if -80 <= obj.ObliqueAngle <= 80:
mtx = App.Matrix()
@@ -177,6 +172,11 @@ class ShapeString(DraftObject):
else:
wrn = translate("draft", "ShapeString: oblique angle must be in the -80 to +80 degree range") + "\n"
App.Console.PrintWarning(wrn)
just_vec = self.justification_vector(ss_shape,
cap_height,
obj.Justification,
obj.JustificationReference,
obj.KeepLeftMargin)
shapes = ss_shape.SubShapes
for shape in shapes:
shape.translate(just_vec)
@@ -194,7 +194,7 @@ class ShapeString(DraftObject):
self.props_changed_store(prop)
def justification_vector(self, ss_shape, cap_height, just, just_ref, keep_left_margin): # ss_shape is a compound
box = ss_shape.BoundBox
box = ss_shape.optimalBoundingBox()
if keep_left_margin is True and "Left" in just:
vec = App.Vector(0, 0, 0)
else: