~unity-team/unity8/slim-greeter

« back to all changes in this revision

Viewing changes to qml/Greeter/Greeter.qml

  • Committer: Michael Terry
  • Date: 2015-02-12 14:23:36 UTC
  • Revision ID: michael.terry@canonical.com-20150212142336-yzihlw4n3t9s7x4z
Animate letting go of the coverPage

Show diffs side-by-side

added added

removed removed

Lines of Context:
110
110
        property int delayMinutes
111
111
        property bool waiting
112
112
 
113
 
        // We define a proxy and "is valid" property for launcherOffset because of
114
 
        // a quirk in Qml.  We only want this animation to fire if we are reset
115
 
        // back to zero (on a release of the drag).  But by defining a Behavior,
116
 
        // we delay the property from reaching zero until it's too late.  So we set
117
 
        // a proxy bound to launcherOffset, which lets us see the target value of
118
 
        // zero as we also slowly adjust the proxy down to zero.  But Qml will send
119
 
        // change notifications in declaration order.  So unless we define the
120
 
        // proxy first, we need a little "is valid" property defined above the
121
 
        // proxy, so we know when to enable the proxy behavior.  Phew!
122
 
        readonly property bool launcherOffsetValid: launcherOffset > 0
123
 
        property real launcherOffsetProxy: shown ? launcherOffset : 0
 
113
        // We want 'launcherOffset' to animate down to zero.  But not to animate
 
114
        // while being dragged.  So ideally we change this only when the user
 
115
        // lets go and launcherOffset drops to zero.  But we need to wait for
 
116
        // the behavior to be enabled first.  So we cache the last known good
 
117
        // launcherOffset value to cover us during that brief gap between
 
118
        // release and the behavior turning on.
 
119
        property real lastKnownPositiveOffset // set in a launcherOffsetChanged below
 
120
        property real launcherOffsetProxy: (shown && !launcherOffsetProxyBehavior.enabled) ? lastKnownPositiveOffset : 0
124
121
        Behavior on launcherOffsetProxy {
125
 
            enabled: !d.launcherOffsetValid
126
 
            StandardAnimation {}
 
122
            id: launcherOffsetProxyBehavior
 
123
            enabled: launcherOffset === 0
 
124
            UbuntuNumberAnimation {}
127
125
        }
128
126
 
129
127
        function selectUser(uid, reset) {
156
154
        }
157
155
    }
158
156
 
 
157
    onLauncherOffsetChanged: {
 
158
        if (launcherOffset > 0) {
 
159
            d.lastKnownPositiveOffset = launcherOffset;
 
160
        }
 
161
    }
 
162
 
159
163
    onForcedUnlockChanged: {
160
164
        if (forcedUnlock && shown) {
161
165
            // pretend we were just authenticated