Esempio n. 1
0
        public RippleEffect()
        {
            AddHandler(PointerReleasedEvent, (s, e) => {
                if (last != null)
                {
                    pointers--;

                    // This way to handle pointer released is pretty tricky
                    // could have more better way to improve
                    OnReleaseHandler(last, e);
                    last = null;
                }
            });
            AddHandler(PointerPressedEvent, (s, e) => {
                if (pointers == 0)
                {
                    // Only first pointer can arrive a ripple
                    pointers++;
                    var r = CreateRipple();
                    last  = r;
                    r.SetupInitialValues(e, this);

                    // Attach ripple instance to canvas
                    PART_RippleCanvasRoot.Children.Add(r);
                    r.RunFirstStep(e, this);
                }
            });
        }
        private void PointerReleasedHandler(object sender, PointerReleasedEventArgs e)
        {
            if (last != null)
            {
                pointers--;

                // This way to handle pointer released is pretty tricky
                // could have more better way to improve
                OnReleaseHandler(last, e);
                last = null;
            }
        }
        private void PointerPressedHandler(object sender, PointerPressedEventArgs e)
        {
            if (pointers == 0)
            {
                // Only first pointer can arrive a ripple
                pointers++;
                var r = CreateRipple();
                last = r;
                r.SetupInitialValues(e, this);

                // Attach ripple instance to canvas
                PART_RippleCanvasRoot.Children.Add(r);
                r.RunFirstStep(e, this);
            }
        }