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

fix: support for floating numbers and large numbers on the slider #562

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

FabienArcellier
Copy link
Collaborator

@FabienArcellier FabienArcellier commented Sep 17, 2024

implement #561, improve #505

Peek 2024-09-17 06-40

The current component did not handle steps composed of decimals like 0.1 and 0.01. This PR adds support to permanently fix issue #225.

Decimal numbers can be quite large. The current implementation is of fixed size. The CSS code is modified so that the size of the popover is dynamic.

* feat: add support for floating number
* feat: add dynamic size on slider
@FabienArcellier FabienArcellier force-pushed the 561-support-for-floating-numbers-and-large-numbers-on-the-slider branch from 5d33935 to a1960c0 Compare September 17, 2024 04:37
@FabienArcellier FabienArcellier added the bug Something isn't working label Sep 17, 2024
@FabienArcellier FabienArcellier marked this pull request as ready for review September 17, 2024 05:00
Comment on lines +67 to +70
const displayValue = computed(() => {
const precision = Math.ceil(-Math.log10(props.step));
return model.value.toFixed(precision);
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use two computed values, because it avoids to re-compute precision when value change

Suggested change
const displayValue = computed(() => {
const precision = Math.ceil(-Math.log10(props.step));
return model.value.toFixed(precision);
});
const precision = computed(() => Math.ceil(-Math.log10(props.step)));
const displayValue = computed(() => model.value.toFixed(precision.value));

@@ -190,6 +185,7 @@ function handleMouseDown(initialEvent: MouseEvent) {
top: 0;

transition: box-shadow ease-in-out 0.5s;
transform: translateX(-50%);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well seen, I didn't think about using this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants