Skip to content

Fix copy+paste of PegCurveGenerator always producing BrickCurveGenerator#33

Merged
IntelOrca merged 2 commits into
masterfrom
copilot/fix-copy-paste-peg-line
Mar 16, 2026
Merged

Fix copy+paste of PegCurveGenerator always producing BrickCurveGenerator#33
IntelOrca merged 2 commits into
masterfrom
copilot/fix-copy-paste-peg-line

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 16, 2026

CurveGenerator.Clone() was hardcoded to construct a BrickCurveGenerator regardless of the actual subtype, so copying a Peg Line Generator and pasting it would silently produce a Brick Line Generator instead.

Changes

  • CurveGenerator: Replace Clone() with a protected CloneTo(CurveGenerator) helper that copies BezierPath and base properties — shared by both subclasses.
  • PegCurveGenerator: Add Clone() override that constructs the correct PegCurveGenerator type.
  • BrickCurveGenerator: Add Clone() override that constructs the correct BrickCurveGenerator type.
// Before — in CurveGenerator, always wrong type:
public override object Clone()
{
    var copy = new BrickCurveGenerator(Level); // bug: hardcoded
    base.CloneTo(copy);
    copy.BezierPath = BezierPath.Clone();
    return copy;
}

// After — each subclass owns its clone:
// PegCurveGenerator:
public override object Clone()
{
    var copy = new PegCurveGenerator(Level);
    base.CloneTo(copy);
    return copy;
}
Original prompt

This section details on the original issue you should resolve

<issue_title>Copy+pasting Peg Line pastes Brick Line instead</issue_title>
<issue_description>When copying an unapplied Peg Line Generator, pasting it results in an identical Brick Line Generator instead. Not sure what's causing it but definitely a bit of a pain.

Image</issue_description>

Comments on the Issue (you are @copilot in this section)


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Co-authored-by: IntelOrca <1482259+IntelOrca@users.noreply.github.com>
Copilot AI changed the title [WIP] [ISSUE-123] Fix copying Peg Line to paste correct generator Fix copy+paste of PegCurveGenerator always producing BrickCurveGenerator Mar 16, 2026
Copilot AI requested a review from IntelOrca March 16, 2026 14:42
@IntelOrca IntelOrca marked this pull request as ready for review March 16, 2026 18:40
@IntelOrca IntelOrca merged commit 9314da8 into master Mar 16, 2026
0 of 3 checks passed
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.

Copy+pasting Peg Line pastes Brick Line instead

2 participants