Beispiel #1
0
        private void Delete_Execute(object sender, ExecutedRoutedEventArgs e)
        {
            var items = GroupSelector.GetSelectedItems()
                        .ToArray();

            if (items.Length > 0)
            {
                foreach (var item in items)
                {
                    IRenderer targetRenderer = null;

                    if (item is IRenderer renderer)
                    {
                        targetRenderer = renderer;
                    }

                    if (item is ComponentElement element)
                    {
                        targetRenderer = item.GetRenderer();
                    }

                    if (targetRenderer != null)
                    {
                        DeleteLayer(targetRenderer);
                    }
                }

                GroupSelector.UnselectAll();
            }
        }
Beispiel #2
0
        protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
        {
            base.OnMouseLeftButtonDown(e);

            GroupSelector.UnselectAll();

            if (this.Storyboard != null)
            {
                Keyboard.Focus(this.Storyboard);
            }
        }
Beispiel #3
0
        private void ESC_Execute(object sender, ExecutedRoutedEventArgs e)
        {
            // Component Box
            if (IsComponentBoxOpen)
            {
                CloseComponentBox();
                return;
            }

            // Selected Group
            if (GroupSelector.GetSelectedItemCount() > 1)
            {
                GroupSelector.UnselectAll();
                return;
            }

            // Selected Item
            var layer = GetSelectedLayer();

            if (layer == null)
            {
                GroupSelector.UnselectAll();
                return;
            }

            var prevLayer = layer.AdornedElement
                            .FindVisualParents <FrameworkElement>()
                            .Select(element => (StoryboardLayer)element.GetRenderer())
                            .Skip(1)
                            .FirstOrDefault(adorner => adorner != null && adorner is SelectionLayer);

            if (prevLayer != null)
            {
                GroupSelector.Select(prevLayer, true);
            }
            else
            {
                GroupSelector.UnselectAll();
            }
        }