Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Great job on implementing the spider movement and boundary checks! Your solution is very close to complete.
However, I'm requesting a change because the spider's size is hardcoded. A key requirement is that the code must work for a spider of any size without hardcoded values. This is also causing the automated tests to fail, as the spider isn't being centered correctly on the click.
To fix this, you should get the spider's dimensions dynamically from the DOM element. You can use spider.offsetWidth and spider.offsetHeight to get its width and height. Then, use these values to calculate the correct centered position, for example:
const newLeft = event.clientX - spider.offsetWidth / 2;Once you make this change, your solution should pass all the requirements. 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
| const spider = document.querySelector('.spider'); | ||
| const wall = document.querySelector('.wall'); | ||
|
|
||
| const spiderSize = 50; |
There was a problem hiding this comment.
The task requires the code to work with spiders of any size and avoid hardcoded values. Instead of 50, you should get the spider's size dynamically from the DOM element. Properties like spider.offsetWidth or spider.getBoundingClientRect().width can be used for this.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Sorry, the pull request review was unsuccessful for the following reasons:
Warning
No changes were made in the pull request since the last review. Please make sure that you have added files to the pull request and committed the changes.
[CODE: NCM]
If the issue is within your control, please address it.
The next review attempt will automatically launch in about 1 hour.
If you believe this is an error or need assistance, please contact the support team.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
While you've done a great job addressing the previous feedback, some changes are needed as the automated tests are failing due to an issue with the spider's positioning. The spider's center is not correctly aligning with the cursor on click.
To fix this, you need to account for the spider's own dimensions in your position calculation. After getting the click coordinates from event.clientX and event.clientY, you should subtract half of the spider's offsetHeight and offsetWidth respectively. This will ensure the spider is perfectly centered on the cursor.
Here's an example of the logic:
const newTop = event.clientY - spider.offsetHeight / 2;
const newLeft = event.clientX - spider.offsetWidth / 2;Please adjust your calculation, and the tests should pass. Keep up the good 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
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Excellent work on this task! Your code is clean and correctly uses dynamic properties like offsetWidth instead of hardcoded values. I am approving this solution as an educational override to help you progress, but please note that the automated tests have detected a small issue with the spider's final positioning.
The tests indicate the spider isn't perfectly centered under the cursor. This is a common challenge and is often fixed by adjusting the final coordinates. To fix this, try subtracting half of the spider's width from the left position and half of its height from the top position. You are very close to a perfect solution, keep up the great effort!
✨ 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
Anton-Kuchmasov
left a comment
There was a problem hiding this comment.
Hey, to get your solution approved, you should pass all tests - it's mandatory.
If you're stuck, feel free to ask help in fe_chat
No description provided.