hcp-uw / syntext

website for practicing your typing
5 stars 0 forks source link

Cursor #20

Open karhu1 opened 1 year ago

karhu1 commented 1 year ago

The text area issue now needs a cursor! This should move with the active word being typed and be in front of the letter that we are looking to type.

Adding smoothing to the movement should not be a concern at the moment, but if an easy implementation is found, maybe try it out!

Part of #2

elimelt commented 1 year ago

Cursor still needs a little bit of work, but it has come along nicely.

Major issues

Minor issue

karhu1 commented 1 year ago

Major issues that were resolved:

Still to be fixed:

karhu1 commented 1 year ago

Small progress update...

Issues that were resolved:

Issues to be fixed:

elimelt commented 1 year ago

Currently the biggest issue is that when the user changes their window size, the cursor position doesn't get updated as well. This leads to the cursor being positioned incorrectly when they click on the input.

We really just need to figure out a way to get the cursor to reposition itself when the user clicks on the input box. Perhaps you could use an event listener on the input box? Or maybe directly update the cursor position in the window event listener.

karhu1 commented 1 year ago

Issues that were resolved:

Because there are so many edge cases that needed to be handled with the cursor, I added comments at the top of each case in the Cursor.js file to make it easier to understand. We might revisit this issue later if problems come up, but for now the cursor seems stable.

elimelt commented 1 year ago

This issue should remain open until we've fully tested the resolution.

There is a site-breaking bug in production right now that causes the screen to go blank. image

Also, the cursor is indeed hidden while I resize the window, but the positioning is still off by quite a lot after clicking on the text-area again. image

karhu1 commented 1 year ago

Issues that were resolved:

This is bad design as cursorPos does not exist when we reach an empty line. This fix should only be a temporary fix, and should act as a band aid until we revisit TextArea.