Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

mdSlider: Allow non-linear slider values #623

Closed
WillsB3 opened this issue Nov 12, 2014 · 8 comments
Closed

mdSlider: Allow non-linear slider values #623

WillsB3 opened this issue Nov 12, 2014 · 8 comments
Assignees
Labels
for: internal contributor The team will address this issue and community PRs are not requested. type: enhancement
Milestone

Comments

@WillsB3
Copy link

WillsB3 commented Nov 12, 2014

Sometimes a slider may be required which does not have a linear scale for it's possible values. We have a use case where a slider represents the playback speed of a YouTube video where the available values are: 0.25, 0.5, 1, 1.25, 1.5, 2. This is not possible with the current angular-material implementation.

This is just one example, you could have a slider that required a logarithmic scale for instance.

It'd be nice if there was a way to explicitly determine the available steps of a slider. Alternatively, if it were possible to define a mapping of UI values to actual model values that might also be a solution.

@ThomasBurleson
Copy link
Contributor

One option is to support a step model attribute that supports a step data model for discrete sliders.

<md-slider ng-model='playRate' md-steps='[0.25,0.5,1,1.25,1.5, 2]' />

If the developer needs to control the ability to visually position the steps (on the track), the steps could be an array of {value:'',distance:''} objects [instead of numbers, as shown above]:

$scope.playOptions = [
  { value : 0.25, distance : 0.125 },
  { value : 0.5, distance : 0.25 },
  { value : 1.0, distance: 0.5 },
  { value : 1.25, distance : 0.625 },
  { value : 1.5, distance : 0.75 },
  { value : 2.0, distance: 1.0 }
];
<md-slider ng-model='selectedRate' md-steps='playOptions' />

@ThomasBurleson ThomasBurleson added this to the 0.8.0-rc1 milestone Nov 12, 2014
@plato-cambrian
Copy link

html5 input[type="range"] definesmin max step` attributes
http://html5tutorial.info/html5-range.php

On Wed, Nov 12, 2014 at 12:06 PM, Thomas Burleson [email protected]
wrote:

One option is to support a step model attribute that supports a step data
model for discrete sliders.

If the developer needs to control the ability to visually position the
steps (on the track), the steps could be an array of
{value:'',distance:''} objects [instead of numbers, as shown above]:

$scope.playBackSteps = [
{ value : 0.25, distance : 0.125 },
{ value : 0.5, distance : 0.25 },
{ value : 1.0, distance: 0.5 },
{ value : 1.25, distance : 0.625 },
{ value : 1.5, distance : 0.75 },
{ value : 2.0, distance: 1.0 }
];


Reply to this email directly or view it on GitHub
#623 (comment).

@WillsB3
Copy link
Author

WillsB3 commented Nov 12, 2014

@plato-cambrian I'm fully aware of that, but I don't believe Angular-Material is aiming to only support those features that HTML5 supports natively.

This issue was raised as it's a feature that could be supported to allow the angular-material slider to provide maximum flexibility.

@ThomasBurleson That's a pretty neat idea. Your suggestion would also allow us to support having a different "display value" to be rendered in the discreet bubble. In example use case above the values are 1, 1.25, 1.5 etc yet in the UI these are actually represented as "1x", "1.25x", "1.5x". We could easily support this by simply adding an extra key/value pair to $scope.playOptions object.

@plato-cambrian
Copy link

@wills bithrey I certainly agree that it would be great to implement custom
steps on a slider!

On Wed, Nov 12, 2014 at 2:08 PM, Wills Bithrey [email protected]
wrote:

@plato-cambrian https://github.com/plato-cambrian I'm fully aware of
that, but I don't believe Angular-Material is aiming to only support what
HTML5 supports natively.

This issue was raised as it's a feature that could be supported to allow
the angular-material slider to provide maximum flexibility.


Reply to this email directly or view it on GitHub
#623 (comment).

@ThomasBurleson ThomasBurleson modified the milestones: 0.8.0, 0.9.0 Jan 30, 2015
@marcysutton marcysutton modified the milestones: 0.10.0, 0.9.0 Apr 14, 2015
@ThomasBurleson ThomasBurleson changed the title Slider: Allow non-linear slider values mdSlider: Allow non-linear slider values Apr 28, 2015
@ThomasBurleson ThomasBurleson modified the milestones: Backlog, 0.10.0 Apr 28, 2015
@ThomasBurleson ThomasBurleson added the for: internal contributor The team will address this issue and community PRs are not requested. label Apr 28, 2015
@omidahourai
Copy link

+1

@ThomasBurleson ThomasBurleson modified the milestones: 0.11.0, Backlog Jul 6, 2015
@ThomasBurleson ThomasBurleson modified the milestones: 0.11.0, post-1.0 Jul 31, 2015
@mfdev1
Copy link

mfdev1 commented Aug 26, 2015

+1

1 similar comment
@mikcox
Copy link

mikcox commented Sep 1, 2015

+1

@zargold
Copy link

zargold commented Oct 1, 2015

I am working on this PR. I think I find it cleaner to have a separate directive for this as there so many differences especially since I'm not sure if my tailored use case will match others (I am told I need mine to be evenly split based on the custom steps rather than their value)...
e. g. [ 0-----3-----20-----497-----2000]. I'll be using the source code to make it and perhaps it won't be fully functional yet.

@ThomasBurleson ThomasBurleson modified the milestones: post-1.0 , Backlog Jan 5, 2016
@ThomasBurleson ThomasBurleson modified the milestones: Backlog, Deprecated Apr 20, 2016
kashyapkaki pushed a commit to kashyapkaki/material that referenced this issue May 10, 2023
…#645)

* fix(stack-blitz): add more configuration files to the template

allow the exported/downloaded project from StackBlitz to be functional
- move files into /src and /src/app to match a normal configuration
rename Stackblitz to StackBlitz
use StackBlitz logo to launch examples
use a relative URL for downloading `versions.json`
update Ivy fix for VersionPicker
log errors during app bootstrap in StackBlitz
switch StackBlitz examples to SCSS
fix lint warnings in deploy script
add ignores for Firebase

Fixes angular#623. Fixes angular#629. Relates to angular#642.

* migrate workspace for @angular/[email protected]
Decorates all declared undecorated provider classes with @Injectable

* feat: update to 9.0.0-next.x and enable Ivy rendering engine

add 9.0.0-next.0 to versions list
- point it to material2-docs-dev for now

* fix(ci): update docker image to latest CircleCI NodeJS LTS

the prior version used `[email protected]`
- @angular-devkit/[email protected] throws an error
  - Expected version ">= 1.13.0". Got "1.10.1"

* refactor(tools): convert deploy script from npm to yarn

re-enable Angular CLI's build-optimizer
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
for: internal contributor The team will address this issue and community PRs are not requested. type: enhancement
Projects
None yet
Development

No branches or pull requests

9 participants