georgefst / monpad

A fully-customisable web-based gamepad, designed to be used from smartphones.
BSD 3-Clause "New" or "Revised" License
39 stars 5 forks source link

Add generic number/text input box #30

Closed ortk95 closed 3 years ago

georgefst commented 3 years ago

Made a start in 1ada83e, but:

georgefst commented 3 years ago

Checkboxes always emit "on", so we always get InputBool _ True

It's actually worse. They seem to always echo the last event. So if, say, we update a layout so that a number input changes to a checkbox, then the checkbox starts emitting numbers (which we fail to decode to Bools, so we don't send an update).

georgefst commented 3 years ago

It would be nice to just call the inputType field "type". We can't do that in Haskell or Elm because it's a keyword, but there should be some workaround for JSON and Dhall.

There may be no nice way to do this. We can use _type and add FieldLabelModifier (StripPrefix "_") to Opts.JSON (and a similar option is available for Dhall), but _type is not a valid record name in Elm. I can't even find a spec of exactly what names are valid.

georgefst commented 3 years ago

Ok. I don't care about the last two, and I've opened #37 to track the first (though we did make the text stylable in 6c6d2220b0399406f68ea25eb941f91b5a3ee954).