Skip to content

Commit e0fc538

Browse files
Squashed commit of the following: (#43)
* Squashed commit of the following: commit 5b532fc Merge: 31f958a ed0e36c Author: Jeff H <iknowcodesoup@gmail.com> Date: Sun Dec 21 16:21:49 2025 -0500 Merge branch 'develop-merge-resolve' into develop commit ed0e36c Author: Jeff H <iknowcodesoup@gmail.com> Date: Sun Dec 21 15:33:13 2025 -0500 attempts to move more logic to CSC.Maui assembly commit 9faad49 Author: Jeff H <iknowcodesoup@gmail.com> Date: Sat Dec 20 20:57:42 2025 -0500 Merge remote-tracking branch 'origin/develop' commit 31f958a Author: Jeff Holcombe <iknowcodesoup@gmail.com> Date: Sat Dec 20 20:49:46 2025 -0500 Carousel v3 (#39) * init refactor for underlying infrastructure of carousel from SBC to Maui. Views WIP. no build * reference clean-up * attempts at continued integration and clean-up * loading but no data * working gallery. performance? * refactor out to assembly * clean-up attempt * working gallery * style clean-up * warning clean-up * Some attempt at a test project. documentation. nuget reference * test fix * nuget setup * limit fix * remove local nuget commit 3db488c Author: Jeff Holcombe <iknowcodesoup@gmail.com> Date: Mon Dec 15 13:28:20 2025 -0500 Update README.md commit fcd1983 Author: Jeff H <iknowcodesoup@gmail.com> Date: Mon Dec 15 13:20:55 2025 -0500 toolbar merge fix commit cb3c7e3 Merge: 43504af f3b35b3 Author: Jeff Holcombe <iknowcodesoup@gmail.com> Date: Mon Dec 15 11:10:33 2025 -0500 Merge branch 'main' into develop commit 43504af Author: Jeff Holcombe <iknowcodesoup@gmail.com> Date: Mon Dec 15 11:08:59 2025 -0500 documentation update. angle jitter bug fix. +brushes (#35) commit 63d467c Author: Jeff Holcombe <iknowcodesoup@gmail.com> Date: Mon Dec 15 00:52:38 2025 -0500 Cleanup. Localization. Advanced Settings (#32) * trace mode clean-up. * advanced settings modal * syntax. license * light dark mode cleanup setting * test fixes * prefernces refactor from AI slop. theme bg fix. zoom clamps * active tool style fix * remove AI slop * test fixes. clean-up. revert transparency vm logic commit 39ae4a5 Author: Jeff Holcombe <iknowcodesoup@gmail.com> Date: Sat Dec 13 20:25:43 2025 -0500 Zoom. Trace. +Brushes. Duplicate (#29) * syntax cleanup namespace usings * duplicate element. copy paste * +brushes. needs refinement * give it the figner. finally * zoom controls * transparent net10 attempt * cleanup * working transparency * +comments * trace mode vm update. clean-up * Dynamic transparent slider max disabled * test corrections * storage for flag. disable by default * pref save. +tests * nug fix * same as last
1 parent d7c2567 commit e0fc538

100 files changed

Lines changed: 5079 additions & 417 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/settings.local.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(dotnet build:*)",
5+
"Bash(dotnet test:*)",
6+
"Bash(dotnet clean:*)",
7+
"Bash(Remove-Item -Recurse -Force CodeSoupCafe.Mauiobj,CodeSoupCafe.Mauibin -ErrorAction SilentlyContinue)",
8+
"Bash(Remove-Item -Recurse -Force obj,bin -ErrorAction SilentlyContinue)",
9+
"Bash(dir:*)",
10+
"Bash(dotnet pack:*)",
11+
"Bash(dotnet restore:*)",
12+
"Bash(dotnet sln:*)",
13+
"Bash(findstr:*)",
14+
"Bash(Get-ChildItem -Recurse -Filter \"*carousel*\")",
15+
"Bash(Select-Object FullName)"
16+
]
17+
}
18+
}

.github/workflows/dotnet-desktop.yml

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,32 @@ jobs:
1515
runs-on: windows-latest # Or macos-latest for iOS/Mac Catalyst builds
1616

1717
steps:
18-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@v4
1919

