コード例 #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 OperationTypeModel).FireMoved(bounds);
                    }
                }

                _mainPointerManagerPreviousPoint = currentPoint;
            }
        }
コード例 #2
0
        public void createShadow(Point fromInkableScene)
        {
            InkableScene inkableScene = MainViewController.Instance.InkableScene;

            if (inkableScene != null && DataContext != null && !((DataContext as OperationTypeModel) is OperationTypeGroupModel))
            {
                _currentFromInkableScene = fromInkableScene;
                _shadow             = new OperationTypeView();
                _shadow.DataContext = new OperationTypeModel()
                {
                    Name     = (DataContext as OperationTypeModel).Name,
                    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 OperationTypeModel).FireMoved(bounds);
            }
        }