MoveTo() method
Pre-release-
a new method needs to be created called
moveTo()
-
moveTo()
get as paramters:-
an object of some data (similar to CSS):
-
left
orright
:- this need to be similar to how the
position
CSS property work in CSS language (but in javascript) - change Position on X axis:
left
add the number as value to the current X positionright
subtract the number as value to the current X position
- if there are 2 contrasting keywords such as
{left: 10, right: 20}
:- ✅we must take the last key into consideration
- ❌without using the first (as happens in the CSS language)
- this need to be similar to how the
-
top
orbottom
:- this need to be similar to how the
position
CSS property work in CSS language (but in javascript) - change Position on Y axis:
bottom
add the number as value to the current X positiontop
subtract the number as value to the current X position
- if there are 2 contrasting keywords such as
{top: 10, bottom: 20}
:- ✅we must take the last key into consideration
- ❌without using the first (as happens in the CSS language)
- this need to be similar to how the
-
-
why we want to use the CSS naming convention in our project?
this is because it will make the program easier to understand for who know already CSS.
also the concept of last get used, is calledSpecificy
in CSS (you can search about it in MDN)
try create a separate class for the specificy logic.
⚠️ for now make this onlyrelative
but in the future, maybe we can useabsolute
if we createG54
class (but isn't in the plan for now)
- for implementing relatively
Z
position moving:- use a key in the object called
zIndex
that seems more readible to me. - same logic as the previous ones, but zIndex don't have constrasting keywords (so it will be easy to implement)
- use a key in the object called
-
all the files should be tested
- at least for now with
console.log()
s manually
then I think we can usevitest
orjest
external library to test (but is not planned at least at the moment)
- at least for now with
-
the tests need to have also a
for
loop testing for themoveTo()
method -
also put a boolean var that if is
true
then it make the tests start, or if arefalse
to not start