Giter Club home page Giter Club logo

dial's Introduction

Rotary Dial

A Rotary Dial for input numbers.

RotaryDial

Live version here | Alternative link here

How to use it

Click / Touch the disc and drag it until the arrow. When the number reaches the arrow, it will turn red, then let go and that's your number.

How to use it on your web app

Include the RotaryDial.js file.

<script src="RotaryDial.js"></script>

Then create a new RotaryDial

const rd = new RotaryDial();

Creating a callback is easy, just define what your function will do with the number it receives from the RotaryDial.

const func = function(number){
	alert( number )
}

const rd = new RotaryDial({callback: func});

By default the RotaryDial has the console.log function as the callback.

Documentation

The RotaryDial accepts a configuration object on its constructor. The most import parts are the size and the callback. The size will determine the size of your rotary dial menu, and the callback determines which function will be called when a number is selected. Besides that, there are some color configurations you can fiddle with.

size - The size of the menu. Default 400px

callback - The function that will be called when a number is selected. Default console.log

discFillColor - The disc color.

discStrokeColor - The disc border color.

circlesFillColor - The circles (where the numbers are displayed) color.

circlesStrokeColor - The circles (where the numbers are displayed) border color.

circlesHighlightColor - The color that a circle will be displayed when a number is selected.

textFillColor - The text color.

textStrokeColor - The text border color.

arrowFillColor - The arrow color.

arrowStrokeColor - The arrow border color.

dial's People

Contributors

hadalin avatar jeanlange avatar thewarpaint avatar victorqribeiro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

dial's Issues

Live version on GitHub Pages

The live version doesn't work as the server doesn't respond; this is likely to the HN hug of death. Have you considered using GitHub Pages to deploy your HTML code, including this website?

please add letters

How am i to dial 1-800-Dog-Poop (for all your dog poop scooping needs) ? Are you going to make me count letters out by threes... like an ANIMAL?!?!
1 abc
2 def . Oh... 2
1 abc
2 def
3 ghi
4 jkl
5 mno Yes! 5
etc...

should not need to keep mouse/button press in hole

This is a cool hack but it doesn't feel right because it's too hard to use. As #4 says, the finger stop is essential.

It would also help if the dialing weren't so fussy about keeping the "finger" on the hole, since the physical device feels so different. Instead, all that should be necessary is a button press on the right number, and then rotation with no need to stay on the hole as it turns. Obviously in real life the finger must stay in the hole, but on the screen there is no way to do that, and forcing the user to do it makes it too hard to use. Once the number is known by the press, just let the user rotate the mouse around the center, without worrying about radius, and then lock up the rotation once that number hits the stop. If you do that, the feeling will be as close as it can be.

Finger stop

This is so cool:-) Have you considered adding a finger stop? With a callback to add haptic feedback when it is reached?

No sound

Rotary dials have such a cool sound I still hear them in my head. Adding them to this component would be a crazy good improvement :)

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.