Skip to content

fix: show correct unit for acceleration vector label in BallAcceleration#314

Merged
mattqdev merged 1 commit into
physicshub:mainfrom
TechGenius-Karan:fix/acceleration-vector-unit-label
May 16, 2026
Merged

fix: show correct unit for acceleration vector label in BallAcceleration#314
mattqdev merged 1 commit into
physicshub:mainfrom
TechGenius-Karan:fix/acceleration-vector-unit-label

Conversation

@TechGenius-Karan
Copy link
Copy Markdown
Contributor

📘 Pull Request Template – PhysicsHub

Thank you for contributing to PhysicsHub!
Please complete the sections below to help us review your pull request efficiently.


🔍 Description

The drawLabel method in ForceRenderer hardcoded "N" (Newtons) as the unit suffix for all vectors. In BallAcceleration, the acceleration vector is drawn with F/m values (m/s²), so the label incorrectly displayed "Acceleration (X.XN)".

Added a unit option to drawLabel so callers can override the default "N". BallAcceleration now passes { unit: "m/s²" } to drawVector, fixing the label to correctly show "Acceleration (X.Xm/s²)".

Closes #BUG-016(if applicable)


✅ Checklist

Before requesting a review, please ensure that you have:

  • Verified that the project builds and runs locally (npm run dev)
  • Ensured no ESLint or TypeScript warnings/errors remain
  • Updated documentation, comments, or in-code explanations where needed
  • Verified responsiveness across devices (desktop, tablet, mobile)
  • Followed the CONTRIBUTING.md guidelines

🎨 Visual Changes (if UI-related)

IF CHANGES ARE RELATED TO SIMULATIONS PLEASE SEND A SHORT CLIP ABOUT IT
(OBLIGATORY)


📂 Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 📝 Documentation update
  • ♻️ Refactor / code quality improvement
  • 🎨 UI/UX enhancement
  • 🔒 Security improvement

🧩 Additional Notes for Reviewers

The drawLabel method in ForceRenderer hardcoded "N" (Newtons) as the
unit suffix for all vectors. In BallAcceleration, the acceleration
vector is drawn with F/m values (m/s²), so the label incorrectly
displayed "Acceleration (X.XN)".

Added a `unit` option to drawLabel so callers can override the default
"N". BallAcceleration now passes `{ unit: "m/s²" }` to drawVector,
fixing the label to correctly show "Acceleration (X.Xm/s²)".
@mattqdev mattqdev merged commit 870b82a into physicshub:main May 16, 2026
1 check 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.

2 participants