adafruit / Adafruit_CircuitPython_HID

USB Human Interface Device drivers.
MIT License
377 stars 105 forks source link

`Mouse.move` duration and easing parameters #119

Closed michalpokusa closed 1 year ago

michalpokusa commented 1 year ago

⭐ Added:

🪛Fixes:

michalpokusa commented 1 year ago

I think is an interesting addition to functionality. However, I have reservations about adding it directly to the library:

  1. We try to keep this library as small as possible, because it's used on or frozen into boards with very low memory. For example, non-US keyboard layouts are in an external library. So additions to functionality might better be done as an external library that subclasses Mouse or just wraps the call to move().
  2. A non-zero duration will cause the move(0 to delay for that amount of time. Thought this might make sense in some use cases, in others it will prevent handling other input while the delay is happening. Again, this might be done externally to the library.

Thanks for replying so quickly.

  1. Do you have a specific external library in mind, or are you talking about forking and creating a separate lib from this one?
  2. I treat this similarly to KeyboardLayput.write which also blocks for the time it needs for writing the whole string, which is highly connected to the length of the text. It would be possible to make it an async function but this would be a breaking change, and not consistent with the rest of library.
dhalbert commented 1 year ago
  1. Do you have a specific external library in mind, or are you talking about forking and creating a separate lib from this one?

Not a fork, but an addition. Or add code in examples that illustrates the use case which the user can just copy and use.

What is the use case that inspired this addition?

michalpokusa commented 1 year ago
  1. Do you have a specific external library in mind, or are you talking about forking and creating a separate lib from this one?

Not a fork, but an addition. Or add code in examples that illustrates the use case which the user can just copy and use.

What is the use case that inspired this addition?

I was making an extension that provided ability to move mouse curser over a specified path, in my case a SVG path, specifically a series of quadratic bezier curves, for it to work, the duration is not necessary, but with it I was able to create pretty "animations", where mouse draws in real time essentially any image defined using bezier curves.

Although my path moving might be too specific for a lib feature I figured taht maybe the duration alone would be a good candidate for addition.