// Map drag start event to the relative position of the mouse
// inside of the target when the user begins to drag so we can 
// calculate where to place the target relative to the cursor
// once dropped.
const pickedUp =
	fromComponent(Draggable, ['onDragStart'])
	.map(({event}) => {
		return {
			x: event.clientX - event.target.offsetLeft,
			y: event.clientY - event.target.offsetTop
		};
	});

// Map drop event to the absolute position of the mouse inside 
// of the (non-scrolled) page
const dropped =
	fromComponent(DropZone, ['onDrop'])
	.map(({event}) => {
		const {clientX, clientY} = event;
		return {
			x: clientX,
			y: clientY
		};
	});

// zip the action streams so we emit only once both
// `pickedUp` and `dropped` have new values
export const dragDrop = zip([pickedUp, dropped]);

Example #2
0
logTest2("zip", function(a,b){return K.zip([a,b])});