eclipsesource / eclipsesource/tabris-js
Support dragging widgets in the scrolling direction of a ScrollView
- Dominant language
- JavaScript
- Stars
- 1.4k
- Forks
- 171
- PR merge metrics
- No merged PRs in 30d
Description
### Problem description
- Actual Behavior: currently it is not possible to drag widgets (using the `touchMove` event) in the scrolling direction of a `ScrollView`. In this case the `ScrollView` starts scrolling and `touchMove` events stop firing.
- Expected Behavior: there should be a way to lock the scrolling of the `ScrollView` to accommodate this use case.
### Environment
- Tabris.js version: 2.0.0-nightly
### Code snippet
```javascript
const {Composite, ScrollView, TextView, ui} = require('tabris');
let prevTouch;
let scrollView = new ScrollView({left: 0, top: 0, right: 0, bottom: 0})
.appendTo(ui.contentView);
for (let i = 0; i <= 100; i++) {
new TextView({
top: 'prev()', centerX: 0, height: 72,
text: i
}).appendTo(scrollView);
}
new Composite({left: 0, top: 0, width: 100, height: 100, background: 'red'})
.appendTo(scrollView)
.on('touchStart', ({touches: [touch]}) => prevTouch = touch)
.on('touchMove', ({target, touches: [touch]}) => {
target.transform = {
translationX: touch.absoluteX - prevTouch.absoluteX + target.transform.translationX,
translationY: touch.absoluteY - prevTouch.absoluteY + target.transform.translationY
};
prevTouch = touch;
})
.on('touchEnd', () => prevTouch = null);
```
Contributor guide
Assessment
This issue has not been assessed yet.