timheuer / callisto

A control toolkit for Windows 8 XAML applications. Contains some UI controls to make it easier to create Windows UI style apps for the Windows Store in accordance with Windows UI guidelines.
http://timheuer.com/blog/archive/2012/05/31/introducing-callisto-a-xaml-toolkit-for-metro-apps.aspx
Other
338 stars 108 forks source link

Tilt effect needs to reset #20

Closed timheuer closed 12 years ago

timheuer commented 12 years ago

The animation should reset every time you press on it so it appears responsive. Now it just stays in the same state.

dotMorten commented 12 years ago

Could you explain in a little more detail what you mean by this?

timheuer commented 12 years ago

Actually I can't recall now...a user reported it...

pbauwens commented 12 years ago

The tilt effect is not reset when pushing the control on which the effect is applied and then swiping your finger e.g. left or right. I have this situation on the main screen of my app which basically contains a couple of 'tiles' with the tilt effect applied on them. The main screen can be swiped left and right. When swiping left or right the tilt effect starts correctly on the tile being hit but when you lift your finger after the swipe, the effect stays applied and is not reset.

The reason for this is that the current code only takes into account a regular push and hence only resets the tilt effect in the TiltEffectPointerReleased method:

    /// <summary>
    /// Event handler for ManipulationCompleted.
    /// </summary>
    /// <param name="sender">sender of the event - this will be the tilting 
    /// object (eg a button).</param>
    /// <param name="e">Event arguments.</param>
    private static void TiltEffectPointerReleased(object sender, PointerRoutedEventArgs e)
    {
        EndTiltEffect(_currentTiltElement);
    }

By adding the following code pushing and 'leaving' the pushed control also ends the tilt effect:

    /// <summary>
    /// Event handler for PointerCaptureLost
    /// </summary>
    /// <param name="sender">sender of the event - this will be the tilting 
    /// object (eg a button).</param>
    /// <param name="e">Event arguments.</param>
    private static void TiltEffectPointerCaptureLost(object sender, PointerRoutedEventArgs e)
    {
        EndTiltEffect(_currentTiltElement);
    }
dotMorten commented 12 years ago

This fix looks good to me. I'll make a pull request...