diff --git a/Source/PaletteWindow.cs b/Source/PaletteWindow.cs index 36ef3e6..5fc6f06 100644 --- a/Source/PaletteWindow.cs +++ b/Source/PaletteWindow.cs @@ -133,10 +133,11 @@ public void HandleShortcuts() { // this is injected to run right before the vanilla LowPriorityShortcuts. // if nothing selected and right clicked on colony view. - if ( Find.Selector.NumSelected == 0 && !WorldRendererUtility.WorldRenderedNow - && ( CommandPalette.Settings.KeyBinding?.JustPressed ?? false ) ) + if ( ( CommandPalette.Settings.OpenWithSelection || Find.Selector.NumSelected == 0 ) + && !WorldRendererUtility.WorldRenderedNow + && ( CommandPalette.Settings.KeyBinding?.JustPressed ?? false ) ) { - Event.current.Use(); + Event.current.Use(); position = UI.MousePositionOnUIInverted - new Vector2( GIZMO_SIZE / 2f, SEARCH_HEIGHT ); active = true; diff --git a/Source/Settings.cs b/Source/Settings.cs index 4eb1dfe..34c47c7 100644 --- a/Source/Settings.cs +++ b/Source/Settings.cs @@ -9,6 +9,7 @@ public class Settings : ModSettings public float PaletteScale = 1f; public int MaxRecentDesignators = 10; public bool OpenArchitect = true; + public bool OpenWithSelection = false; public int NumRows = 2; public int NumCols = 4; private KeyBind _keyBinding; @@ -43,6 +44,7 @@ public void DoWindowContents( Rect canvas ) Widgets.TextFieldNumeric( rect.RightPart( 1 / 3f ), ref NumRows, ref _numRows, 1, 10 ); KeyBinding.Draw( options.GetRect( 30 ) ); + options.CheckboxLabeled("Allow opening when something is selected", ref OpenWithSelection, "By default, the command palette will not open when something is selected. This makes sure that it doesn't conflict with right click menus. Enabling this options overrides that behaviour. \n\nWARNING:\nOnly enable this when you have set a different hotkey!"); rect = options.GetRect(30); Widgets.Label(rect.LeftPart(2 / 3f), "Maximum number of recently used designators shown"); @@ -60,6 +62,7 @@ public override void ExposeData() Scribe_Values.Look( ref NumCols, "numCols", 4 ); Scribe_Values.Look( ref NumRows, "numRows", 2 ); Scribe_Values.Look(ref MaxRecentDesignators, "maxRecentDesignators", 10); + Scribe_Values.Look(ref OpenWithSelection, "openWithSelection" ); Scribe_Deep.Look( ref _keyBinding, "keybinding" ); } }