Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

MoveTo() method

Pre-release
Pre-release
Compare
Choose a tag to compare
@Laaouatni Laaouatni released this 12 Aug 21:32
· 151 commits to main since this release
68d1b03
  • a new method needs to be created called moveTo()

  • moveTo() get as paramters:

    • an object of some data (similar to CSS):

      • left or right:

        • 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 position
          • right 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)
      • top or bottom:

        • 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 position
          • top 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)

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 called Specificy in CSS (you can search about it in MDN)

try create a separate class for the specificy logic.

⚠️ for now make this only relative

but in the future, maybe we can use absolute if we create G54 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)

  • all the files should be tested

    • at least for now with console.log()s manually

      then I think we can use vitest or jest external library to test (but is not planned at least at the moment)
  • the tests need to have also a for loop testing for the moveTo() method

  • also put a boolean var that if is true then it make the tests start, or if are false to not start