diff --git a/Glamourer/Api/ApiHelpers.cs b/Glamourer/Api/ApiHelpers.cs index a54a0ec..25af774 100644 --- a/Glamourer/Api/ApiHelpers.cs +++ b/Glamourer/Api/ApiHelpers.cs @@ -1,6 +1,5 @@ using Glamourer.Api.Enums; using Glamourer.Designs; -using Glamourer.GameData; using Glamourer.State; using OtterGui; using OtterGui.Log; diff --git a/Glamourer/Gui/Equipment/EquipmentDrawer.cs b/Glamourer/Gui/Equipment/EquipmentDrawer.cs index e65981e..83c560d 100644 --- a/Glamourer/Gui/Equipment/EquipmentDrawer.cs +++ b/Glamourer/Gui/Equipment/EquipmentDrawer.cs @@ -9,6 +9,7 @@ using ImGuiNET; using OtterGui; using OtterGui.Raii; using OtterGui.Text; +using OtterGui.Text.EndObjects; using OtterGui.Widgets; using Penumbra.GameData.DataContainers; using Penumbra.GameData.Enums; @@ -35,6 +36,8 @@ public class EquipmentDrawer private float _requiredComboWidthUnscaled; private float _requiredComboWidth; + private Stain? _draggedStain; + public EquipmentDrawer(FavoriteManager favorites, IDataManager gameData, ItemManager items, CodeService codes, TextureService textures, Configuration config, GPoseService gPose, AdvancedDyePopup advancedDyes) { @@ -512,6 +515,10 @@ public class EquipmentDrawer var change = small ? _stainCombo.Draw($"##stain{data.Slot}", stain.RgbaColor, stain.Name, found, stain.Gloss) : _stainCombo.Draw($"##stain{data.Slot}", stain.RgbaColor, stain.Name, found, stain.Gloss, width); + + if (!change) + DrawStainDragDrop(data, index, stain, found); + if (index < data.CurrentStains.Count - 1) ImUtf8.SameLineInner(); @@ -526,6 +533,27 @@ public class EquipmentDrawer } } + private void DrawStainDragDrop(in EquipDrawData data, int index, Stain stain, bool found) + { + if (found) + { + using var dragSource = ImUtf8.DragDropSource(); + if (dragSource.Success) + { + if (DragDropSource.SetPayload("stainDragDrop"u8)) + _draggedStain = stain; + ImUtf8.Text($"Dragging {stain.Name}..."); + } + } + + using var dragTarget = ImUtf8.DragDropTarget(); + if (dragTarget.IsDropping("stainDragDrop"u8) && _draggedStain.HasValue) + { + data.SetStains(data.CurrentStains.With(index, _draggedStain.Value.RowIndex)); + _draggedStain = null; + } + } + private void DrawItem(in EquipDrawData data, out string label, bool small, bool clear, bool open) { Debug.Assert(data.Slot.IsEquipment() || data.Slot.IsAccessory(), $"Called {nameof(DrawItem)} on {data.Slot}.");