francejs / effroi

Codename : effroi
MIT License
27 stars 6 forks source link

Device API internals #8

Open nfroidure opened 11 years ago

nfroidure commented 11 years ago

When moving the mouse cursor like this:

mouse.moveTo(element);

It is possible that "element" is in fact currently not in the viewport, so, the cursor actually cannot go over the element without scrolling first.

Currently, it automatically scroll to ensure the cursor can be put over the element: https://github.com/francejs/effroi/blob/87af7a7ffd1768831bef1399338df16058b4968e/src/devices/mouse.js#L98 Is it the right behavior or would you prefer the API to throw an exception and let you manage scroll yourself?

The same kind of issue can be found with a mouse click. To be able to click an element, the cursor must first be placed over it. It is also done automatically right now: https://github.com/francejs/effroi/blob/87af7a7ffd1768831bef1399338df16058b4968e/src/devices/mouse.js#L45

It lead to an easyer to use API but it's a bit less flexible. Your opinion is very welcome!