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; }
public void createShadow(Point fromInkableScene) { InkableScene inkableScene = MainViewController.Instance.InkableScene; var model = ((AttributeTransformationMenuItemViewModel)((MenuItemViewModel)DataContext).MenuItemComponentViewModel).AttributeTransformationViewModel; if (inkableScene != null && model != null) { _currentFromInkableScene = fromInkableScene; _shadow = new AttributeFieldView(); _shadow.DataContext = new AttributeTransformationViewModel(null, model.AttributeTransformationModel) { IsNoChrome = false, IsMenuEnabled = true, IsShadow = true }; _shadow.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); double add = model.IsNoChrome ? 30 : 0; //_shadow.Width = this.ActualWidth + add; //_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); model.FireMoved(bounds, model.AttributeTransformationModel); } }