-
-
Notifications
You must be signed in to change notification settings - Fork 496
Add Math.round for positions and dimensions #454
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
Conversation
Thanks for contributing this, I would be happy to merge it. Before, you need to fix the unit tests and generate the dist files. You can read the CONTRIBUTING.md file to help you if you want. |
…e correct position for labels for single slider with boundPointerLabels=false"
…e correct position for labels for single slider with boundPointerLabels=false"
Current coverage is 100% (diff: 100%)@@ master #454 diff @@
====================================
Files 1 1
Lines 921 921
Methods 0 0
Messages 0 0
Branches 0 0
====================================
Hits 921 921
Misses 0 0
Partials 0 0
|
Done. I did all that you asked of me. Please check difference. |
@@ -981,7 +981,7 @@ | |||
var tick = { | |||
selected: self.isTickSelected(value), | |||
style: { | |||
transform: translate + '(' + position + 'px)' | |||
transform: translate + '(' + Math.round(position) + 'px)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this one is useless because you already patched the valueToPosition
method.
var expectedDimension = Math.floor(helper.slider.valueToPosition(6)), | ||
actualDimension = Math.floor(helper.slider.selBar[0].getBoundingClientRect().width); | ||
var expectedDimension = helper.slider.valueToPosition(6), | ||
actualDimension = helper.slider.selBar[0].getBoundingClientRect().width + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to add 1? It seems weird...
I removed Math.round from valueToPosition method, because of weird code in tests. So now, after obtaining value, you decide by yourself use Math.round or Math.floor. Please check again. |
Thanks for this. Do the tests pass if you put |
No, some tests fail. Therefore, I propose to leave as is. |
…slider # Conflicts: # dist/rzslider.min.css # dist/rzslider.min.js
Thanks for rebasing. |
Released via 5.8.7 |
Thanks for your activity |
By working with this library angularjs-slider library I ran into a problem, that some positions and dimensions sometimes set as 111.333px (not integer value) and browsers render my .svg images differently (sometimes blurry). See the screenshot:
https://drive.google.com/file/d/0Bxtv10NlSOEbM1d5cHZ4VnJwTWM/view?usp=sharing
So, I suggest to add Math.round calls in some places. The decision forces browsers work equally and solves my problems.