wip(app): delete dialog, keyboard timeline, status filters, remote facets
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
10 files changed
+407
-65
No files matched your search
@@ -9,8 +9,10 @@ namespace Titano.Ui.Visuals;
|
||||
/// Library timeline mode (BRIEF §12.2): one band per year with its label on the left and a density bar per slot
|
||||
/// (month) on a scale shared by all bands, slot labels underneath and a divider between bands. The current slot
|
||||
/// (<see cref="CurrentBand"/>, <see cref="CurrentSlot"/>) is outlined in Accent; clicking a slot makes it current
|
||||
/// and raises <see cref="SlotActivatedEvent"/>. Desired height = bands × <see cref="BandHeight"/>, so the control
|
||||
/// scrolls inside a ScrollViewer.
|
||||
/// and raises <see cref="SlotActivatedEvent"/>. From the keyboard, the arrow keys move a dashed focus ring from month to
|
||||
/// month (Left and Right run across years, Up and Down change year, Home and End go to the year's ends) with its
|
||||
/// readout, and Enter or Space activates the slot under it. Desired height = bands × <see cref="BandHeight"/>, so the
|
||||
/// control scrolls inside a ScrollViewer and brings the focused band into sight.
|
||||
/// </summary>
|
||||
public sealed class TimelineBands : DrawingElement
|
||||
{
|
||||
@@ -46,6 +48,16 @@ public sealed class TimelineBands : DrawingElement
|
||||
|
||||
private (int Band, int Slot) _hover = (-1, -1);
|
||||
|
||||
/// <summary>The slot the keyboard is on; (−1, −1) until the control first takes keyboard focus.</summary>
|
||||
private (int Band, int Slot) _keyboard = (-1, -1);
|
||||
|
||||
static TimelineBands()
|
||||
{
|
||||
FocusableProperty.OverrideMetadata(typeof(TimelineBands), new FrameworkPropertyMetadata(true));
|
||||
// The focused slot is outlined on the drawing itself.
|
||||
FocusVisualStyleProperty.OverrideMetadata(typeof(TimelineBands), new FrameworkPropertyMetadata(null));
|
||||
}
|
||||
|
||||
/// <summary>One band per year: label + one value per slot.</summary>
|
||||
public IReadOnlyList<ChartRow>? Bands { get => (IReadOnlyList<ChartRow>?)GetValue(BandsProperty); set => SetValue(BandsProperty, value); }
|
||||
|
||||
@@ -90,6 +102,7 @@ public sealed class TimelineBands : DrawingElement
|
||||
protected override void OnDataChanged()
|
||||
{
|
||||
_hover = (-1, -1);
|
||||
if (_keyboard.Band >= (Bands?.Count ?? 0) || _keyboard.Slot >= SlotCount) _keyboard = (-1, -1);
|
||||
base.OnDataChanged();
|
||||
}
|
||||
|
||||
@@ -137,6 +150,8 @@ public sealed class TimelineBands : DrawingElement
|
||||
}
|
||||
if (b == CurrentBand && s == CurrentSlot)
|
||||
dc.DrawRoundedRectangle(null, GetPen("Brush.Accent", 1.5), new Rect(cx - pitch / 2 + 2, top + 4, pitch - 4, BandHeight - 8), 4, 4);
|
||||
if (IsKeyboardFocused && b == _keyboard.Band && s == _keyboard.Slot)
|
||||
dc.DrawRoundedRectangle(null, GetPen("Brush.Accent", 2, LineDash.Dashed), new Rect(cx - pitch / 2 + 0.5, top + 1, pitch - 1, BandHeight - 2), 5, 5);
|
||||
}
|
||||
if (b < bands.Count - 1)
|
||||
{
|
||||
@@ -174,10 +189,75 @@ public sealed class TimelineBands : DrawingElement
|
||||
base.OnMouseLeftButtonUp(e);
|
||||
var (band, slot) = HitTest(e.GetPosition(this));
|
||||
if (band < 0) return;
|
||||
_keyboard = (band, slot);
|
||||
Activate(band, slot);
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
|
||||
{
|
||||
base.OnGotKeyboardFocus(e);
|
||||
if (_keyboard.Band < 0 && Bands is { Count: > 0 } && SlotCount > 0)
|
||||
_keyboard = CurrentBand >= 0 && CurrentSlot >= 0 ? (CurrentBand, CurrentSlot) : (0, 0);
|
||||
InvalidateVisual();
|
||||
}
|
||||
|
||||
protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e)
|
||||
{
|
||||
base.OnLostKeyboardFocus(e);
|
||||
Readout.Hide();
|
||||
InvalidateVisual();
|
||||
}
|
||||
|
||||
protected override void OnKeyDown(KeyEventArgs e)
|
||||
{
|
||||
base.OnKeyDown(e);
|
||||
var bands = Bands?.Count ?? 0;
|
||||
var slots = SlotCount;
|
||||
if (e.Handled || bands == 0 || slots == 0) return;
|
||||
var (band, slot) = _keyboard.Band >= 0 ? _keyboard : (0, 0);
|
||||
switch (e.Key)
|
||||
{
|
||||
case Key.Enter or Key.Space:
|
||||
Activate(band, slot);
|
||||
e.Handled = true;
|
||||
return;
|
||||
// Bands run newest first: Left goes back in time, into the year below after January.
|
||||
case Key.Left:
|
||||
(band, slot) = slot > 0 ? (band, slot - 1) : band < bands - 1 ? (band + 1, slots - 1) : (band, slot);
|
||||
break;
|
||||
case Key.Right:
|
||||
(band, slot) = slot < slots - 1 ? (band, slot + 1) : band > 0 ? (band - 1, 0) : (band, slot);
|
||||
break;
|
||||
case Key.Up:
|
||||
band = Math.Max(0, band - 1);
|
||||
break;
|
||||
case Key.Down:
|
||||
band = Math.Min(bands - 1, band + 1);
|
||||
break;
|
||||
case Key.Home:
|
||||
slot = 0;
|
||||
break;
|
||||
case Key.End:
|
||||
slot = slots - 1;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
_keyboard = (band, slot);
|
||||
var pitch = SlotPitch;
|
||||
var top = band * BandHeight;
|
||||
BringIntoView(new Rect(0, top, ActualWidth, BandHeight));
|
||||
Readout.Show(ReadoutText(band, slot), new Point(LabelColumn + pitch * (slot + 0.5), top + BandHeight / 2));
|
||||
InvalidateVisual();
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void Activate(int band, int slot)
|
||||
{
|
||||
SetCurrentValue(CurrentBandProperty, band);
|
||||
SetCurrentValue(CurrentSlotProperty, slot);
|
||||
RaiseEvent(new ChartItemEventArgs(SlotActivatedEvent, band, slot));
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private (int Band, int Slot) HitTest(Point p)
|
||||
|
||||
Reference in new issue
Block a user