I'm trying to customize the cursor pointer so I used a hook to get the mouse position and then I placed the component in absolute in that coordinates.
Here a working code.
There is a flag (USE_PNG
) that you can toggle to test if to use a React component or a png (I would prefer the first idea but I'm interested also to the second one if it has some advantages).
USE_PNG = false
-> use a React componentAs you can see, the code is very simple and it works enough but it has some problems:
- when the mouse is on the left side of the window, the left half of the cursor is cut off, but when is on the right then it's not and the horizontal bar appears
- it seems not so fluid. Are there some tricks I can use to optimize the code?
USE_PNG = true
-> use a pngI tried also to use a png (simpler maybe) but I can't see the cursor anymore
What's the problem?
I use a ref instead of a state and performance have improved. The first problem remains: the horizontal and vertical scroll when the cursor is on the right or bottom side of the window
I don't think simply hiding the scrollbars is an optimal solution because the window size has changed and the user can scroll. I think we need to find a cleaner solution.