def reposition_list(self, a_list, obj):
        """Reposition items in given list.

        Parameters
        ==========
        a_list (List2D instance)
            list whose items are to be repositioned/aligned.
        obj (Object2D instance)
            item of the list used as reference the position
            the list horizontally.
        """
        ### backup the x coordinate of the object center
        centerx = obj.rect.centerx

        ### reference the rect of the list locally
        rect = a_list.rect

        ### align the items in the list relative to one
        ### another (one beside the other)

        rect.snap_rects_ip(
            retrieve_pos_from="topright", assign_pos_to="topleft", offset_pos_by=(5, 0)
        )

        ### set the center y coordinate of the list
        ### to the center y coordinate of the area
        ### to which the list corresponds, with just a
        ### bit of vertical offset

        rect.centery = (
            ## pick the center y of the items area if the
            ## list is the list of items
            self.items_area.centery
            if a_list is self.items
            ## otherwise pick the center y of the pool area
            ## (list refers to the pool of available items)
            else self.available_items_area.centery
        ) + 7  # vertical offset

        ### move the list by the horizontal difference
        ### between the original and current center x
        ### coordinate of the given object

        x_difference = centerx - obj.rect.centerx
        rect.move_ip(x_difference, 0)

        ### perform extra setups to ensure the given object
        ### stay visible (within a pre-defined boundary)

        ## define a rect representing the scrolling
        ## boundaires
        scroll_boundary = self.rect.inflate(-40, 0)

        ## obtain a copy of the object rect, but clamped
        ## to the defined boundary
        clamped_obj = obj.rect.clamp(scroll_boundary)

        ## if the clamped copy ended up in a different
        ## position, move the entire list by that
        ## difference

        if obj.rect.x != clamped_obj.x:

            x_difference = clamped_obj.x - obj.rect.x
            a_list.rect.move_ip(x_difference, 0)
Reposition items in given list.

        Parameters
        ==========
        a_list (List2D instance)
            list whose items are to be repositioned/aligned.
        obj (Object2D instance)
            item of the list used as reference the position
            the list horizontally.
        
nodezator/our3rdlibs/sortingeditor/main.py