Skip to content

Commit e3160dc

Browse files
committed
Allow map locations outside map bounds while not impairing interaction outside map area
1 parent 48fa89c commit e3160dc

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎EmoTracker.UI/Controls/InputMaskingImage.cs‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ private bool HitTestAlphaMask(Avalonia.Point point)
2020
{
2121
if (Source == null) return false;
2222

23+
// When ClipToBounds is false on ancestor controls (e.g. LayoutTransformControl,
24+
// Viewbox), Avalonia's hit-test walk can deliver points that are outside this
25+
// Image's arranged bounds. Without this early-out the Math.Min clamp below
26+
// would map them to an edge pixel of the alpha mask, producing false positives
27+
// that steal clicks from neighbouring layout elements.
28+
if (point.X < 0 || point.Y < 0 ||
29+
point.X >= Bounds.Width || point.Y >= Bounds.Height)
30+
return false;
31+
2332
var maskEntry = IconUtility.GetAlphaMask(Source);
2433
// No mask → treat as fully transparent (click-through).
2534
// This is critical for the async image pipeline: placeholder images

‎EmoTracker/UI/LayoutControl.axaml‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,7 @@
342342
<DataTemplate DataType="layout:MapPanel">
343343
<LayoutTransformControl Margin="{Binding Margin, Converter={x:Static converters:StringToThicknessConverter.Instance}}"
344344
HorizontalAlignment="{Binding HorizontalAlignment, Converter={x:Static converters:TrivialEnumConverter.Instance}}"
345-
VerticalAlignment="{Binding VerticalAlignment, Converter={x:Static converters:TrivialEnumConverter.Instance}}"
346-
ClipToBounds="True">
345+
VerticalAlignment="{Binding VerticalAlignment, Converter={x:Static converters:TrivialEnumConverter.Instance}}">
347346
<LayoutTransformControl.LayoutTransform>
348347
<ScaleTransform ScaleX="{Binding EffectiveScale}" ScaleY="{Binding EffectiveScale}" />
349348
</LayoutTransformControl.LayoutTransform>

0 commit comments

Comments
 (0)