コード例 #1
0
 private void KeySelector_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     if (SelectorMode == KeySelectorMode.Done)
     {
         return;
     }
     if (SelectorMode == KeySelectorMode.Start)
     {
         selectedStartFrame = currentFrame;
     }
     else
     {
         selectedEndFrame = currentFrame;
     }
     if (SelectorMode == KeySelectorMode.End)
     {
         SelectorMode = KeySelectorMode.Done;
     }
     else
     {
         SelectorMode = KeySelectorMode.End;
         createCursor(ref cursor);
         KeySelector.Children.Add(cursor);
     }
 }
コード例 #2
0
        private void EndBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (!int.TryParse(EndBox.Text, out selectedEndFrame))
            {
                return;
            }
            bool numChanged = false;

            if (selectedEndFrame > blitz3DAnimation.Frames)
            {
                selectedEndFrame = blitz3DAnimation.Frames;
                numChanged       = true;
            }
            if (selectedEndFrame < selectedStartFrame)
            {
                selectedEndFrame = selectedStartFrame;
                numChanged       = true;
            }
            if (numChanged)
            {
                //EndBox.Text = selectedEndFrame.ToString();
                return;
            }
            if (endCursor == null)
            {
                SelectorMode = KeySelectorMode.End;
                createCursor(ref cursor);
                KeySelector.Children.Add(cursor);
            }
            MoveSelectionCursor(endCursor, selectedEndFrame);
        }
コード例 #3
0
        void Redisplay()
        {
            //reset
            SelectorMode       = KeySelectorMode.Start;
            selectedStartFrame = selectedEndFrame = 0;
            cursorShown        = false;
            endCursor          = startCursor = cursor = null;
            space = null;
            KeySelector.Children.Clear();

            //display sequences
            foreach (var seq in _sequences)
            {
                if (seq.IsRootSeq)
                {
                    continue;
                }
                SolidColorBrush randomColor     = new SolidColorBrush(AppResources.BatchRandomColor(1)[0]);
                Brush           semiTransparent = new SolidColorBrush(randomColor.Color);
                semiTransparent.Opacity = .5;
                Border border = null;
                KeySelector.Children.Add(
                    border = new Border
                {
                    Child = new TextBlock()
                    {
                        HorizontalAlignment = HorizontalAlignment.Center,
                        VerticalAlignment   = VerticalAlignment.Center,
                        Text          = (string.IsNullOrWhiteSpace(seq.Name) ? seq.ID.ToString() : seq.Name + $" ({seq.ID})") + $": {seq.FrameLength} frames",
                        Padding       = new Thickness(5, 3, 5, 3),
                        TextWrapping  = TextWrapping.Wrap,
                        Background    = randomColor,
                        TextAlignment = TextAlignment.Center
                    },
                    Padding         = new Thickness(10),
                    BorderBrush     = randomColor,
                    BorderThickness = new Thickness(2, 0, 2, 0),
                    Background      = semiTransparent,
                    Width           = (seq.FrameLength / (double)blitz3DAnimation.Frames) * KeySelector.ActualWidth,
                    Height          = KeySelector.ActualHeight
                });

                if (border.Width < 60)
                {
                    ((TextBlock)border.Child).Text = seq.ID.ToString();
                    border.Padding = new Thickness(0);
                }
                Canvas.SetLeft(border, (seq.First / (double)blitz3DAnimation.Frames) * KeySelector.ActualWidth);
            }
            DescBlock.Text = $"Sequences: {_sequences.Count()}, Frames: {preview.numPositionKeys()}";
            DataChart.DisplayAnimation(preview);
        }