mirror of
https://github.com/osukey/osukey.git
synced 2025-05-22 05:57:35 +09:00
Change placeComponent
to only add to selection, not clear an existing selection
This commit is contained in:
parent
43d33d45ca
commit
af062e7a68
@ -318,7 +318,14 @@ namespace osu.Game.Overlays.SkinEditor
|
|||||||
|
|
||||||
componentsSidebar.Child = new SkinComponentToolbox(getFirstTarget() as CompositeDrawable)
|
componentsSidebar.Child = new SkinComponentToolbox(getFirstTarget() as CompositeDrawable)
|
||||||
{
|
{
|
||||||
RequestPlacement = placeComponent
|
RequestPlacement = type =>
|
||||||
|
{
|
||||||
|
if (!(Activator.CreateInstance(type) is ISerialisableDrawable component))
|
||||||
|
throw new InvalidOperationException($"Attempted to instantiate a component for placement which was not an {typeof(ISerialisableDrawable)}.");
|
||||||
|
|
||||||
|
SelectedComponents.Clear();
|
||||||
|
placeComponent(component);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -345,16 +352,8 @@ namespace osu.Game.Overlays.SkinEditor
|
|||||||
hasBegunMutating = true;
|
hasBegunMutating = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void placeComponent(Type type)
|
|
||||||
{
|
|
||||||
if (!(Activator.CreateInstance(type) is ISerialisableDrawable component))
|
|
||||||
throw new InvalidOperationException($"Attempted to instantiate a component for placement which was not an {typeof(ISerialisableDrawable)}.");
|
|
||||||
|
|
||||||
placeComponent(component);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attempt to place a given component in the current target.
|
/// Attempt to place a given component in the current target. If successful, the new component will be added to <see cref="SelectedComponents"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="component">The component to be placed.</param>
|
/// <param name="component">The component to be placed.</param>
|
||||||
/// <param name="applyDefaults">Whether to apply default anchor / origin / position values.</param>
|
/// <param name="applyDefaults">Whether to apply default anchor / origin / position values.</param>
|
||||||
@ -386,7 +385,6 @@ namespace osu.Game.Overlays.SkinEditor
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectedComponents.Clear();
|
|
||||||
SelectedComponents.Add(component);
|
SelectedComponents.Add(component);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -458,10 +456,7 @@ namespace osu.Game.Overlays.SkinEditor
|
|||||||
SelectedComponents.Clear();
|
SelectedComponents.Clear();
|
||||||
|
|
||||||
foreach (var i in instances)
|
foreach (var i in instances)
|
||||||
{
|
placeComponent(i, false);
|
||||||
if (placeComponent(i, false))
|
|
||||||
SelectedComponents.Add(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
changeHandler?.EndChange();
|
changeHandler?.EndChange();
|
||||||
}
|
}
|
||||||
@ -549,6 +544,7 @@ namespace osu.Game.Overlays.SkinEditor
|
|||||||
Position = skinnableTarget.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position),
|
Position = skinnableTarget.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
SelectedComponents.Clear();
|
||||||
placeComponent(sprite, false);
|
placeComponent(sprite, false);
|
||||||
|
|
||||||
SkinSelectionHandler.ApplyClosestAnchor(sprite);
|
SkinSelectionHandler.ApplyClosestAnchor(sprite);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user