コード例 #1
0
        void mainPointerManager_Removed(object sender, PointerManagerEvent e)
        {
            if (!(DataContext as AttributeTransformationViewModel).IsDraggable)
            {
                return;
            }
            if (_shadow == null &&
                _manipulationStartTime + TimeSpan.FromSeconds(0.5).Ticks > DateTime.Now.Ticks)
            {
                if ((DataContext as AttributeTransformationViewModel).IsMenuEnabled && InputFieldViewModelTapped != null)
                {
                    Debug.WriteLine("--TAPP");
                    InputFieldViewModelTapped(this, new EventArgs());
                }
            }

            if (_shadow != null)
            {
                InkableScene inkableScene = MainViewController.Instance.InkableScene;

                Rct bounds = _shadow.GetBounds(inkableScene);
                (DataContext as AttributeTransformationViewModel).FireDropped(bounds,
                                                                              new AttributeTransformationModel((DataContext as AttributeTransformationViewModel).AttributeTransformationModel.AttributeModel)
                {
                    AggregateFunction = (DataContext as AttributeTransformationViewModel).AttributeTransformationModel.AggregateFunction
                });

                inkableScene.Remove(_shadow);
                _shadow = null;
            }

            _manipulationStartTime = 0;
        }
コード例 #2
0
        void mainPointerManager_Removed(object sender, PointerManagerEvent e)
        {
            if (_shadow == null &&
                _manipulationStartTime + TimeSpan.FromSeconds(0.5).Ticks > DateTime.Now.Ticks)
            {
                // tapp
            }

            if (_shadow != null)
            {
                InkableScene inkableScene = MainViewController.Instance.InkableScene;

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

                inkableScene.Remove(_shadow);
                _shadow = null;
            }

            _manipulationStartTime = 0;
        }
        void mainPointerManager_Removed(object sender, PointerManagerEvent e)
        {
            var model = ((AttributeTransformationMenuItemViewModel)((MenuItemViewModel)DataContext).MenuItemComponentViewModel);

            if (!model.CanDrag)
            {
                return;
            }
            if (_shadow == null &&
                _manipulationStartTime + TimeSpan.FromSeconds(0.5).Ticks > DateTime.Now.Ticks)
            {
                var attrModel =
                    ((AttributeTransformationMenuItemViewModel)
                     ((MenuItemViewModel)DataContext).MenuItemComponentViewModel);
                if (attrModel != null && attrModel.TappedTriggered != null)
                {
                    attrModel.TappedTriggered();
                }
            }

            if (_shadow != null)
            {
                InkableScene inkableScene = MainViewController.Instance.InkableScene;

                Rct bounds = _shadow.GetBounds(inkableScene);

                model.AttributeTransformationViewModel.FireDropped(bounds,
                                                                   new AttributeTransformationModel(model.AttributeTransformationViewModel.AttributeTransformationModel.AttributeModel)
                {
                    AggregateFunction = model.AttributeTransformationViewModel.AttributeTransformationModel.AggregateFunction
                });

                inkableScene.Remove(_shadow);
                _shadow = null;
            }

            _manipulationStartTime = 0;
        }
        void mainPointerManager_Removed(object sender, PointerManagerEvent e)
        {
            if (_shadow != null)
            {
                InkableScene inkableScene = MainViewController.Instance.InkableScene;

                Rct bounds = _shadow.GetBounds(inkableScene);

                /*model.AttributeTransformationViewModel.FireDropped(bounds,
                 *  new AttributeTransformationModel(model.AttributeTransformationViewModel.AttributeTransformationModel.AttributeModel)
                 *  {
                 *      AggregateFunction = model.AttributeTransformationViewModel.AttributeTransformationModel.AggregateFunction
                 *  });
                 */
                inkableScene.Remove(_shadow);
                _shadow = null;

                var model = ((MenuItemViewModel)this.DataContext).MenuItemComponentViewModel as CreateLinkMenuItemViewModel;
                if (model != null)
                {
                    model.FireCreateLinkEvent(bounds);
                }
            }
        }
コード例 #5
0
        private void InkableSceneInkCollectedEvent(object sender, InkCollectedEventArgs e)
        {
            var recognizedGestures = _gesturizer.Recognize(e.InkStroke.Clone());

            foreach (var recognizedGesture in recognizedGestures.ToList())
            {
                if (recognizedGesture is ConnectGesture)
                {
                    var connect = recognizedGesture as ConnectGesture;
                    if (connect.FilterConsumerOperationViewModel == null)
                    {
                        connect.CreateConsumer(e.InkStroke.Clone());
                    }
                    FilterLinkViewController.Instance.CreateFilterLinkViewModel(connect.FilterProviderOperationViewModel, connect.FilterConsumerOperationViewModel);
                }
                else if (recognizedGesture is HitGesture)
                {
                    var hitGesture = recognizedGesture as HitGesture;
                    foreach (var hitScribbable in hitGesture.HitScribbables)
                    {
                        if (hitScribbable is InkStroke)
                        {
                            InkableScene.Remove(hitScribbable as InkStroke);
                        }
                        else if (hitScribbable is OperationContainerView)
                        {
                            RemoveOperationViewModel(hitScribbable as OperationContainerView);
                        }
                        else if (hitScribbable is FilterLinkView)
                        {
                            var models = (hitScribbable as FilterLinkView).GetLinkModelsToRemove(e.InkStroke.Geometry);
                            foreach (var model in models)
                            {
                                FilterLinkViewController.Instance.RemoveFilterLinkViewModel(model);
                            }
                        }
                        else if (hitScribbable is MenuItemView)
                        {
                            var model = (hitScribbable as MenuItemView).DataContext as MenuItemViewModel;
                            model.FireDeleted();
                        }
                    }
                }
            }


            if (!e.InkStroke.IsErase && !recognizedGestures.Any())
            {
                var allScribbables = new List <IScribbable>();
                IScribbleHelpers.GetScribbablesRecursive(allScribbables, InkableScene.Elements.OfType <IScribbable>().ToList());
                var inkStroke     = e.InkStroke.GetResampled(20);
                var inkStrokeLine = inkStroke.GetLineString();

                var consumed = false;
                foreach (var existingScribbable in allScribbables)
                {
                    var geom = existingScribbable.Geometry;
                    if (geom != null)
                    {
                        if (inkStrokeLine.Intersects(geom))
                        {
                            consumed = existingScribbable.Consume(e.InkStroke);
                            if (consumed)
                            {
                                break;
                            }
                        }
                    }
                }
                if (!consumed)
                {
                    InkableScene.Add(e.InkStroke);
                }
            }
        }