mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 11:36:59 +00:00
keep font scaled correctly when changing drawing width and height
This commit is contained in:
@@ -168,15 +168,12 @@ class BaseDecorator:
|
|||||||
def get_camera_width_mm(self):
|
def get_camera_width_mm(self):
|
||||||
# Horrific prototype code to ensure bgl draws at drawing scales
|
# Horrific prototype code to ensure bgl draws at drawing scales
|
||||||
# https://blender.stackexchange.com/questions/16493/is-there-a-way-to-fit-the-viewport-to-the-current-field-of-view
|
# https://blender.stackexchange.com/questions/16493/is-there-a-way-to-fit-the-viewport-to-the-current-field-of-view
|
||||||
def is_landscape(render):
|
|
||||||
return render.resolution_x > render.resolution_y
|
|
||||||
|
|
||||||
camera = bpy.context.scene.camera
|
camera = bpy.context.scene.camera
|
||||||
render = bpy.context.scene.render
|
render = bpy.context.scene.render
|
||||||
if is_landscape(render):
|
camera_width_model = camera.data.ortho_scale
|
||||||
camera_width_model = camera.data.ortho_scale
|
|
||||||
else:
|
|
||||||
camera_width_model = camera.data.ortho_scale / render.resolution_y * render.resolution_x
|
|
||||||
|
|
||||||
scale = tool.Drawing.get_scale_ratio(tool.Drawing.get_diagram_scale(camera)["Scale"])
|
scale = tool.Drawing.get_scale_ratio(tool.Drawing.get_diagram_scale(camera)["Scale"])
|
||||||
camera_width_mm = scale * camera_width_model
|
camera_width_mm = scale * camera_width_model
|
||||||
|
|||||||
Reference in New Issue
Block a user