Improve some mousewheel stuff and add some tooltips.

This commit is contained in:
Ottermandias 2024-02-06 18:01:05 +01:00
parent 346e4890b0
commit fc52d44c9c
4 changed files with 10 additions and 12 deletions

View file

@ -36,7 +36,7 @@ public partial class CustomizationDrawer
var tmp = (int)_currentByte.Value;
ImGui.SetNextItemWidth(_comboSelectorSize);
if (ImGui.SliderInt("##slider", ref tmp, 0, _currentCount - 1, "%i", ImGuiSliderFlags.AlwaysClamp)
|| CaptureMouseWheel(ref tmp, 0, _currentCount - 1))
|| CaptureMouseWheel(ref tmp, 0, _currentCount))
UpdateValue((CustomizeValue)tmp);
}

View file

@ -7,6 +7,7 @@ using Glamourer.Unlocks;
using ImGuiNET;
using OtterGui;
using OtterGui.Raii;
using OtterGui.Widgets;
using Penumbra.GameData.DataContainers;
using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs;
@ -139,7 +140,7 @@ public class EquipmentDrawer
public bool DrawAllStain(out StainId ret, bool locked)
{
using var disabled = ImRaii.Disabled(locked);
var change = _stainCombo.Draw("Dye All Slots", Stain.None.RgbaColor, string.Empty, false, false);
var change = _stainCombo.Draw("Dye All Slots", Stain.None.RgbaColor, string.Empty, false, false, MouseWheelType.None);
ret = Stain.None.RowIndex;
if (change)
if (_stainData.TryGetValue(_stainCombo.CurrentSelection.Key, out var stain))
@ -464,12 +465,12 @@ public class EquipmentDrawer
(var tt, item, var valid) = (allowRevert && !revertItem.Equals(currentItem), allowClear && !clearItem.Equals(currentItem),
ImGui.GetIO().KeyCtrl) switch
{
(true, true, true) => ("Right-click to clear. Control and Right-Click to revert to game.", revertItem, true),
(true, true, false) => ("Right-click to clear. Control and Right-Click to revert to game.", clearItem, true),
(true, false, true) => ("Control and Right-Click to revert to game.", revertItem, true),
(true, false, false) => ("Control and Right-Click to revert to game.", default, false),
(false, true, _) => ("Right-click to clear.", clearItem, true),
(false, false, _) => (string.Empty, default, false),
(true, true, true) => ("Right-click to clear. Control and Right-Click to revert to game.\nControl and mouse wheel to scroll.", revertItem, true),
(true, true, false) => ("Right-click to clear. Control and Right-Click to revert to game.\nControl and mouse wheel to scroll.", clearItem, true),
(true, false, true) => ("Control and Right-Click to revert to game.\nControl and mouse wheel to scroll.", revertItem, true),
(true, false, false) => ("Control and Right-Click to revert to game.\nControl and mouse wheel to scroll.", default, false),
(false, true, _) => ("Right-click to clear.\nControl and mouse wheel to scroll.", clearItem, true),
(false, false, _) => ("Control and mouse wheel to scroll.", default, false),
};
ImGuiUtil.HoverTooltip(tt);

View file

@ -36,9 +36,6 @@ public sealed class GlamourerColorCombo(float _comboWidth, DictStain _stains, Fa
return base.DrawSelectable(globalIdx, selected);
}
public override bool Draw(string label, uint color, string name, bool found, bool gloss, float previewWidth)
=> base.Draw(label, color, name, found, gloss, previewWidth);
private static Func<IReadOnlyList<KeyValuePair<byte, (string Name, uint Color, bool Gloss)>>> CreateFunc(DictStain stains,
FavoriteManager favorites)
=> () => stains.Select(kvp => (kvp, favorites.Contains(kvp.Key))).OrderBy(p => !p.Item2).Select(p => p.kvp)

@ -1 +1 @@
Subproject commit 2d8a03eebd80e19c6936a28ab2e3a8c164cc17f3
Subproject commit 1a187f756f2e8823197bd43db1c3383231f5eaff