[TIMOB-24317] Android: Extend Ti.UI.View "swipe" gesture properties using ScaleGestureDetector
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-10-22T19:06:34.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 7.5.0 |
Components | Android |
Labels | community, event, notable, swipe |
Reporter | Hazem Khaled |
Assignee | Hans Knöchel |
Created | 2017-01-17T12:04:44.000+0000 |
Updated | 2018-10-22T19:07:07.000+0000 |
Description
Extend more properties from ScaleGestureDetector to TiView pinch event
*ref:*
https://developer.android.com/reference/android/view/ScaleGestureDetector.html
*New properties:*
* getCurrentSpan, getCurrentSpanX, getCurrentSpanY
* getEventTime, getTimeDelta
* getFocusX, getFocusY
* getPreviousSpan, getPreviousSpanX, getPreviousSpanY
* isInProgress _always true, maybe bug_
*Example:*
var win = Ti.UI.createWindow(),
pinchView = Ti.UI.createView({
backgroundColor: 'silver'
}),
pointView = Ti.UI.createView({
backgroundColor: 'red',
width: 40,
height: 40,
touchEnabled: false
});
pinchView.add(pointView);
win.add(pinchView);
pinchView.addEventListener('pinch', function(e) {
_.each(e, function(v, k) {
if (k !== 'source') {
console.log(k, v);
}
});
pointView.applyProperties({
center: {
x: e.focusX / Ti.Platform.displayCaps.dpi * 160,
y: e.focusY / Ti.Platform.displayCaps.dpi * 160
}
});
});
win.open();
Test: touch with 2 fingers, start pinch while you moving your fingers
Expected: the red point keep in the center between your fingers
pr: https://github.com/appcelerator/titanium_mobile/pull/8757
Can be scheduled for 6.2.0.
Hope we can put it into 6.1.0?
Nope, the 6.1.0 release is already full, we need to focus on the open tickets right now.
Using SDK Version
7.5.0.v20181010051919
I get the following error when trying to "touch with 2 fingers, start pinch while you moving your fingers".*Test Environment*
This works fine on Alloy Applications just not Titanium.
[~smohammed] The sample above won't work in straight Titanium because the
_
variable would need to be defined (it's exposed in Alloy as a global from a packaged library, underscore). That loop would need to be done in straight up JS, something like:So anyways, I think if it works in Alloy then you did verify the fix.