Esempio n. 1
0
        void mainPointerManager_Moved(object sender, PointerManagerEvent e)
        {
            if (e.NumActiveContacts == 1)
            {
                GeneralTransform gt           = this.TransformToVisual(MainViewController.Instance.InkableScene);
                Point            currentPoint = gt.TransformPoint(e.CurrentContacts[e.TriggeringPointer.PointerId].Position);

                Vec delta = gt.TransformPoint(e.StartContacts[e.TriggeringPointer.PointerId].Position).GetVec() - currentPoint.GetVec();

                if (delta.Length > 10 && _shadow == null)
                {
                    createShadow(currentPoint);
                }

                if (_shadow != null)
                {
                    InkableScene inkableScene = MainViewController.Instance.InkableScene;
                    _shadow.RenderTransform = new TranslateTransform()
                    {
                        X = currentPoint.X - _shadow.Width / 2.0,
                        Y = currentPoint.Y - _shadow.Height
                    };
                    if (inkableScene != null)
                    {
                        inkableScene.Add(_shadow);

                        Rct bounds = _shadow.GetBounds(inkableScene);
                        (DataContext as InputGroupViewModel).FireMoved(bounds, (DataContext as InputGroupViewModel).AttributeOperationModel);
                    }
                }

                _mainPointerManagerPreviousPoint = currentPoint;
            }
        }
Esempio n. 2
0
        public void createShadow(Point fromInkableScene)
        {
            InkableScene inkableScene = MainViewController.Instance.InkableScene;

            if (inkableScene != null && DataContext != null)
            {
                _currentFromInkableScene = fromInkableScene;
                _shadow             = new AttributeGroupView();
                _shadow.DataContext = new InputGroupViewModel()
                {
                    AttributeOperationModel = (DataContext as InputGroupViewModel).AttributeOperationModel,
                    IsShadow = true
                };


                _shadow.Measure(new Size(double.PositiveInfinity,
                                         double.PositiveInfinity));

                _shadow.Width  = this.ActualWidth;
                _shadow.Height = _shadow.DesiredSize.Height;

                _shadow.RenderTransform = new TranslateTransform()
                {
                    X = fromInkableScene.X - _shadow.Width / 2.0,
                    Y = fromInkableScene.Y - _shadow.Height
                };


                inkableScene.Add(_shadow);
                _shadow.SendToFront();

                Rct bounds = _shadow.GetBounds(inkableScene);
                (DataContext as InputGroupViewModel).FireMoved(bounds, (DataContext as InputGroupViewModel).AttributeOperationModel);
            }
        }