Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: range, add reference point to start range slider at #24348

Closed
3 tasks done
sachingarg05 opened this issue Dec 8, 2021 · 9 comments
Closed
3 tasks done

feat: range, add reference point to start range slider at #24348

sachingarg05 opened this issue Dec 8, 2021 · 9 comments
Labels
package: core @ionic/core package type: feature request a new feature, enhancement, or improvement

Comments

@sachingarg05
Copy link
Contributor

sachingarg05 commented Dec 8, 2021

Prerequisites

Describe the Feature Request

ion-range shows an active bar which starts from extreme left (0 value) to current knob location.

Very often ion-range needs to have its floor value (or base value) in the center or somewhere else. In these cases, it is required for the active bar to show between the floor value and current knob value, instead of always starting from 0 (extreme left).

Describe the Use Case

A slider to reduce or increase brightness of an image.

Describe Preferred Solution

Adding a 'floor' value attribute for ion-range, and then updating the left/right calculation of active bar to start from 'floor' value to current knob value (instead of always starting from 0 to current knob value)

Describe Alternatives

No response

Related Code

/main/core/src/components/range/range.tsx, line 424

    const barStart = `${ratioLower * 100}%`;
    const barEnd = `${100 - ratioUpper * 100}%`;

These calculations will need to be updated to start from a floor value (or base value) to current knob value, instead of always starting from 0 (ratioLower is always zero for single knob ion-range).

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Dec 8, 2021
@liamdebeasi
Copy link
Contributor

Thanks for the issue. Can you provide a code sample of the issue you are running into to help me better understand your use case?

@liamdebeasi liamdebeasi added the needs: reply the issue needs a response from the user label Dec 8, 2021
@ionitron-bot ionitron-bot bot removed the triage label Dec 8, 2021
@sachingarg05
Copy link
Contributor Author

Consider this ion-range with min and max of -100 and 100

<ion-range color="dark" [min]="-100" [max]="100" [value]="0" [snaps]="10" [step]="10" mode="md" pin="true">

image

Side note: Maybe the 'tick' mark at 'floor value' location can also be slightly 'heavier' than other tick marks.

@ionitron-bot ionitron-bot bot added triage and removed needs: reply the issue needs a response from the user labels Dec 9, 2021
@liamdebeasi
Copy link
Contributor

Thanks! That makes sense. Do you happen to have examples of other applications/libraries that offer this behavior?

@liamdebeasi liamdebeasi added the needs: reply the issue needs a response from the user label Dec 9, 2021
@ionitron-bot ionitron-bot bot removed the triage label Dec 9, 2021
@sachingarg05
Copy link
Contributor Author

ngx-slider has this option, by setting property 'showSelectionBarFromValue'

On their demo page, check the demo for "Slider with visible selection bar from specified value":

https://angular-slider.github.io/ngx-slider/demos#selection-bar-from-value-slider

@ionitron-bot ionitron-bot bot added triage and removed needs: reply the issue needs a response from the user labels Dec 9, 2021
@liamdebeasi liamdebeasi changed the title feat: Add a 'floor' value attribute for ion-range. Active bar should start from 'floor' value to current value (instead of always starting from 0) feat: range, add reference point to start range slider at Dec 9, 2021
@liamdebeasi liamdebeasi added package: core @ionic/core package type: feature request a new feature, enhancement, or improvement labels Dec 9, 2021
@ionitron-bot ionitron-bot bot removed the triage label Dec 9, 2021
@liamdebeasi
Copy link
Contributor

Thank you! I discussed with the team and we think this would be a good feature to add to Ionic.

sachingarg05 added a commit to sachingarg05/ionic-framework that referenced this issue Dec 14, 2021
…24348

Added property barActiveStart. bar-active is shown between `barActiveStart` and knob for single knob range-bar. By default `barActiveStart` is set to `min` (Minimum integer value of the range).
@sachingarg05
Copy link
Contributor Author

Have created a pull request that implements this: #24399

@liamdebeasi
Copy link
Contributor

Thanks for the issue. This has been resolved via #25598 and the feature will be available in an upcoming release of Ionic.

@sachingarg05
Copy link
Contributor Author

Thanks 👍

@ionitron-bot
Copy link

ionitron-bot bot commented Aug 26, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Aug 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: core @ionic/core package type: feature request a new feature, enhancement, or improvement
Projects
None yet
Development

No branches or pull requests

2 participants