mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 13:57:34 +00:00
Fixed wrong text direction for plan level annotation
It occured when plan level spline direction was right-to-left.
This commit is contained in:
@@ -1332,18 +1332,22 @@ class PlanLevelDecorator(LevelDecorator):
|
|||||||
region = context.region
|
region = context.region
|
||||||
region3d = context.region_data
|
region3d = context.region_data
|
||||||
for verts in splines:
|
for verts in splines:
|
||||||
v0 = verts[0]
|
p0, p1 = [location_3d_to_region_2d(region, region3d, v) for v in verts[:2]]
|
||||||
v1 = verts[1]
|
|
||||||
p0 = location_3d_to_region_2d(region, region3d, v0)
|
|
||||||
p1 = location_3d_to_region_2d(region, region3d, v1)
|
|
||||||
dir = p1 - p0
|
dir = p1 - p0
|
||||||
if dir.length < 1:
|
if dir.length < 1:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if dir.x > 0:
|
||||||
|
box_alignment = "bottom-left"
|
||||||
|
else:
|
||||||
|
box_alignment = 'bottom-right'
|
||||||
|
dir *= -1
|
||||||
|
|
||||||
z = verts[-1].z / unit_scale
|
z = verts[-1].z / unit_scale
|
||||||
z = ifcopenshell.util.geolocation.auto_z2e(tool.Ifc.get(), z)
|
z = ifcopenshell.util.geolocation.auto_z2e(tool.Ifc.get(), z)
|
||||||
z *= unit_scale
|
z *= unit_scale
|
||||||
text = "RL " + self.format_value(context, z)
|
text = "RL " + self.format_value(context, z)
|
||||||
self.draw_label(context, text, p0, dir, gap=8, center=False)
|
self.draw_label(context, text, p0, dir, gap=8, center=False, box_alignment=box_alignment)
|
||||||
|
|
||||||
|
|
||||||
class SectionLevelDecorator(LevelDecorator):
|
class SectionLevelDecorator(LevelDecorator):
|
||||||
|
|||||||
Reference in New Issue
Block a user