mpizenberg / elm-pointer-events

Mouse, Touch, Pointer, Wheel and Drag events in elm
https://package.elm-lang.org/packages/mpizenberg/elm-pointer-events/latest
Mozilla Public License 2.0
68 stars 8 forks source link

Mouse.clicks #9

Closed rtfeldman closed 6 years ago

rtfeldman commented 6 years ago

I'd like to use both this package as well as elm-lang/mouse for Mouse.clicks.

This is currently impossible because both packages expose a module called Mouse, so as soon as I install both and write import Mouse, I get an error because it's an ambiguous import (due to https://github.com/elm-lang/elm-compiler/issues/1625).

elm-lang/mouse only exposes 4 subscriptions. What do you think of adding elm-lang/mouse as a dependency to this library and exposing them as well?

mpizenberg commented 6 years ago

Thanks for the remark! I've always played with elm apps having full control over DOM so didn't realized this unfortunate name collision. I don't mind re-exposing those.

Regarding the API, I've used the tuple convention with floats ( Float, Float ) in the rest of the package. In elm-lang/mouse, it's a record of integers that is used { x : Int, y : Int }. Do you think I should

(1) simply expose as-is, noting that this is here mostly to avoid namespace collision (2) Sub.map the subscriptions to present at as a ( Float, Float )

I'm more for (1) since (2) would make no sense if I don't return a Mouse.Event anyway.

mpizenberg commented 6 years ago

Actually I don't know how to expose them. I also cannot import elm-lang Mouse module without having a compiler error ...

rtfeldman commented 6 years ago

Ha, good point!

I guess we're stuck then.

On Fri, Apr 6, 2018, 1:15 PM Matthieu Pizenberg notifications@github.com wrote:

Actually I don't know how to expose them. I also cannot import elm-lang Mouse module without having a compiler error ...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mpizenberg/elm-pointer-events/issues/9#issuecomment-379318233, or mute the thread https://github.com/notifications/unsubscribe-auth/ABCxwC4PKrxK3cVnDwwZ6kdaSClgwM6zks5tl6KjgaJpZM4TKTd4 .

mpizenberg commented 6 years ago

It seems that Mouse doesn't exist anymore in the new elm and that the only possible collision left is with zwilias/elm-touch-events Touch module. Do you know if there is a mechanism in 0.19 to prevent those kind of collisions? Otherwise, I will probably try to find a fitting prefix namespace.

mpizenberg commented 6 years ago

Modules are now all namespaced under Html.Events.Extra... so there are no conflicts anymore. More info in changelog.