~nick-dedekind/+junk/unity8.tabs.MainView

« back to all changes in this revision

Viewing changes to Panel/Indicators.qml

  • Committer: Nick Dedekind
  • Date: 2013-07-17 16:22:47 UTC
  • Revision ID: nicholas.dedekind@gmail.com-20130717162247-1atb59wpqb32iri9
Added vertical velocity detector to guard accidental indicator left to right  swipes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
98
98
                            (lockThreshold - hintValue), 0, 1);
99
99
 
100
100
        /*
 
101
          Vertical velocity check. Don't change the indicator if we're moving too quickly.
 
102
        */
 
103
        var verticalVelocity = Math.abs(yVelocityCalculator.calculate());
 
104
        if (verticalVelocity >= 0.3 && indicatorRow.currentItem!=null) {
 
105
            return;
 
106
        }
 
107
 
 
108
        /*
101
109
          Percentage of an indicator icon's width the user's press can stray horizontally from the
102
110
          focused icon before we change focus to another icon. E.g. a value of 0.5 means you must
103
111
          go right a distance of half an icon's width before focus moves to the icon on the right
282
290
            var buffer = dragHandle.dragging ? true : false;
283
291
            indicators.calculateCurrentItem(dragHandle.touchX, buffer);
284
292
        }
 
293
        onTouchSceneYChanged: {
 
294
            yVelocityCalculator.trackedPosition = dragHandle.touchSceneY;
 
295
        }
285
296
    }
286
297
 
287
298
    DragHandle {
325
336
        }
326
337
    }
327
338
 
 
339
    AxisVelocityCalculator {
 
340
        id: yVelocityCalculator
 
341
    }
 
342
 
328
343
    states: [
329
344
        State {
330
345
            name: "initial"