
    Og
                         d dl mZmZ d dlmZmZmZ d dlmZm	Z	 d dl
mZ d dlmZ g dZdeded	efd
Zd Zdedee   fdZddedee   defdZddedefdZdededefdZy)    )Iterablecast)UVecVec2BoundingBox2d)Layout
Paperspace)	DXFEntity)bbox)centerobjectsextentswindowlayoutpointsizec                 0   | j                   }|r| j                  r0t        t        |            }|j	                  |t        |             y| j
                  r5t        t        |       }|j                  t        |      t        |             yt        d      y)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         O/var/www/html/public_html/myphp/venv/lib/python3.12/site-packages/ezdxf/zoom.pyr   r      sy     **C
!$t*-F$$VT%[9%%z6*C##DKd<566     c                 P    | j                   }| j                  }t        |dz  |      S )Ng       @)xymax)r   widthr   s      r   r   r       s%    FFEVVFus{F##r   entitiesc                     t        | t              r| j                         fd|D        }t        j                  |d      }|j
                  r%t        | |j                  |j                  |z         y y )Nc              3   ,   K   | ]  }|us|  y wN ).0emain_viewports     r   	<genexpr>z#zoom_to_entities.<locals>.<genexpr>+   s     Faq/EFs   	T)fast)
isinstancer	   r+   r   r   has_datar   r   )r   r$   factorr   r+   s       @r   zoom_to_entitiesr1   '   sb    &*%,,.$F8FHll8$/Gvw~~w||f'<= r   r0   c                 N    | j                   fd|D        }t        | ||       y)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   V   K   | ]   }|j                   j                  k(  s| " y wr'   )dxfowner)r)   r*   r5   s     r   r,   zobjects.<locals>.<genexpr>:   s      ;QaeekkU&:q;s   ))N)
layout_keyr1   )r   r$   r0   contentr5   s       @r   r   r   1   s&     E;(;GVWf-r   c                     t        | | |       y)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)r1   )r   r0   s     r   r   r   >   s     VVV,r   p1p2c                 `    t        ||g      }t        | |j                  |j                         y)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   r9   r:   r   s       r   r   r   H   s&     RH%G
67>>7<<0r   N)   )typingr   r   
ezdxf.mathr   r   r   ezdxf.layoutsr   r	   ezdxf.entitiesr
   ezdxfr   __all__r   r   r1   floatr   r   r   r(   r   r   <module>rD      s    " 0 0 , $ 
476 7$ 7d 7&$>V >x	/B >
.F 
.hy&9 
.5 
.-F -E -16 1t 1 1r   