Skip to content

Support circle editing and non-rectangular collider previews - #3773

Draft
nighca wants to merge 1 commit into
goplus:devfrom
nighca:issue-3772
Draft

nighca wants to merge 1 commit into
goplus:devfrom
nighca:issue-3772

Conversation

@nighca

@nighca nighca commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

Closes #3772

The pivot/collision editor previously drew every collider as a rectangle and unconditionally saved it with setCollisionShapeRect(). Existing circle, capsule, and polygon configurations could therefore be displayed incorrectly and overwritten on save.

Behavior

SPX physical collider Preview Shape editing
rect Rectangle Move and resize independently
circle Circle Move center and resize with one radius
capsule Vertical capsule Preview only
polygon Closed polygon using configured vertices Preview only
auto Nontransparent costume bounds Explicitly editing the bounds creates a rectangle
none No collider Pivot editing only

Pivot-only saves preserve shape type and parameters. Collision offsets compensate for costume pivot changes so explicit colliders stay aligned with the artwork. Trigger configuration remains separate and is preserved.

Editing uses costume coordinates, after bitmapResolution and before sprite size and rotation. A separate read-only preview applies the initial size, heading, rotation style, and costume faceRight; circle information includes the resulting world diameter. Preview fitting includes offset shape bounds. For example, radius 10 at size 2 displays a world diameter of 40 without treating image pixels as collider units.

The geometry follows the pinned SPX 4.0.1 implementation: shape application and offsets, rotation and flip rules, and separate collision/trigger configuration.

Validation

  • 44 tests passed across collider geometry/save tests, component interaction tests, Sprite model tests, and editor history tests.
  • Full GUI TypeScript and ESLint checks passed; changed files pass Prettier and git diff --check.
  • Real Chrome verification using a temporary local page mounting the actual editor component, Sprite model, and History: circle drag/resize/save/reopen/undo/redo; rectangle drag and nonuniform resize; capsule/polygon pivot-only saves; automatic shape preservation and explicit conversion; none preservation; rotated and mirrored previews. The fixture used raw anchor (100, 75), bitmap resolution 4, radius 10, and size 2. The temporary page is excluded from this PR and no cloud projects were modified.

Limits

  • Capsule/polygon shape editing and shape-type selection are not included.
  • The preview uses the default costume and initial sprite properties, centered for inspection. It is not a running-game collision overlay, a stage clearance measurement, or a simulation of code-driven shape/transform changes.
  • This does not add trigger editing or change physical/trigger collision semantics.

@codecov

codecov Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.78788% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.40%. Comparing base (cc80cb7) to head (d91db9d).

Files with missing lines Patch % Lines
.../components/editor/sprite/PivotCollisionEditor.vue 69.23% 9 Missing and 11 partials ⚠️
gui/src/components/editor/sprite/collider.ts 97.05% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #3773      +/-   ##
==========================================
+ Coverage   59.96%   60.40%   +0.44%     
==========================================
  Files         772      773       +1     
  Lines       27728    27780      +52     
  Branches     5231     5264      +33     
==========================================
+ Hits        16627    16781     +154     
+ Misses       9586     9465     -121     
- Partials     1515     1534      +19     
Flag Coverage Δ
gui 59.89% <78.78%> (+0.45%) ⬆️
tools-ai 79.61% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
gui/src/components/editor/sprite/collider.ts 97.05% <97.05%> (ø)
.../components/editor/sprite/PivotCollisionEditor.vue 78.57% <69.23%> (+77.75%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch was successfully deployed

1 active deployment
Preview – builder — d91db9d0 Deployed Nov 13, 2026 by vercel[bot]
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.

Preview and safely edit non-rectangular sprite colliders

1 participant