Fix multiselect refreshing to parent context
This commit is contained in:
@@ -162,7 +162,10 @@ public class MultiSelect
|
||||
if (oldItemContext != null)
|
||||
{
|
||||
MultiSelectItemContext newContext = oldItemContext.Refresh();
|
||||
SelectedItems.Add(newContext, SelectedItems[oldItemContext]);
|
||||
if (newContext != null)
|
||||
{
|
||||
SelectedItems.Add(newContext, SelectedItems[oldItemContext]);
|
||||
}
|
||||
|
||||
SelectedItems.Remove(oldItemContext);
|
||||
oldItemContext.Dispose();
|
||||
@@ -463,7 +466,12 @@ public class MultiSelectItemContext : DragItemContext
|
||||
|
||||
public MultiSelectItemContext Refresh()
|
||||
{
|
||||
return new MultiSelectItemContext(ItemContextAbstractClass, ItemRotation);
|
||||
if (Item == ItemContextAbstractClass.Item)
|
||||
{
|
||||
return new MultiSelectItemContext(ItemContextAbstractClass, ItemRotation);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void UpdateDragContext(DragItemContext itemContext)
|
||||
|
@@ -66,9 +66,7 @@ public class MultiSelectDebug : MonoBehaviour
|
||||
}
|
||||
|
||||
ItemAddress address = itemContext is DragItemContext dragItemContext ? dragItemContext.ItemAddress : itemContext.Item.CurrentAddress;
|
||||
LocationInGrid location = address is GridItemAddress gridAddress ?
|
||||
itemContext is MultiSelectItemContext ? MultiGrid.GetGridLocation(gridAddress) : gridAddress.LocationInGrid :
|
||||
null;
|
||||
LocationInGrid location = address is GridItemAddress gridAddress ? gridAddress.LocationInGrid : null;
|
||||
string locationString = location != null ? $"({location.x}, {location.y})" : "(slot)";
|
||||
|
||||
return $"x{itemContext.Item.StackObjectsCount} {address.Container.ID} {locationString} {itemContext.Item.Name.Localized()}";
|
||||
|
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net471</TargetFramework>
|
||||
<AssemblyName>Tyfon.UIFixes</AssemblyName>
|
||||
<Description>SPT UI Fixes</Description>
|
||||
<Version>2.2.0</Version>
|
||||
<Version>2.2.1</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "uifixes",
|
||||
"version": "2.2.0",
|
||||
"version": "2.2.1",
|
||||
"main": "src/mod.js",
|
||||
"license": "MIT",
|
||||
"author": "Tyfon",
|
||||
|
Reference in New Issue
Block a user