|
|
@@ -17,11 +17,12 @@ namespace PixiEditor.ViewModels.Tools.Tools;
|
|
|
internal class MagicWandToolViewModel : ToolViewModel, IMagicWandToolHandler
|
|
|
{
|
|
|
public override LocalizedString Tooltip => new LocalizedString("MAGIC_WAND_TOOL_TOOLTIP", Shortcut);
|
|
|
-
|
|
|
+ private string defaultActionDisplay = "MAGIC_WAND_TOOL_ACTION_DISPLAY_DEFAULT";
|
|
|
public override string ToolNameLocalizationKey => "MAGIC_WAND_TOOL";
|
|
|
public override BrushShape FinalBrushShape => BrushShape.Pixel;
|
|
|
- public override Type[]? SupportedLayerTypes { get; } = { typeof(IRasterLayerHandler) };
|
|
|
-
|
|
|
+ public override Type[]? SupportedLayerTypes { get; } = { typeof(IRasterLayerHandler) };
|
|
|
+ private SelectionMode KeyModifierselectionMode = SelectionMode.New;
|
|
|
+ public SelectionMode ResultingSelectionMode => KeyModifierselectionMode != SelectionMode.New ? KeyModifierselectionMode : SelectMode;
|
|
|
[Settings.Enum("MODE_LABEL")]
|
|
|
public SelectionMode SelectMode => GetValue<SelectionMode>();
|
|
|
|
|
|
@@ -45,4 +46,23 @@ internal class MagicWandToolViewModel : ToolViewModel, IMagicWandToolHandler
|
|
|
{
|
|
|
ViewModelMain.Current?.DocumentManagerSubViewModel.ActiveDocument?.Tools.UseMagicWandTool();
|
|
|
}
|
|
|
+
|
|
|
+ public override void KeyChanged(bool ctrlIsDown, bool shiftIsDown, bool altIsDown, Key argsKey)
|
|
|
+ {
|
|
|
+ if (shiftIsDown)
|
|
|
+ {
|
|
|
+ ActionDisplay = new LocalizedString("MAGIC_WAND_TOOL_ACTION_DISPLAY_SHIFT");
|
|
|
+ KeyModifierselectionMode = SelectionMode.Add;
|
|
|
+ }
|
|
|
+ else if (ctrlIsDown)
|
|
|
+ {
|
|
|
+ ActionDisplay = new LocalizedString("MAGIC_WAND_TOOL_ACTION_DISPLAY_CTRL");
|
|
|
+ KeyModifierselectionMode = SelectionMode.Subtract;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ActionDisplay = defaultActionDisplay;
|
|
|
+ KeyModifierselectionMode = SelectionMode.New;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|