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 file dropped on the tree or a picture reaches the window again
Alexander Graef82ce8047fee1
diff --git a/CLAUDE.md b/CLAUDE.mdindex cbbcc18..bd8b4ab 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -207,7 +207,8 @@ FrameStore: native memory up to the budget, the rest in a temp file (%LOCALAPPDAtree pastes, and a picture of this window or another pastes and moves the objects as a group onto the drop pixel(`PlaceAt`, held inside the canvas), so a drag from the tree to the picture duplicates. `ObjectsData` reads a drag orthe clipboard and parses each text once; the window reads the clipboard once per change of Windows' clipboard- sequence number.+ sequence number. The tree and the pictures claim a drag only when they take it; a file dropped anywhere is the window's,+ which opens it (2026-10-26, Jeroen's report: for three days a file over the tree or a picture was refused).- **Icons** (2026-10-22/23): a menu entry gets one through the attached `MenuIcon.Glyph` (a code point of Segoe FluentIcons that Segoe MDL2 Assets has too, for Windows 10; the `IconGlyphText` style, greyscale) or `MenuIcon.Drawing`, thename of an `Icon<Name>` (and `Icon<Name>Fill`) `StreamGeometry` in `Themes/Controls.xaml`; both make an `IconView`,diff --git a/WaveDudeNext.WPF/Controls/SceneOverlay.cs b/WaveDudeNext.WPF/Controls/SceneOverlay.csindex 3592862..48137b8 100644--- a/WaveDudeNext.WPF/Controls/SceneOverlay.cs+++ b/WaveDudeNext.WPF/Controls/SceneOverlay.cs@@ -1017,12 +1017,19 @@ public sealed class SceneOverlay : Panelprivate ProjectClipboard.Clip? DroppableClip(IDataObject data) =>Project != null && _dragged.Clip(data) is { HasItems: true } clip ? clip : null;- /// <inheritdoc/>+ /// <summary>+ /// Claims a drag only when it carries droppable objects; anything else, a file above all, is left unhandled for the+ /// window, which opens a dropped file and refuses other data (2026-10-26, the user's report: handling every drag here+ /// had refused a project file over the pictures since 2026-10-23).+ /// </summary>protected override void OnDragOver(DragEventArgs e){base.OnDragOver(e);- e.Effects = DroppableClip(e.Data) != null ? DragDropEffects.Copy : DragDropEffects.None;- e.Handled = true;+ if (DroppableClip(e.Data) != null)+ {+ e.Effects = DragDropEffects.Copy;+ e.Handled = true;+ }}/// <summary>@@ -1034,12 +1041,13 @@ public sealed class SceneOverlay : Panelprotected override void OnDrop(DragEventArgs e){base.OnDrop(e);- e.Handled = true;- // taken, not kept: the paste makes the clip's objects the project's+ // taken, not kept: the paste makes the clip's objects the project's; a drag without them (a file) stays unhandled+ // for the windowif (Project is not { } project || DroppableClip(e.Data) is not { } clip){return;}+ e.Handled = true;_dragged.Clear();(double x, double y) = ToCanvasExact(e.GetPosition(this));int canvasX = (int)Math.Floor(x);diff --git a/WaveDudeNext.WPF/Panes/ProjectTree.xaml.cs b/WaveDudeNext.WPF/Panes/ProjectTree.xaml.csindex 93fbb59..1cb41aa 100644--- a/WaveDudeNext.WPF/Panes/ProjectTree.xaml.cs+++ b/WaveDudeNext.WPF/Panes/ProjectTree.xaml.cs@@ -378,13 +378,18 @@ public partial class ProjectTree : UserControl}}+ /// <summary>+ /// The tree claims a drag only when it takes it (an own row to reorder, project objects to paste); anything else, a+ /// file above all, is left unhandled for the window, which opens a dropped file and refuses other data (2026-10-26,+ /// the user's report: handling every drag here had refused a project file over the tree since 2026-10-23).+ /// </summary>private void OnDragOver(object sender, DragEventArgs e){- e.Effects = DragDropEffects.None;- e.Handled = true;ClearAdorner();if (_dragItem is { } item){+ e.Handled = true;+ e.Effects = DragDropEffects.None;if (FindDropTarget(item, e.GetPosition(tree)) is { } target){e.Effects = DragDropEffects.Move;@@ -394,6 +399,7 @@ public partial class ProjectTree : UserControl}if (!_dragging && _dragged.Clip(e.Data) is { } clip && FindPasteTarget(clip, e.GetPosition(tree)) is { } paste){+ e.Handled = true;e.Effects = DragDropEffects.Copy;ShowAdorner(paste.Row, paste.Header, paste.Placement);}@@ -403,23 +409,19 @@ public partial class ProjectTree : UserControlprivate void OnDrop(object sender, DragEventArgs e){- e.Handled = true;ClearAdorner();- if (Project is not { } project)- {- return;- }if (_dragItem is { } item){- if (FindDropTarget(item, e.GetPosition(tree)) is not { } target)+ e.Handled = true;+ if (Project is not { } own || FindDropTarget(item, e.GetPosition(tree)) is not { } target){return;}bool moved = item switch{- Source source => project.Move(source, target.Index),- OpticalPart part => project.Move(part, target.Index),- Probe probe => project.Move(probe, target.Index),+ Source source => own.Move(source, target.Index),+ OpticalPart part => own.Move(part, target.Index),+ Probe probe => own.Move(probe, target.Index),_ => false,};if (moved)@@ -428,11 +430,13 @@ public partial class ProjectTree : UserControl}return;}- // taken, not kept: the paste makes the clip's objects the project's- if (_dragging || _dragged.Take(e.Data) is not { } clip || FindPasteTarget(clip, e.GetPosition(tree)) is not { } paste)+ // taken, not kept: the paste makes the clip's objects the project's. A drag the tree does not take (a file) stays+ // unhandled for the window+ if (_dragging || Project is not { } project || _dragged.Take(e.Data) is not { } clip || FindPasteTarget(clip, e.GetPosition(tree)) is not { } paste){return;}+ e.Handled = true;IReadOnlyList<object> pasted = ProjectClipboard.Paste(project, clip, paste.Current, paste.Before);if (pasted.Count == 0){