コード例 #1
0
ファイル: dynBench.xaml.cs プロジェクト: pterelaos/dynamo
        private void OnMouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton == MouseButton.Middle)
            {
                isPanning = true;
            }

            if (toolFinder != null)
            {
                //close the tool finder if the user
                //has clicked anywhere else on the workbench
                workBench.Children.Remove(toolFinder);
                toolFinder = null;
            }
        }
コード例 #2
0
ファイル: dynBench.xaml.cs プロジェクト: pterelaos/dynamo
        private void OnPreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {
            //handle key presses for the bench in the bubbling event
            //if no other element has already handled this event it will
            //start at the bench and move up to root, not raising the event
            //on any other elements

            //if the key down is 'b' open the build window
            if (Keyboard.IsKeyDown(Key.LeftCtrl) && Keyboard.IsKeyDown(Key.B))
            {
                //get the mouse position

                toolFinder = new dynToolFinder();
                dynElementSettings.SharedInstance.Workbench.Children.Add(toolFinder);
                toolFinder.ToolFinderFinished += new ToolFinderFinishedHandler(toolFinder_ToolFinderFinished);

                Canvas.SetLeft(toolFinder, 100);
                Canvas.SetTop(toolFinder, 100);
                e.Handled = true;
            }
            //changed the delete key combination so as not to interfere with
            //keyboard events
            if (Keyboard.IsKeyDown(Key.LeftCtrl) && Keyboard.IsKeyDown(Key.Back) ||
                Keyboard.IsKeyDown(Key.LeftCtrl) && Keyboard.IsKeyDown(Key.Delete))
            {
                //don't do this if an input element has focus
                //this keeps us from deleting nodes when the
                //user is deleting text

                for (int i = selectedElements.Count - 1; i >= 0; i--)
                {
                    DeleteElement(selectedElements[i]);
                }
                e.Handled = true;
            }
        }
コード例 #3
0
ファイル: dynBench.xaml.cs プロジェクト: pterelaos/dynamo
 void toolFinder_ToolFinderFinished(object sender, EventArgs e)
 {
     dynElementSettings.SharedInstance.Workbench.Children.Remove(toolFinder);
     toolFinder = null;
 }