~sil2100/ubuntu/saucy/ubuntu-ui-toolkit/manual_merge

« back to all changes in this revision

Viewing changes to modules/Ubuntu/Components/Panel.qml

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, tpeeters, Ubuntu daily release
  • Date: 2013-08-19 02:11:54 UTC
  • mfrom: (1.1.40)
  • Revision ID: package-import@ubuntu.com-20130819021154-aqg52xgqvbj1kfmj
Tags: 0.1.46+13.10.20130819-0ubuntu1
[ tpeeters ]
* Add a drag threshold to Panel (and Toolbar) so that unintentional
  movements while clicking are not detected as a drag to open/close
  the panel. (LP: #1179569)

[ Ubuntu daily release ]
* Automatic snapshot from revision 697

Show diffs side-by-side

added added

removed removed

Lines of Context:
273
273
                properties: "position"
274
274
                duration: internal.transitionDuration
275
275
            }
 
276
        },
 
277
        Transition {
 
278
            id: transitionToMoving
 
279
            to: "moving"
 
280
            UbuntuNumberAnimation {
 
281
                target: bar
 
282
                properties: "position"
 
283
                duration: Toolkit.UbuntuAnimation.SnapDuration
 
284
            }
276
285
        }
277
286
    ]
278
287
 
285
294
         */
286
295
        property real transitionDuration: Toolkit.UbuntuAnimation.FastDuration
287
296
 
288
 
 
289
297
        property string previousState: ""
290
298
        property int movingDelta
291
299
 
442
450
            if (panel.state == "") panel.state = "hint";
443
451
        }
444
452
 
 
453
        /*!
 
454
          The minimum amount of movement while pressed before switching to "moving" state.
 
455
          This threshold is needed to avoid detecting unintentional small movements while
 
456
          "clicking" as a drag.
 
457
          */
 
458
        property real dragThreshold: units.gu(1)
 
459
 
445
460
        onPositionChanged: {
446
461
            if (panel.locked) return;
447
 
            if (panel.state == "hint" && mousePosition < initialPosition) {
 
462
            if (panel.state == "hint" && mousePosition < initialPosition - dragThreshold) {
448
463
                panel.state = "moving";
449
464
                pressedItem = null;
450
 
            } else if (panel.state == "spread" && mousePosition > initialPosition) {
 
465
            } else if (panel.state == "spread" && mousePosition > initialPosition + dragThreshold) {
451
466
                panel.state = "moving";
452
467
                pressedItem = null;
453
468
            }
454
469
        }
455
470
 
456
471
        onReleased: {
457
 
            if (panel.locked) return;
458
 
            finishMoving();
 
472
            if (panel.state == "moving" || panel.state == "hint") {
 
473
                finishMoving();
 
474
            }
459
475
        }
460
476
        // Mouse cursor moving out of the window while pressed on desktop
461
477
        onCanceled: {
462
 
            if (panel.locked) return;
463
 
            finishMoving();
 
478
            if (panel.state == "moving" || panel.state == "hint") {
 
479
                finishMoving();
 
480
            }
464
481
        }
465
482
 
466
483
        // FIXME: Make all parameters below themable and resolution-independent.