Пример #1
0
        private void canvas1_KeyUp(object sender, KeyEventArgs e)
        {
            // route event to current tool
            TEKeyArgs ee = e.ToTEKeyArgs();
            TheModel.CurrentTool.KeyUp(ee);
            e.Handled = ee.Handled;

            // turn on raster on Alt released
            Rasterizer.View.OverrideWithZeroGridWidth = Keyboard.Modifiers.HasFlag(ModifierKeys.Alt) && !Keyboard.Modifiers.HasFlag(ModifierKeys.Shift);
            Rasterizer.View.OverrideWithHalfGridWidth = Keyboard.Modifiers.HasFlag(ModifierKeys.Alt) && Keyboard.Modifiers.HasFlag(ModifierKeys.Shift);

            if (e.Key == Key.LeftAlt || e.Key == Key.RightAlt)
                e.Handled = true;
        }
Пример #2
0
        private void canvas1_KeyDown(object sender, KeyEventArgs e)
        {
            // route event to current tool
            TEKeyArgs ee = e.ToTEKeyArgs();
            TheModel.CurrentTool.KeyDown(ee);
            e.Handled = ee.Handled;

            // turn off raster on Alt
            Rasterizer.View.OverrideWithZeroGridWidth = Keyboard.Modifiers.HasFlag(ModifierKeys.Alt) && !Keyboard.Modifiers.HasFlag(ModifierKeys.Shift);
            Rasterizer.View.OverrideWithHalfGridWidth = Keyboard.Modifiers.HasFlag(ModifierKeys.Alt) && Keyboard.Modifiers.HasFlag(ModifierKeys.Shift);

            if (e.Key == Key.LeftAlt || e.Key == Key.RightAlt)
                e.Handled = true;

            if (!e.Handled)
            {
                // escape cancels current operation
                if (e.Key == Key.Escape)
                    TheModel.ActivateDefaultTool();

            }

        }