Coder Social home page Coder Social logo

Comments (5)

rreusser avatar rreusser commented on May 30, 2024

Absolutely. I think I'd rather make this LogSlider than Slider({type: 'log'}). These things tend to bring in lots of corner cases and make other things (like default ranges) subtly incorrect or logic-branchy when it'd really be easier and more concise to just separate them. (In fact, I don't use control-panel's log slider because I think my implementation has a couple annoying bugs I just haven't bothered to fix 😬) What's your opinion, @marcofugaro?

from controls-state.

rreusser avatar rreusser commented on May 30, 2024

Alternatively, I maybe wouldn't mind a shorthand of type: 'log' with a more explicit way to specify it: mapping: Math.log, inverseMapping: Math.exp` so that you can just be explicit about exactly how it's mapped and perform your own mapping.

from controls-state.

marcofugaro avatar marcofugaro commented on May 30, 2024

That's a great idea! Way more flexible, so the default would be something like:

mappingFunction: x => x

Or just mapping like you said.

Also what do you mean by inverseMapping? For when the slider goes the inverse way?

from controls-state.

rreusser avatar rreusser commented on May 30, 2024

If you don't have a mapping that defines both directions, you can move a slider and convert that to a mapped value, but you won't be able to assign a value and set the slider position. In that sense it needs to be an invertible mapping. You might be able to solve that with Newton-Raphson or something, but it seems safest to just allow the user to specify the inverse mapping directly rather than guessing.

from controls-state.

marcofugaro avatar marcofugaro commented on May 30, 2024

Closed in #12 actually

from controls-state.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.