def on_mouse_release(self, x, y, button, modifiers):
        # send release to the previously-pressed element
        if self.mouse_press_element is not None:
            if self.mouse_press_element.isEnabled():
                self.dispatch_event(self.mouse_press_element,
                    'on_mouse_release', x, y, button, modifiers)

        if self.drag_element is not None:
            # the on_drop check will most likely alter the active element
            drop = self.determineHit(x, y, exclude=self.drag_element)

            # see if the element underneath wants the dragged element
            if drop is not None and drop.isEnabled():
                ok = self.dispatch_event(drop, 'on_drop', x, y, button,
                    modifiers, self.drag_element)[1] == EVENT_HANDLED
            else:
                ok = False

            # now tell the dragged element what's going on
            handled = self.dispatch_event(self.drag_element,
                'on_drag_complete', x, y, button, modifiers, ok)[1]

            # clear state - we're done
            self.drag_element = self.mouse_press_element = \
                self.drag_over_element = None
            return handled

        # regular mouse press/release click
        element = self.determineHit(x, y)
        if element is None: return EVENT_UNHANDLED
        if not element.isEnabled():
            return EVENT_UNHANDLED

        # determine multiple clicks
        now = time.time()
        if now - self._last_click < .25:
            self._click_count += 1
        else:
            self._click_count = 1
        self._last_click = now

        if element is self.mouse_press_element:
            return self.dispatch_event(element, 'on_click', x, y, button,
                modifiers, self._click_count)[1]
        return EVENT_UNHANDLED
dataset/ETHPy150Open ardekantur/pyglet/contrib/wydget/wydget/event.py/GUIEventDispatcher.on_mouse_release/original