Feb 3, 2015 at 11:54 AM
Edited Feb 3, 2015 at 11:55 AM
Hi, may be a long shot but I am not sure where else to post. Basically, I am trying to implement the classic reactive drag and drop example using touch input. The challenge is that there can be multiple touches, so it is necessary to filter the streams
by ids. This is the code I have so far.
touch_begin = rx.subjects.Subject()
touch_move = rx.subjects.Subject()
touch_end = rx.subjects.Subject()
moves = touch_move.filter(lambda y: x.session_id == y.session_id)
ends = touch_end.filter(lambda y: x.session_id == y.session_id)
touch_swipe_exclusive = touch_swipes().exclusive()
touch_drag = touch_swipe_exclusive.skip(1).zip(touch_swipe_exclusive, lambda x, y: np.asarray([WIDTH, HEIGHT]) * (np.asarray(x.position) - np.asarray(y.position)))
It works ok so far, with one major gripe: the "touch_swipe_exclusive" ends up as an infinite observable and - as a result - so is touch_drag. Therefore, if there are multiple successive swipes, it still results in one drag, with the image skipping
in between. Is there any way to make this work?