Skip to content
This repository was archived by the owner on Apr 13, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 26 additions & 14 deletions src/AvaloniaNodeEditor/Views/MainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,12 @@
<!-- Nodes tab replaces the toolbox side panel; drag items to the canvas -->
<ribbon:RibbonTab Header="Nodes">
<ribbon:RibbonTab.Groups>
<ribbon:RibbonGroupBox Header="Drag to canvas">
<!-- Sources: nodes that produce/generate data -->
<ribbon:RibbonGroupBox Header="Sources">
<!-- Gallery extends ListBox; GalleryItem extends ListBoxItem.
Loaded event is used to wire drag handlers safely after
the ribbon tab content is instantiated. -->
<ribbon:Gallery x:Name="NodeGallery"
Size="Large"
<ribbon:Gallery Size="Large"
Loaded="OnNodeGalleryLoaded">
<ribbon:GalleryItem Content="Number Producer"
Tag="Number Producer"
Expand All @@ -193,6 +193,23 @@
</Border>
</ribbon:GalleryItem.LargeIcon>
</ribbon:GalleryItem>
<ribbon:GalleryItem Content="Random Number Gen."
Tag="Random Number Generator"
ToolTip.Tip="Random Number Generator — drag to canvas">
<ribbon:GalleryItem.LargeIcon>
<Border Width="32" Height="32" Background="#E67E22" CornerRadius="4">
<TextBlock Text="RNG" Foreground="White"
HorizontalAlignment="Center" VerticalAlignment="Center"
FontSize="11" FontWeight="Bold"/>
</Border>
</ribbon:GalleryItem.LargeIcon>
</ribbon:GalleryItem>
</ribbon:Gallery>
</ribbon:RibbonGroupBox>
<!-- Reporters: nodes that display/output data -->
<ribbon:RibbonGroupBox Header="Reporters">
<ribbon:Gallery Size="Large"
Loaded="OnNodeGalleryLoaded">
<ribbon:GalleryItem Content="Number Reporter"
Tag="Number Reporter"
ToolTip.Tip="Number Reporter — drag to canvas">
Expand All @@ -204,6 +221,12 @@
</Border>
</ribbon:GalleryItem.LargeIcon>
</ribbon:GalleryItem>
</ribbon:Gallery>
</ribbon:RibbonGroupBox>
<!-- Processors: nodes that transform/filter data -->
<ribbon:RibbonGroupBox Header="Processors">
<ribbon:Gallery Size="Large"
Loaded="OnNodeGalleryLoaded">
<ribbon:GalleryItem Content="Arithmetic Transform"
Tag="Arithmetic Transform"
ToolTip.Tip="Arithmetic Transform — drag to canvas">
Expand All @@ -215,17 +238,6 @@
</Border>
</ribbon:GalleryItem.LargeIcon>
</ribbon:GalleryItem>
<ribbon:GalleryItem Content="Random Number Gen."
Tag="Random Number Generator"
ToolTip.Tip="Random Number Generator — drag to canvas">
<ribbon:GalleryItem.LargeIcon>
<Border Width="32" Height="32" Background="#E67E22" CornerRadius="4">
<TextBlock Text="RNG" Foreground="White"
HorizontalAlignment="Center" VerticalAlignment="Center"
FontSize="11" FontWeight="Bold"/>
</Border>
</ribbon:GalleryItem.LargeIcon>
</ribbon:GalleryItem>
<ribbon:GalleryItem Content="Pass Filter"
Tag="Pass Filter"
ToolTip.Tip="Pass Filter — drag to canvas">
Expand Down
3 changes: 2 additions & 1 deletion src/AvaloniaNodeEditor/Views/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@ private void OnGalleryPointerPressed(object? sender, PointerPressedEventArgs e)
_galleryDragStart = e.GetPosition(null);
// SelectedItem is already updated because GalleryItem (ListBoxItem) marks
// PointerPressed as handled (completing its own selection) before this fires.
if (NodeGallery?.SelectedItem is Control selectedItem)
// Use sender (the gallery that registered the handler) to support multiple galleries.
if (sender is ListBox gallery && gallery.SelectedItem is Control selectedItem)
{
_galleryDragNodeType = selectedItem.Tag as string;
}
Expand Down
Loading