moveable icon indicating copy to clipboard operation
moveable copied to clipboard

Cursor styling could be improved

Open Unruly-Coder opened this issue 1 year ago • 3 comments

Environments

  • Framework name:
  • Framework version:
  • Moveable Component version:
  • Testable Address(optional):

Description

Css variable could be used to pass rotation value to the css layer. This approach allows for precise control over cursor styling, including the rotation cursor

When specifying a viewContainer, cursor styling is applied to this container. Tt currently exhibits an issue where these styles are only added after the initial pixel drag. This results in cursor flickering when fast dragging occurs. To improve this behavior, CSS classes could be added immediately upon mouse button down, eliminating the flickering issue associated with the first pixel drag.

Unruly-Coder avatar Oct 08 '23 06:10 Unruly-Coder

@Crazy-Ivan

The rotation cursor is made of SVG for each 15 degree angle. So, it is actually difficult to use css variables.

And I will consider adding a class at the start point.

Thank you :)

daybrush avatar Oct 09 '23 04:10 daybrush

@daybrush ah yes you are right, that would not work. However the variable could contain entire svg code, like www.tldraw.com did. Still it would be nice to have possibility to setup own cursor images. That could be achieved by allowing to pass function which will return return data/svg string. Anyway those are just suggestion :) Thank you!

Unruly-Coder avatar Oct 09 '23 06:10 Unruly-Coder

@Crazy-Ivan

Looks like good code.

It seems like this is also possible. thanks.

--cursor-degree120: url(...);


cursor: var(--cursor-degree120);

daybrush avatar Oct 09 '23 06:10 daybrush