W3C home > Mailing lists > Public > public-pointer-events@w3.org > April to June 2017

Re: [pointerevents] Add OS image dragging to non-normative reasons for pointercancel

From: Brenton Simpson via GitHub <sysbot+gh@w3.org>
Date: Wed, 10 May 2017 19:47:17 +0000
To: public-pointer-events@w3.org
Message-ID: <issue_comment.created-300592631-1494445636-sysbot+gh@w3.org>
The scenario I have in mind is draggable on-screen elements.  It ought to be reasonably simple to build basic drag and drop with `pointer{down, move, up, cancel}`.  Inside `down`, I can register a listener for `move`.  I can remove that listener on `up` or `cancel`.

If the [Observables proposal](https://github.com/tc39/proposal-observable/) lands, it would be effectively this:

```javascript
// (presuming single pointer for brevity)
const drag$ = down$.flatMap(move$.takeUntil(upOrCancel$).scan(distanceFromLastEvent));
```

An author ought to be able to call `dragStartEvent.preventDefault()` to prevent that drag stream from being interrupted by a `pointercancel`.  Otherwise, if the browser has taken control of the pointer stream, it should dispatch `pointercancel`.

-- 
GitHub Notification of comment by appsforartists
Please view or discuss this issue at https://github.com/w3c/pointerevents/issues/205#issuecomment-300592631 using your GitHub account
Received on Wednesday, 10 May 2017 19:47:26 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 10 May 2017 19:47:26 UTC