U
    P’“e5  ã                   @   sT   d Z dZddlmZ ddlmZmZ ddlmZ G dd„ deƒZ	G dd	„ d	eƒZ
d
S )a  
Scatter Layout
===============

.. versionadded:: 1.6.0

This layout behaves just like a
:class:`~kivy.uix.relativelayout.RelativeLayout`.
When a widget is added with position = (0,0) to a :class:`ScatterLayout`,
the child widget will also move when you change the position of the
:class:`ScatterLayout`. The child widget's coordinates remain
(0,0) as they are relative to the parent layout.

However, since :class:`ScatterLayout` is implemented using a
:class:`~kivy.uix.scatter.Scatter`
widget, you can also translate, rotate and scale the layout using touches
or clicks, just like in the case of a normal Scatter widget, and the child
widgets will behave as expected.

In contrast to a Scatter, the Layout favours 'hint' properties, such as
size_hint, size_hint_x, size_hint_y and pos_hint.

.. note::

    The :class:`ScatterLayout` is implemented as a
    :class:`~kivy.uix.floatlayout.FloatLayout`
    inside a :class:`~kivy.uix.scatter.Scatter`.

.. warning::

    Since the actual :class:`ScatterLayout` is a
    :class:`~kivy.uix.scatter.Scatter`, its
    add_widget and remove_widget functions are overridden to add children
    to the embedded :class:`~kivy.uix.floatlayout.FloatLayout` (accessible as
    the `content` property of :class:`~kivy.uix.scatter.Scatter`)
    automatically. So if you want to access the added child elements,
    you need self.content.children instead of self.children.

.. warning::

    The :class:`ScatterLayout` was introduced in 1.7.0 and was called
    :class:`~kivy.uix.relativelayout.RelativeLayout` in prior versions.
    The :class:`~kivy.uix.relativelayout.RelativeLayout` is now an optimized
    implementation that uses only a positional transform to avoid some of the
    heavier calculation involved for :class:`~kivy.uix.scatter.Scatter`.

)ÚScatterLayoutÚScatterPlaneLayouté    )ÚFloatLayout)ÚScatterÚScatterPlane)ÚObjectPropertyc                       sF   e Zd ZdZeƒ Z‡ fdd„Zdd„ Zdd„ Zdd	„ Z	d
d„ Z
‡  ZS )r   zHScatterLayout class, see module documentation for more information.
    c                    sV   t ƒ | _tt| ƒjf |Ž | jj| jkr2| j| j_tt| ƒ | j¡ |  d| j¡ d S )NÚsize)	r   ÚcontentÚsuperr   Ú__init__r   Ú
add_widgetZfbindÚupdate_size)ÚselfÚkw©Ú	__class__© ú:/tmp/pip-unpacked-wheel-xzebddm3/kivy/uix/scatterlayout.pyr   >   s    
zScatterLayout.__init__c                 C   s   || j _d S ©N)r	   r   )r   Úinstancer   r   r   r   r   F   s    zScatterLayout.update_sizec                 O   s   | j j||Ž d S r   )r	   r   ©r   ÚargsÚkwargsr   r   r   r   I   s    zScatterLayout.add_widgetc                 O   s   | j j||Ž d S r   )r	   Úremove_widgetr   r   r   r   r   L   s    zScatterLayout.remove_widgetc                 O   s   | j j||Ž d S r   )r	   Úclear_widgetsr   r   r   r   r   O   s    zScatterLayout.clear_widgets)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r	   r   r   r   r   r   Ú__classcell__r   r   r   r   r   8   s   r   c                   @   s   e Zd ZdZdd„ ZdS )r   zÆScatterPlaneLayout class, see module documentation for more information.

    Similar to ScatterLayout, but based on ScatterPlane - so the input is not
    bounded.

    .. versionadded:: 1.9.0
    c                 C   s   dS )NTr   )r   ÚxÚyr   r   r   Úcollide_point\   s    z ScatterPlaneLayout.collide_pointN)r   r   r   r   r"   r   r   r   r   r   S   s   r   N)r   Ú__all__Zkivy.uix.floatlayoutr   Zkivy.uix.scatterr   r   Zkivy.propertiesr   r   r   r   r   r   r   Ú<module>   s   0