added items

This commit is contained in:
Boki 2026-02-28 15:13:31 -05:00
parent c3de5fdb63
commit 5f90bc137b
158 changed files with 2316 additions and 512 deletions

View file

@ -2,11 +2,13 @@ using System.Collections.Specialized;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Documents;
using Avalonia.Controls.Shapes;
using Avalonia.Input;
using Avalonia.Media;
using Poe2Trade.Core;
using Poe2Trade.Ui.ViewModels;
using Automata.Core;
using Automata.Ui.ViewModels;
namespace Poe2Trade.Ui.Views;
namespace Automata.Ui.Views;
public partial class MainWindow : Window
{
@ -103,6 +105,47 @@ public partial class MainWindow : Window
_ => DefaultBrush,
};
public void CurrencyImage_PointerPressed(object? sender, PointerPressedEventArgs e)
{
if (sender is not Control grid) return;
if (DataContext is not MainWindowViewModel mainVm) return;
var settingsVm = mainVm.SettingsVm;
if (settingsVm?.CurrencyTabImage == null) return;
// Viewbox puts us in image-pixel space — coords are already image pixels
var pos = e.GetPosition(grid);
settingsVm.OnCurrencyImageClick((int)pos.X, (int)pos.Y);
UpdateHoverMarker(settingsVm.SelectedCurrency);
}
public void CurrencyItem_PointerEntered(object? sender, PointerEventArgs e)
{
if (sender is Control { DataContext: CurrencyPositionViewModel vm })
UpdateHoverMarker(vm);
}
public void CurrencyItem_PointerExited(object? sender, PointerEventArgs e)
{
var marker = this.FindControl<Ellipse>("HoverMarker");
if (marker != null) marker.IsVisible = false;
}
private void UpdateHoverMarker(CurrencyPositionViewModel? vm)
{
var marker = this.FindControl<Ellipse>("HoverMarker");
if (marker == null) return;
if (vm == null || !vm.IsPositioned)
{
marker.IsVisible = false;
return;
}
// Canvas is in image-pixel space thanks to Viewbox
Canvas.SetLeft(marker, vm.X - marker.Width / 2);
Canvas.SetTop(marker, vm.Y - marker.Height / 2);
marker.IsVisible = true;
}
protected override void OnClosing(WindowClosingEventArgs e)
{
if (_store != null)