Skip to content

Interactive 2D wave optics simulator. Turn any image into a refractive scene, add sources, watch waves refract, diffract and interfere. Probes, intensity maps, video export.

C#

A probe's handles appear only on the picture of the layer it measures

Alexander Graef7d5b8405797f
diff --git a/CLAUDE.md b/CLAUDE.md
index b0afdfd..8b6cb7d 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -114,7 +114,8 @@ FrameStore: native memory up to the budget, the rest in a temp file (%LOCALAPPDA
until the run catches up. Live follows a running run until the user scrubs; it ends with a last follow to the
final frame. A replaced project goes to frame 0; a discarded run keeps the position. In/out points are steps.
- **Handles and overlays**: sources, probes, emitter dots and the rotation handle are drawn over the pictures in
- canvas pixels, over a dark halo, clipped to the picture; arrows nudge, selection syncs with the tree, a click on
+ canvas pixels, over a dark halo, clipped to the picture; a probe's handles and line appear only on the picture of
+ the layer it measures (2026-10-18), sources on both; arrows nudge, selection syncs with the tree, a click on
empty space deselects. Probe graph boxes follow their probe while attached, resize by a grip, keep their text
size; an amplitude axis is symmetric about zero.
- **Colour schemes** are stop lists in `.wdscheme` XML, shipped ones embedded, user ones in
diff --git a/WaveDudeNext.WPF/Controls/SceneOverlay.cs b/WaveDudeNext.WPF/Controls/SceneOverlay.cs
index bca8306..b8239ac 100644
--- a/WaveDudeNext.WPF/Controls/SceneOverlay.cs
+++ b/WaveDudeNext.WPF/Controls/SceneOverlay.cs
@@ -59,6 +59,10 @@ public sealed class SceneOverlay : Panel
nameof(SelectedItem), typeof(object), typeof(SceneOverlay),
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, (d, _) => ((SceneOverlay)d).UpdateSelection()));
+ /// <summary>Identifies the <see cref="Layer"/> property.</summary>
+ public static readonly DependencyProperty LayerProperty = DependencyProperty.Register(
+ nameof(Layer), typeof(ProbeLayer?), typeof(SceneOverlay), new PropertyMetadata(null, (d, _) => ((SceneOverlay)d).Rebuild()));
+
/// <summary>Identifies the <see cref="SourceStyle"/> property.</summary>
public static readonly DependencyProperty SourceStyleProperty = DependencyProperty.Register(
nameof(SourceStyle), typeof(Style), typeof(SceneOverlay), new PropertyMetadata(null, (d, _) => ((SceneOverlay)d).Rebuild()));
@@ -136,6 +140,20 @@ public sealed class SceneOverlay : Panel
set => SetValue(SelectedItemProperty, value);
}
+ /// <summary>
+ /// The picture's layer: only the probes measuring it get handles and lines here (2026-10-18, the user's rule: a probe
+ /// on both pictures confused, above all in a single-picture view). Sources drive both layers and show on both.
+ /// Null shows every probe.
+ /// </summary>
+ public ProbeLayer? Layer
+ {
+ get => (ProbeLayer?)GetValue(LayerProperty);
+ set => SetValue(LayerProperty, value);
+ }
+
+ /// <summary>Whether <paramref name="probe"/> belongs on this picture (see <see cref="Layer"/>).</summary>
+ private bool Shows(Probe probe) => Layer is not { } layer || probe.Layer == layer;
+
/// <summary>Style of the source handles (a <see cref="MarkerThumb"/> style).</summary>
public Style? SourceStyle
{
@@ -229,6 +247,10 @@ public sealed class SceneOverlay : Panel
foreach (Probe probe in project.Probes)
{
Subscribe(probe);
+ if (!Shows(probe))
+ {
+ continue;
+ }
AddThumb(probe, MarkerRole.ProbeA, ProbeStyle, probe.Name, "Probe:" + probe.Name + ":A");
if (probe.Kind == ProbeKind.Line)
{
@@ -264,7 +286,7 @@ public sealed class SceneOverlay : Panel
{
switch (sender)
{
- case Probe when e.PropertyName == nameof(Probe.Kind):
+ case Probe when e.PropertyName is nameof(Probe.Kind) or nameof(Probe.Layer):
case Source when e.PropertyName == nameof(Source.Array):
Rebuild();
return;
@@ -478,7 +500,7 @@ public sealed class SceneOverlay : Panel
dc.PushClip(new RectangleGeometry(PictureRect(RenderSize)));
foreach (Probe probe in project.Probes)
{
- if (probe.Kind != ProbeKind.Line)
+ if (probe.Kind != ProbeKind.Line || !Shows(probe))
{
continue;
}
diff --git a/WaveDudeNext.WPF/Panes/PreviewPane.xaml b/WaveDudeNext.WPF/Panes/PreviewPane.xaml
index 226a7f7..2c2217a 100644
--- a/WaveDudeNext.WPF/Panes/PreviewPane.xaml
+++ b/WaveDudeNext.WPF/Panes/PreviewPane.xaml
@@ -503,6 +503,7 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or
Project="{Binding Project, RelativeSource={RelativeSource AncestorType={x:Type local:PreviewPane}}}"
CanvasWidth="{Binding CanvasWidth, RelativeSource={RelativeSource AncestorType={x:Type local:PreviewPane}}}"
CanvasHeight="{Binding CanvasHeight, RelativeSource={RelativeSource AncestorType={x:Type local:PreviewPane}}}"
+ Layer="{Binding Path=(local:PreviewPane.Layer), RelativeSource={RelativeSource TemplatedParent}}"
SelectedItem="{Binding SelectedItem, RelativeSource={RelativeSource AncestorType={x:Type local:PreviewPane}}, Mode=TwoWay}" />
<!-- a frame for this position is being computed (longer than a moment): the stale picture dims and a spinner
turns, so the wait reads as work in progress and not as a preview that does not update (2026-10-14) -->