Skip to content

add task solution v1#1706

Open
anari-a wants to merge 3 commits intomate-academy:masterfrom
anari-a:develop
Open

add task solution v1#1706
anari-a wants to merge 3 commits intomate-academy:masterfrom
anari-a:develop

Conversation

@anari-a
Copy link
Copy Markdown

@anari-a anari-a commented Apr 7, 2026

No description provided.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Hello! While your implementation is very close, I'm requesting a change because the automated tests are currently failing. The issue seems to be in how the spider's final position is calculated. To correctly center the spider on the cursor, you need to account for the spider's own dimensions. Right now, it appears the top-left corner is being placed at the click location, not the center.

Please adjust your calculation to subtract half of the spider's offsetWidth and offsetHeight from the click coordinates. This will ensure the spider is perfectly centered and should resolve the test failures. Keep up the great work!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Changes are needed to fix the click coordinate calculation, which currently breaks when the page is scrolled. The issue is in src/scripts/main.js: using e.clientX/e.clientY (viewport-relative) with offsetLeft/offsetTop (ancestor-relative) produces incorrect relative positions during scroll. To fix this, replace the current calculation with wall.getBoundingClientRect() to get the wall's position relative to the viewport, then compute the click offset correctly — for example: javascript const rect = wall.getBoundingClientRect(); const x = e.clientX - rect.left; const y = e.clientY - rect.top; This is a critical blocker because the spider interaction must work reliably regardless of scroll position, as required by the task. Your centering and boundary logic is otherwise excellent — just this scrolling behavior needs correction before approval.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread src/scripts/main.js
Comment on lines +7 to +8
const relX = e.clientX - wall.offsetLeft - wall.clientLeft;
const relY = e.clientY - wall.offsetTop - wall.clientTop;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This calculation for relative coordinates doesn't account for page scrolling. e.clientX/e.clientY are relative to the visible part of the page (the viewport), while offsetLeft/offsetTop are relative to an ancestor element and don't change when you scroll.

To make this work correctly when the page is scrolled, you need to find the wall's position relative to the viewport. The getBoundingClientRect() method would be very helpful here.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Excellent work resolving the scrolling issue with getBoundingClientRect! Your solution is much more robust now. I am approving this submission as an educational override to help you move forward, but it's important to address the issue revealed by the automated tests. The tests are failing because the spider isn't perfectly centered on the cursor. This happens because the calculation doesn't account for the spider's own dimensions. To fix this, you need to subtract half of the spider's width from the left position and half of its height from the top position. Great job on the progress you've made!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Copy link
Copy Markdown

@2pasha 2pasha left a comment

Choose a reason for hiding this comment

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

please deploy your app and add DEMO LINK to PR's descriptions

Image

and please pass all tests

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.

3 participants