Beispiel #1
0
        void _gesturesinterpreter_Scale(object sender, GestureScaleEventArgs e)
        {
            //_transformhelper.Scale *= (e.ScaleFactor);
            //this.Opacity = (_transformhelper.Scale <= 1 ? _transformhelper.Scale : 1);

            if (_currentcanvas == null)
            {
                IEnumerable<UIElement> hitresults = VisualTreeHelper.FindElementsInHostCoordinates(_gesturesinterpreter.Centroid, this);
                foreach (UIElement el in hitresults)
                {
                    if (el is MIRIA.UIKit.TCanvas)
                    {
                        _currentcanvas = (el as MIRIA.UIKit.TCanvas);
                        _currentcanvas.SetValue(TCanvas.ZIndexProperty, 255);
                        break;
                    }
                }
            }

            if (_currentcanvas != null && _currentcanvas.TransformHelper.Scale != 1.3 && !_openeventfired)
            {
                _currentcanvas.TransformHelper.Scale *= e.ScaleFactor;
                if (_currentcanvas.TransformHelper.Scale < 1.0)
                    _currentcanvas.TransformHelper.Scale = 1.0;
                else if (_currentcanvas.TransformHelper.Scale > 1.3)
                {
                    _currentcanvas.TransformHelper.Scale = 1.3;
                }
                if (_currentcanvas.TransformHelper.Scale == 1.3)
                {
                    _openeventfired = true;
                    if (Open != null) Open(_currentcanvas);
                }
            }
        }
Beispiel #2
0
        void _backgroundcanvas_FingerRemove(object sender, FingerTouchEventArgs e)
        {
            _dragenable = false;
            _openeventfired = false;

            _gesturesinterpreter.FingerRemove(e.Finger.Identifier);

            if (_currentcanvas != null)
            {
                _currentcanvas.SetValue(TCanvas.ZIndexProperty, 1);
                _currentcanvas.TransformHelper.Delay = 0.5;
                _currentcanvas.TransformHelper.Scale = 1.0;
                _currentcanvas.TransformHelper.Delay = 0.0;
            }
            _currentcanvas = null;

            if (e.Finger.Identifier != _mytouchid) return;
            _mytouchid = "";

            _dragenable = false;
        }