Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-24317

Android: Extend Ti.UI.View "swipe" gesture properties using ScaleGestureDetector

    Details

    • Story Points:
      8
    • Sprint:
      2018 Sprint 22

      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

        Attachments

          Activity

            People

            • Assignee:
              hknoechel Hans Knöchel
              Reporter:
              hazemkhaled Hazem Khaled
              Tester:
              Samir Mohammed
            • Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Source Code