Skip to content

Add ParetteEditView - #237

Draft
eisukekusachi wants to merge 13 commits into
mainfrom
feature/parette-edit-view
Draft

Add ParetteEditView#237
eisukekusachi wants to merge 13 commits into
mainfrom
feature/parette-edit-view

Conversation

@eisukekusachi

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new PaletteEditView Swift package (color + alpha palette editor UI) and integrates it into the main HandDrawing app via popups, including updates to popup placement/stacking and palette selection behavior.

Changes:

  • Introduces the PaletteEditView package with SwiftUI UI components, models, resources, and tests for color/alpha editing.
  • Integrates palette editing popups into HandDrawingSwiftMetal (new popup stacking order, close buttons, and improved hit-testing).
  • Updates brush/eraser palettes to support “reselect” interactions, new selectedIndex naming, and source protocols for palette edit views.

Reviewed changes

Copilot reviewed 45 out of 47 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
PaletteEditView/Tests/PaletteEditViewTests/Models/ColorPaletteStateTests.swift Adds unit tests for ColorPaletteState behavior and callbacks.
PaletteEditView/Tests/PaletteEditViewTests/Models/AlphaPaletteStateTests.swift Adds unit tests for AlphaPaletteState clamping and callbacks.
PaletteEditView/Sources/PaletteEditView/Resources/Images.xcassets/spectrum.imageset/Contents.json Adds spectrum picker image asset metadata.
PaletteEditView/Sources/PaletteEditView/Resources/Images.xcassets/grid.imageset/Contents.json Adds grid picker image asset metadata.
PaletteEditView/Sources/PaletteEditView/Resources/Images.xcassets/Contents.json Enables Swift asset symbol extensions for images.
PaletteEditView/Sources/PaletteEditView/Extensions/UIImage+Palette.swift Adds pixel sampling helper for picker images.
PaletteEditView/Sources/PaletteEditView/Extensions/UIColorExtensions.swift Adds palette-oriented color component helpers and types.
PaletteEditView/Sources/PaletteEditView/Commons/SliderWithStepper.swift Adds shared slider + stepper control used by editors.
PaletteEditView/Sources/PaletteEditView/Commons/GradientSlider.swift Adds gradient-backed slider (UISlider wrapper) UI.
PaletteEditView/Sources/PaletteEditView/Commons/BottomActionToolbar.swift Adds remove/duplicate toolbar for palette actions.
PaletteEditView/Sources/PaletteEditView/Commons/AlphaEditSection.swift Adds alpha editing section UI with actions.
PaletteEditView/Sources/PaletteEditView/Color/ViewItems/SegmentPicker.swift Adds segmented control for switching color picker modes.
PaletteEditView/Sources/PaletteEditView/Color/ViewItems/PickerImageView.swift Adds image-based color picking via drag gestures.
PaletteEditView/Sources/PaletteEditView/Color/ViewItems/HexColorRow.swift Adds hex display row for slider-based editing mode.
PaletteEditView/Sources/PaletteEditView/Color/Models/ColorPaletteState.swift Adds observable state for RGB+alpha editing and callbacks.
PaletteEditView/Sources/PaletteEditView/Color/Models/ColorPaletteSegment.swift Adds segment enum for grid/spectrum/sliders.
PaletteEditView/Sources/PaletteEditView/Color/Models/ColorPaletteColorSource.swift Adds protocol for external selected color/index sourcing.
PaletteEditView/Sources/PaletteEditView/Color/ColorSpectrumView.swift Adds spectrum-based color picker view.
PaletteEditView/Sources/PaletteEditView/Color/ColorSlidersView.swift Adds RGB slider-based color picker view.
PaletteEditView/Sources/PaletteEditView/Color/ColorPaletteEditView.swift Adds main color palette editor UI and synchronization logic.
PaletteEditView/Sources/PaletteEditView/Color/ColorGridView.swift Adds grid-based color picker view.
PaletteEditView/Sources/PaletteEditView/Alpha/Models/AlphaPaletteState.swift Adds observable state for alpha editing and callbacks.
PaletteEditView/Sources/PaletteEditView/Alpha/Models/AlphaPaletteAlphaSource.swift Adds protocol for external selected alpha/index sourcing.
PaletteEditView/Sources/PaletteEditView/Alpha/AlphaPaletteEditView.swift Adds main alpha palette editor UI and synchronization logic.
PaletteEditView/Package.swift Defines the new Swift package, targets, and resources.
PaletteEditView/.swiftpm/xcode/xcshareddata/xcschemes/PaletteEditView.xcscheme Adds shared Xcode scheme for the package/tests.
HandDrawingSwiftMetalTests/Views/Components/PopupView/PopupViewModelTests.swift Updates popup tests to match new PopupViewModel API.
HandDrawingSwiftMetalTests/Views/Components/Drawingtool/Models/EraserPaletteTests.swift Updates tests for selectedIndex and adds reselect coverage.
HandDrawingSwiftMetalTests/Views/Components/Drawingtool/Models/BrushPaletteTests.swift Updates tests for selectedIndex and adds reselect coverage.
HandDrawingSwiftMetal/Views/Components/PopupView/PopupViewModel.swift Adds stacking order, width/height API, and vertical clamping.
HandDrawingSwiftMetal/Views/Components/PopupView/PopupView.swift Adds placement parameter, optional close button, zIndex support.
HandDrawingSwiftMetal/Views/Components/PassthroughHostingView.swift Adds placement/close plumbing and topmost hit-testing logic.
HandDrawingSwiftMetal/Views/Components/Drawingtools/EraserPaletteView.swift Adds callback for reselect taps; switches to selectedIndex.
HandDrawingSwiftMetal/Views/Components/Drawingtools/BrushPaletteView.swift Adds callback for reselect taps; switches to selectedIndex.
HandDrawingSwiftMetal/Models/DrawingTools/EraserPaletteArchiveModel.swift Archives selectedIndex instead of index.
HandDrawingSwiftMetal/Models/DrawingTools/EraserPalette.swift Implements AlphaPaletteAlphaSource, adds reselect return value.
HandDrawingSwiftMetal/Models/DrawingTools/BrushPaletteArchiveModel.swift Archives selectedIndex instead of index.
HandDrawingSwiftMetal/Models/DrawingTools/BrushPalette.swift Implements ColorPaletteColorSource, adds reselect return value.
HandDrawingSwiftMetal/Models/CoreData/CoreDataEraserPaletteStorage.swift Updates Core Data save triggers and restore for selectedIndex.
HandDrawingSwiftMetal/Models/CoreData/CoreDataBrushPaletteStorage.swift Updates Core Data save triggers and restore for selectedIndex.
HandDrawingSwiftMetal/HandDrawingViewModel.swift Wires palette edit states to update palettes + renderer callbacks.
HandDrawingSwiftMetal/HandDrawingViewController.swift Adds palette edit popups and tap handling to show/hide editors.
HandDrawingSwiftMetal/HandDrawingPopupOverlayContentView.swift Passes placement/onClose to PopupView.
HandDrawingSwiftMetal/Extensions/UIColorExtensions.swift Changes viewBackground color computation.
HandDrawingSwiftMetal.xcodeproj/project.pbxproj Adds local SPM reference and links PaletteEditView product.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread PaletteEditView/Sources/PaletteEditView/Color/ColorPaletteEditView.swift Outdated
Comment thread PaletteEditView/Sources/PaletteEditView/Alpha/AlphaPaletteEditView.swift Outdated
Comment thread PaletteEditView/Sources/PaletteEditView/Extensions/UIColorExtensions.swift Outdated
Comment thread PaletteEditView/Sources/PaletteEditView/Extensions/UIImage+Palette.swift Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 44 out of 46 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (3)

PaletteEditView/Sources/PaletteEditView/Commons/BottomActionToolbar.swift:52

  • When onDuplicate is nil, the duplicate button is still enabled and tappable but does nothing. Consider disabling (or conditionally hiding) the button when its action is unavailable.
    PaletteEditView/Sources/PaletteEditView/Commons/BottomActionToolbar.swift:47
  • When onRemove is nil, the trash button is still enabled and tappable but does nothing. This is confusing for callers that rely on the default nil closures. Consider disabling (or conditionally hiding) the button when its action is unavailable.

This issue also appears on line 49 of the same file.
PaletteEditView/Sources/PaletteEditView/Color/ViewItems/PickerImageView.swift:25

  • This view relies on generated asset types/APIs (ImageResource, UIImage(resource:), Image(imageResource)). Those are not available on older iOS versions. Since PaletteEditView/Package.swift declares iOS 15 support, please either (1) bump the package platform requirement to the minimum OS that provides these APIs, or (2) replace the resource-loading with iOS 15-compatible UIImage(named:in:compatibleWith:) / Image(uiImage:) code paths guarded by availability.

Comment thread PaletteEditView/Sources/PaletteEditView/Extensions/UIImageExtensions.swift Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants