
    h
                         S SK JrJr  S SKJrJrJr  S SKJrJ	r	  S SK
Jr  S SKJr  / SQrS\S\S	\4S
 jrS rS\S\\   4S jrSS\S\\   S\4S jjrSS\S\4S jjrS\S\S\4S jrg)    )Iterablecast)UVecVec2BoundingBox2d)Layout
Paperspace)	DXFEntity)bbox)centerobjectsextentswindowlayoutpointsizec                 N   U R                   nU(       a  U R                  (       a0  [        [        U5      5      nUR	                  U[        U5      5        gU R
                  (       a5  [        [        U 5      nUR                  [        U5      [        U5      5        g[        S5      eg)zResets the active viewport center of `layout` to the given `point`,
argument `size` defines the width and height of the viewport.
Replaces the current viewport configuration by a single window
configuration.

zunsupported layout typeN)
docis_modelspaceguess_heightr   set_modelspace_vportis_any_paperspacer   r	   reset_main_viewport	TypeError)r   r   r   r   heightpsps         </var/www/html/env/lib/python3.13/site-packages/ezdxf/zoom.pyr   r      sy     **C
!$t*-F$$VT%[9%%z6*C##DKd<566     c                 P    U R                   nU R                  n[        US-  U5      $ )Ng       @)xymax)r   widthr   s      r   r   r       s%    FFEVVFus{F##r   entitiesc                   ^ [        U [        5      (       a  U R                  5       mTb  U4S jU 5       n[        R                  " USS9nUR
                  (       a$  [        XR                  UR                  U-  5        g g )Nc              3   4   >#    U  H  oTLd  M	  Uv   M     g 7fN ).0emain_viewports     r   	<genexpr>#zoom_to_entities.<locals>.<genexpr>+   s     F8a/E8s   	T)fast)
isinstancer	   r+   r   r   has_datar   r   )r   r$   factorr   r+   s       @r   zoom_to_entitiesr2   '   sc    &*%%,,.$F8FHll8$/Gv~~w||f'<= r   r1   c                 N   ^ U R                   mU4S jU 5       n[        XU5        g)a  Resets the active viewport limits of `layout` to the extents of the
given `entities`. Only entities in the given `layout` are taken into
account. The argument `factor` scales the viewport limits.
Replaces the current viewport configuration by a single window
configuration.

c              3   ^   >#    U  H"  oR                   R                  T:X  d  M  Uv   M$     g 7fr'   )dxfowner)r)   r*   r6   s     r   r,   objects.<locals>.<genexpr>:   s      ;(QeekkU&:qq(s   -	-N)
layout_keyr2   )r   r$   r1   contentr6   s       @r   r   r   1   s$     E;(;GVf-r   c                     [        X U5        g)zResets the active viewport limits of `layout` to the extents of all
entities in this `layout`. The argument `factor` scales the viewport limits.
Replaces the current viewport configuration by a single window
configuration.

N)r2   )r   r1   s     r   r   r   >   s     VV,r   p1p2c                 \    [        X/5      n[        XR                  UR                  5        g)zResets the active viewport limits of `layout` to the lower left corner
`p1` and the upper right corner `p2`.
Replaces the current viewport configuration by a single window
configuration.

N)r   r   r   )r   r;   r<   r   s       r   r   r   H   s"     RH%G
6>>7<<0r   N)   )typingr   r   
ezdxf.mathr   r   r   ezdxf.layoutsr   r	   ezdxf.entitiesr
   ezdxfr   __all__r   r   r2   floatr   r   r   r(   r   r   <module>rF      s    " 0 0 , $ 
476 7$ 7d 7&$>V >x	/B >
.F 
.hy&9 
.5 
.-F -E -16 1t 1 1r   