0
How can I prevent the rectangle from moving out of my canvas.....
How...? Suggest me an idea... https://code.sololearn.com/WJlw8ql2lJ2d/?ref=app
5 Réponses
+ 2
You can use if statement to move only if it doesn't pop out. :
https://code.sololearn.com/W03R9BDAGnFn/?ref=app
You have written the wrong names for left and right. :-D
0
Thank you..
Is there any alternative
0
Arnesh
I can't understand the code,sorry.
Can you please explain what is getBoundingClientRect,
Or suggest me another alternative..
0
Get Bounding Client rect returns an object with an element dimension, position, etc.
It returns the current position, size, etc. Not the css.
https://code.sololearn.com/W2uo8W0y8MLV/?ref=app
0
Ok