20-
- name: Setup .NET SDK
21-
uses: actions/setup-dotnet@v4
22-
with:
23-
dotnet-version: '10.0.x'
20+
- name: Setup .NET SDK
21+
uses: actions/setup-dotnet@v4
22+
with:
23+
dotnet-version: "10.0.x"
2424

25-
- name: Install MAUI Workloads
26-
run: dotnet workload install maui
25+
- name: Install MAUI Workloads
26+
run: dotnet workload install maui
2727

28-
- name: Restore NuGet packages
29-
run: dotnet restore LunaDraw.csproj
28+
- name: Cache NuGet packages
29+
uses: actions/cache@v4
30+
with:
31+
path: ~/.nuget/packages
32+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json', '**/*.csproj') }}
33+
restore-keys: |
34+
${{ runner.os }}-nuget-
3035
31-
- name: Build MAUI App (Windows)
32-
run: dotnet build LunaDraw.csproj -c Release -f net10.0-windows10.0.19041.0
36+
# - name: Remove Local Source for CI
37+
# run: dotnet nuget remove source LocalNuGetPackages --configfile nuget.config
3338

34-
- name: Run Unit Tests
35-
run: dotnet test tests/LunaDraw.Tests/LunaDraw.Tests.csproj
39+
- name: Restore NuGet packages
40+
run: dotnet restore LunaDraw.csproj --configfile nuget.config
41+
42+
- name: Build MAUI App (Windows)
43+
run: dotnet build LunaDraw.csproj -c Release -f net10.0-windows10.0.19041.0
44+
45+
- name: Run Unit Tests
46+
run: dotnet test tests/LunaDraw.Tests/LunaDraw.Tests.csproj

App.xaml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,18 @@
44
xmlns:local="clr-namespace:LunaDraw"
55
xmlns:converters="clr-namespace:LunaDraw.Converters"
66
x:Class="LunaDraw.App">
7-
<Application.Resources>
8-
<ResourceDictionary>
9-
<ResourceDictionary.MergedDictionaries>
10-
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
11-
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
12-
</ResourceDictionary.MergedDictionaries>
7+
<Application.Resources>
8+
<ResourceDictionary>
9+
<ResourceDictionary.MergedDictionaries>
10+
<ResourceDictionary Source="Resources/Styles/Colors.xaml"/>
11+
<ResourceDictionary Source="Resources/Styles/Styles.xaml"/>
12+
</ResourceDictionary.MergedDictionaries>
1313

14-
<converters:ColorToHexConverter x:Key="ColorToHexConverter"/>
15-
</ResourceDictionary>
16-
</Application.Resources>
14+
<converters:ColorToHexConverter x:Key="ColorToHexConverter"/>
15+
<converters:IsNotNullConverter x:Key="IsNotNullConverter"/>
16+
<converters:IsNullConverter x:Key="IsNullConverter"/>
17+
<converters:InverseBoolConverter x:Key="InverseBoolConverter"/>
18+
<converters:Base64ToImageConverter x:Key="Base64ToImageConverter"/>
19+
</ResourceDictionary>
20+
</Application.Resources>
1721
</Application>

CLAUDE.md

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
LunaDraw is a child-centric drawing application (ages 3-8) built with .NET MAUI targeting Windows, Android, iOS, and MacCatalyst. The app features 24+ magical brush effects, shape tools, stamps, undo/redo, layer management, and "Movie Mode" time-lapse replay.
8+
9+
**Important Context:**
10+
11+
- The codebase is heavily AI-generated ("vibe-coded") and can be fragile in places
12+
- Some canvas functionality was migrated from a working app in `\Legacy\SurfaceBurnCalc`
13+
- The app is in active development with missing features tracked in `Documentation/MissingFeatures.md`
14+
15+
## Build & Development Commands
16+
17+
### Building
18+
19+
```bash
20+
# Build the project (Windows target)
21+
dotnet build LunaDraw.csproj -f net10.0-windows10.0.19041.0
22+
23+
# Build for specific platform
24+
dotnet build LunaDraw.csproj -f net10.0-android36.0
25+
dotnet build LunaDraw.csproj -f net10.0-ios26.0
26+
dotnet build LunaDraw.csproj -f net10.0-maccatalyst26.0
27+
```
28+
29+
### Testing
30+
31+
```bash
32+
# Run all tests
33+
dotnet test tests/LunaDraw.Tests/LunaDraw.Tests.csproj
34+
35+
# Run specific test
36+
dotnet test tests/LunaDraw.Tests/LunaDraw.Tests.csproj --filter "FullyQualifiedName~TestMethodName"
37+
```
38+
39+
### Running
40+
41+
- Use Visual Studio 2022 or VS Code with C# Dev Kit and .NET MAUI extensions
42+
- Select target framework (e.g., `net10.0-windows10.0.19041.0`)
43+
- Build and Run through IDE
44+
45+
## Architecture
46+
47+
### Core Technologies
48+
49+
- **.NET MAUI** - Cross-platform UI framework
50+
- **SkiaSharp** - All vector graphics and rendering (primary graphics engine)
51+
- **ReactiveUI** - MVVM framework and state management using observables
52+
- **CommunityToolkit.Maui** - Extended MAUI controls and utilities
53+
54+
### Architectural Patterns
55+
56+
#### MVVM with ReactiveUI
57+
58+
- ViewModels inherit from `ReactiveObject` for property change notifications
59+
- Use `this.RaiseAndSetIfChanged(ref field, value)` for reactive properties
60+
- Leverage reactive subscriptions for messaging and state changes
61+
62+
#### Messaging & Communication
63+
64+
- **MessageBus** (ReactiveUI's `IMessageBus`): Use sparingly for loosely-coupled broadcast messages between disconnected components
65+
- **Reactive Observables**: Preferred approach for component communication where possible
66+
- **Command/Event Pattern**: Fallback when reactive approaches don't fit
67+
- MessageBus is instance-based (injected via DI), NOT static for testability
68+
69+
#### Dependency Injection
70+
71+
Services registered in `MauiProgram.cs`:
72+
73+
- **Core State**: `IMessageBus`, `NavigationModel`, `SelectionObserver`, `ILayerFacade`
74+
- **Logic Services**: `ICanvasInputHandler`, `ClipboardMemento`, `IBitmapCache`, `IPreferencesFacade`, `IDrawingStorageMomento`
75+
- **ViewModels**: Singleton or Transient as appropriate
76+
- **Pages**: Typically Transient
77+
78+
### Key Architectural Components
79+
80+
#### Drawing Model
81+
82+
- **IDrawableElement**: Base interface for all drawable objects (paths, shapes, stamps, images)
83+
84+
- Supports selection, transforms, visibility, layering (ZIndex), opacity, fill/stroke
85+
- Each element has `Bounds`, `TransformMatrix`, and methods: `Draw()`, `HitTest()`, `Clone()`, `Translate()`, `Transform()`
86+
- Concrete implementations: `DrawablePath`, `DrawableEllipse`, `DrawableRectangle`, `DrawableLine`, `DrawableImage`, `DrawableStamps`, `DrawableGroup`
87+
88+
- **Layer**: Container for drawable elements with ReactiveUI observable collections
89+
90+
- Uses **QuadTree spatial indexing** (`QuadTreeMemento<IDrawableElement>`) for efficient spatial queries and rendering
91+
- No bitmap tiling - renders directly from vector elements
92+
- Auto-assigns ZIndex to new elements to maintain draw order
93+
- Supports masking modes, visibility, locking
94+
95+
- **ILayerFacade**: Abstraction for layer management operations
96+
- Manages `ObservableCollection<Layer>` and current layer state
97+
- Integrates with `HistoryMemento` for undo/redo
98+
- Methods: `AddLayer()`, `RemoveLayer()`, `MoveLayer()`, `MoveElementsToLayer()`, `SaveState()`
99+
100+
#### Tool System
101+
102+
- **IDrawingTool**: Interface for all drawing/editing tools
103+
- Tool implementations: `FreehandTool`, `EraserTool`, `EraserBrushTool`, `FillTool`, `SelectTool`, `LineTool`, `RectangleTool`, `EllipseTool`, `ShapeTool`
104+
- Tools receive `ToolContext` with canvas state, navigation, layers, and brush settings
105+
- Input handling delegated to `CanvasInputHandler` which dispatches to active tool
106+
107+
#### View & Viewport Management
108+
109+
- **NavigationModel**: Manages pan/zoom transformations via `ViewMatrix` (SKMatrix)
110+
- **CanvasInputHandler**: Central touch/mouse input processor
111+
- Handles multi-touch gestures (pan, zoom, rotate) on canvas and selection
112+
- Delegates single-touch drawing to active tool
113+
- Right-click switches to Select tool
114+
- Applies smoothing to gestures for fluid interaction
115+
- **MainPage**: Primary page hosting `SKCanvasView` for rendering
116+
- Subscribes to `CanvasInvalidateMessage` to trigger redraws
117+
- Manages context menus and flyout panels (brushes, shapes, settings)
118+
119+
#### State Management & History
120+
121+
- **HistoryMemento**: Undo/redo stack for layer states
122+
- **ClipboardMemento**: Copy/paste buffer for drawable elements
123+
- **DrawingStorageMomento**: Serialization/deserialization of drawings to file
124+
- **QuadTreeMemento<T>**: Generic spatial partitioning for efficient hit-testing and culling
125+
126+
## Code Quality & Testing Standards
127+
128+
### Testing with xUnit, Moq
129+
130+
- **Test Format**: Arrange-Act-Assert (AAA)
131+
- If no `// Arrange` needed, start with `// Act`
132+
- **Naming**: `Should_When_Returns` format
133+
- Example: `Should_Set_Sliding_Issued_At_Time_When_Valid_Credentials_Expired_Or_Invalid_Returns_Logout`
134+
- **Test Instances**: Use class name for instance, NOT 'sut' or arbitrary names
135+
- Mocks: `mockClassName` (e.g., `mockLayerFacade`)
136+
- **Assertions**: One assertion per line
137+
- **Test Types**: Prefer `[Theory]`, `[InlineData]`, `[MemberData]` over multiple `[Fact]` methods. Include negative test cases
138+
139+
### Bug Fixing Workflow
140+
141+
1. **Write test first** to validate the bug exists
142+
2. Implement the fix
143+
3. Run test to confirm bug elimination
144+
145+
### Code Style Rules (from .clinerules)
146+
147+
- **NO underscores** in names
148+
- **NO regions**
149+
- **NO abbreviations** in variable names or otherwise (use full descriptive names)
150+
- **NO legacy or duplicate code** - refactor to clean state, remove obsolete code
151+
- **Static extensions**: Use ONLY for reusable logic (see `Logic/Extensions/`)
152+
153+
### SOLID & Design Principles
154+
155+
Ensure adherence to:
156+
157+
- Single Responsibility Principle (SRP)
158+
- Open/Closed Principle (OCP)
159+
- Liskov Substitution Principle (LSP)
160+
- Interface Segregation Principle (ISP)
161+
- Dependency Inversion Principle (DIP)
162+
- DRY (Don't Repeat Yourself)
163+
- Low Coupling / High Cohesion
164+
- Separation of Concerns & Modularity
165+
166+
## Project Structure
167+
168+
```
169+
LunaDraw/
170+
├── Components/ # Reusable UI components and controls
171+
│ ├── Carousel/ # Gallery carousel implementation
172+
│ ├── *FlyoutPanel.xaml # Brush, shape, settings panels
173+
│ └── *.cs # Custom controls (BrushPreview, ShapePreview, etc.)
174+
├── Converters/ # XAML value converters
175+
├── Documentation/ # Architecture, features, missing features
176+
├── Logic/ # Core business logic (non-UI)
177+
│ ├── Constants/ # App-wide constants
178+
│ ├── Extensions/ # Static extension methods (SkiaSharp, Preferences)
179+
│ ├── Handlers/ # Input handling (CanvasInputHandler)
180+
│ ├── Messages/ # MessageBus message types
181+
│ ├── Models/ # Domain models (IDrawableElement, Layer, ToolContext, etc.)
182+
│ ├── Tools/ # IDrawingTool implementations
183+
│ ├── Utils/ # Utilities (LayerFacade, Mementos, BitmapCache, etc.)
184+
│ └── ViewModels/ # ReactiveUI ViewModels
185+
├── Pages/ # MAUI pages (MainPage)
186+
├── Platforms/ # Platform-specific code
187+
├── Resources/ # Images, fonts, splash, raw assets
188+
├── tests/ # Unit tests
189+
│ └── LunaDraw.Tests/
190+
└── MauiProgram.cs # DI registration and app configuration
191+
```
192+
193+
## Important Technical Notes
194+
195+
### SkiaSharp Rendering
196+
197+
- All graphics rendered via SkiaSharp (`SKCanvas`, `SKPaint`, `SKPath`)
198+
- `MainPage.OnCanvasViewPaintSurface`: Main rendering loop
199+
- Applies `NavigationModel.ViewMatrix` for pan/zoom
200+
- Iterates layers, uses QuadTree to cull off-screen elements
201+
- Elements sorted by ZIndex before drawing
202+
203+
### Brush Effects
204+
205+
- 24+ brush effects with custom shaders and blending modes
206+
- Examples: Glow/Neon (additive blending, bloom), Star Sparkles, Rainbow, Fireworks, Crayon, Spray, Ribbon
207+
- Brush settings stored in `ToolbarViewModel` and passed via `ToolContext`
208+
209+
### Movie Mode (Time-Lapse)
210+
211+
- Records drawing process in background
212+
- Playback animates creation of drawing
213+
214+
### Child-Friendly UX Requirements
215+
216+
- Large touch targets (min 2cm x 2cm)
217+
- Multi-sensory feedback (sounds, animations)
218+
- Icon-driven, minimal text
219+
- Visual/audio guidance over explicit instructions
220+
221+
## Legacy & Migration Notes
222+
223+
- Canvas functionality migrated from `\Legacy\SurfaceBurnCalc` (previous working app)
224+
- Current branch `reactive-carousel-v2` is refactoring carousel infrastructure from SBC to MAUI
225+
- Code is fragile in places due to AI generation - test thoroughly
226+
227+
## Additional Resources
228+
229+
- **README.md**: Project overview, features, screenshots, setup
230+
- **Documentation/ArchitectureDesign.md**: Detailed architecture and design requirements
231+
- **Documentation/Features.md**: Feature specifications
232+
- **Documentation/MissingFeatures.md**: Pending features and known issues
233+
- **.clinerules/**: Coding standards and SPARC methodology guidelines

ClearCache.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dotnet nuget locals all --clear
2+
dotnet clean
3+
for /d /r . %%d in (bin,obj) do @if exist "%%d" rd /s/q "%%d"

Components/AdvancedSettingsPopup.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
x:Class="LunaDraw.Components.AdvancedSettingsPopup"
88
x:DataType="viewModels:MainViewModel"
99
CanBeDismissedByTappingOutsideOfPopup="True"
10-
BackgroundColor="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Gray900}}">
10+
BackgroundColor="{AppThemeBinding Light={StaticResource PopupBackgroundLight}, Dark={StaticResource PopupBackgroundDark}}">
1111
<VerticalStackLayout Spacing="15">
1212
<Grid ColumnDefinitions="*, Auto"
1313
RowDefinitions="Auto, Auto, Auto"

Components/BrushesFlyoutPanel.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
x:Class="LunaDraw.Components.BrushesFlyoutPanel"
88
x:DataType="viewModels:ToolbarViewModel"
99
x:Name="Root">
10-
<Border Background="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Gray800}}"
10+
<Border Background="{AppThemeBinding Light={StaticResource PopupBackgroundLight}, Dark={StaticResource PopupBackgroundDark}}"
1111
Padding="12"
1212
StrokeShape="RoundRectangle"
13-
Stroke="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}"
13+
Stroke="{AppThemeBinding Light={StaticResource PopupBorderLight}, Dark={StaticResource PopupBorderDark}}"
1414
StrokeThickness="1"
1515
MaximumWidthRequest="400">
1616
<StackLayout Spacing="10">
@@ -20,7 +20,7 @@
2020
HorizontalTextAlignment="Center"/>
2121

2222
<BoxView HeightRequest="1"
23-
Color="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}"
23+
Color="{AppThemeBinding Light={StaticResource PopupBorderLight}, Dark={StaticResource PopupBorderDark}}"
2424
Margin="0,5"/>
2525

2626
<CollectionView ItemsSource="{Binding AvailableBrushShapes}"
@@ -38,7 +38,7 @@
3838
<StackLayout HorizontalOptions="Center">
3939
<Border StrokeShape="RoundRectangle 10"
4040
StrokeThickness="1"
41-
Stroke="Gray"
41+
Stroke="{StaticResource Gray500Brush}"
4242
WidthRequest="60"
4343
HeightRequest="60"
4444
Padding="4"

0 commit comments

Comments
 (0)