pxt-arcade icon indicating copy to clipboard operation
pxt-arcade copied to clipboard

80, 60 doesn't show on the center of the screen when using the slider

Open kiki-lee opened this issue 3 years ago β€’ 2 comments

I'm not generally OCD, but this is bothersome. If it's not accurate, is it worth having?

Screenshot by Dropbox Capture

kiki-lee avatar Nov 16 '22 00:11 kiki-lee

Also bottom right corner seems to be 157x113

Image

abchatra avatar Mar 12 '25 20:03 abchatra

Recommendation for Triage

Issue Type: bug

Status: info-complete

Label(s): field editor, blocks

Duplicate Issue(s): No duplicate issue found

Likely Related: No related issue found

Suggested Priority: P3

Complexity: low

Copilot Agent Ready: βœ… Yes

Recommendations for Assignee

Analysis

This is a UI/UX bug in the position field editor where the center position indicator displays "80, 60" instead of the mathematically correct center coordinates when using the slider. The Arcade screen is 160x120 pixels, so the center should be at (80, 60), but the issue reporter notes that the visual indicator doesn't align with the actual center point on the screen. A follow-up comment confirms the bottom-right corner shows as 157x113 instead of 159x119, suggesting a rounding or off-by-one calculation error in the position field editor's coordinate mapping between the visual display and actual pixel values.


Duplicate & Related Issues

Duplicates:

  • No duplicates found via semantic search

Related Issues:

  • No closely related issues found

Location Hints

The position field editor is implemented in pxt-core (microsoft/pxt repository), not in pxt-arcade:

  • ../pxt/pxtblocks/fields/field_position.ts - Core implementation of the FieldPosition class that renders the visual position picker with slider and crosshairs. The bug is likely in the setPos() function (lines ~103-143) or getXY() function where coordinates are mapped between display pixels and actual screen coordinates. The scaling calculation uses x / width * this.params.screenWidth which may need rounding adjustments.

Note: The default screen dimensions are set to 160x120 (lines 26-27), matching Arcade's screen size.


Next Steps

Can assign to Copilot Coding Agent: βœ… Yes, ready as-is

Reasoning: The issue has clear reproduction steps (use the position slider to select center), expected behavior (should show 80, 60 at center and 159, 119 at bottom-right), and specific file location. The fix likely involves adjusting the rounding logic in the coordinate mapping calculations to ensure proper centering and boundary values. This is a well-scoped, low-complexity bug fix suitable for automated resolution.

πŸ΄β€β˜ οΈ Ahoy! This treasure was crafted by pxt-arcade Issue Triage Assistant fer issue #5387 πŸ—ΊοΈ

github-actions[bot] avatar Dec 08 '25 17:12 github-actions[bot]