fix(ui): toasts render; RTL-aware icons, charts and media; keyboard and screen-reader support in the kit
- ToastHost gets its template (nothing drew before); toasts are announced, pause while hovered or focused, Esc dismisses the focused one, the action closes it, FocusNewest brings the keyboard to them. - Windows take the UI language's direction when created and follow every switch. - Icons mirror only when the glyph is directional (IconData.IsDirectional, Bidi.IsDirectional override); the brand mark never mirrors; icons centre in stretched slots (ComboBox chevron). - Card photos, scrub position, preview surface and shot data, mono templates, paths are left-to-right islands; the preview tool row follows the layout direction. - Chart words (categories, legends, summaries) read in the UI direction and legends start on its side. - Automation peers: charts as named images, filmstrip as a slider, curve editor value, preview image, split button, AutoSlider group; localized names for caption, reset, remove, dismiss and drop-down buttons. - Focus visible on list and table rows and the preview; curve editor fully operable by keyboard. - Rail item collapsed layout fixed; job bar trims its text only once the bar is at its minimum. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
29 files changed
+711
-144
No files matched your search
@@ -1,8 +1,10 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Automation.Peers;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Titano.Core.Localization;
|
||||
|
||||
namespace Titano.Ui.Visuals;
|
||||
|
||||
@@ -39,7 +41,8 @@ public readonly record struct MotionVector(float X, float Y, float Dx, float Dy)
|
||||
/// polyline) and a crop mask (normalised <see cref="CropRect"/>; dims or hides what the output loses). Tools go
|
||||
/// bottom-left (<see cref="ToolsContent"/>), the shot data pill bottom-right (<see cref="InfoText"/>). Images and
|
||||
/// overlays are retained visuals under one shared transform, so panning re-renders nothing. Double-click toggles
|
||||
/// Fit and 1:1; Ctrl+0 fits, Ctrl+1 shows 1:1.
|
||||
/// Fit and 1:1; Ctrl+0 fits, Ctrl+1 shows 1:1. Screen readers see an image (named by AutomationProperties.Name)
|
||||
/// whose status is the zoom and whose help text is the shot data, holding the tools.
|
||||
/// </summary>
|
||||
[TemplatePart(Name = PartSurface, Type = typeof(FrameworkElement))]
|
||||
[TemplatePart(Name = PartTools, Type = typeof(FrameworkElement))]
|
||||
@@ -298,6 +301,8 @@ public class PreviewViewport : Control
|
||||
ApplyZoomMode();
|
||||
}
|
||||
|
||||
protected override AutomationPeer OnCreateAutomationPeer() => new PreviewViewportAutomationPeer(this);
|
||||
|
||||
private static object CoerceUnit(DependencyObject d, object value) => double.IsNaN((double)value) ? 0.5 : Math.Clamp((double)value, 0, 1);
|
||||
|
||||
private static object CoerceZoom(DependencyObject d, object value) =>
|
||||
@@ -411,3 +416,23 @@ public class PreviewViewport : Control
|
||||
return !_imageSize.IsEmpty && (_imageSize.Width * _view.Scale > view.Width + 0.5 || _imageSize.Height * _view.Scale > view.Height + 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The preview seen by UI Automation: an image whose status gives the zoom ("50 %") and whose help text is the shot data.</summary>
|
||||
public sealed class PreviewViewportAutomationPeer(PreviewViewport owner) : FrameworkElementAutomationPeer(owner)
|
||||
{
|
||||
protected override AutomationControlType GetAutomationControlTypeCore() => AutomationControlType.Image;
|
||||
|
||||
protected override string GetClassNameCore() => nameof(PreviewViewport);
|
||||
|
||||
protected override string GetItemStatusCore()
|
||||
{
|
||||
var viewport = (PreviewViewport)Owner;
|
||||
return viewport.ImageSize.IsEmpty ? string.Empty : Loc.L("Common.Percent", Math.Round(viewport.Zoom * 100));
|
||||
}
|
||||
|
||||
protected override string GetHelpTextCore()
|
||||
{
|
||||
var help = base.GetHelpTextCore();
|
||||
return string.IsNullOrEmpty(help) ? ((PreviewViewport)Owner).InfoText ?? string.Empty : help;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user