@sedoo/unidoo 0.0.51 → 0.0.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sedoo/unidoo",
3
- "version": "0.0.51",
3
+ "version": "0.0.52",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "build": "vue-cli-service build --target lib --name unidoo src/plugin.js",
@@ -338,16 +338,18 @@ export default {
338
338
  initGraduation(){
339
339
  let result = [];
340
340
  if(this.graduation){
341
- const size = this.sliderSize;
342
-
343
341
  const gradsLength = this.graduation.length;
344
342
  let delta = 1;
345
- if(size && gradsLength){
343
+ if(this.sliderSize && gradsLength && this.graduation[0]){
346
344
  const firstGrad = this.graduation[0].length * 9; // nb chars * number of pixels for 1 character
347
- let exceed = Math.ceil(this.sliderSize - (gradsLength * firstGrad) - 30);
345
+ let exceed = Math.ceil(this.sliderSize - (gradsLength * firstGrad) - 30); // add 30px of margin
348
346
  exceed = (exceed < 0) ? - exceed : 0;
349
347
  const gradsExceed = exceed / firstGrad;
350
- delta = Math.ceil(gradsLength / (gradsLength - gradsExceed));
348
+ if(gradsLength - gradsExceed){
349
+ delta = Math.ceil(gradsLength / (gradsLength - gradsExceed));
350
+ } else {
351
+ delta = Math.ceil(gradsLength);
352
+ }
351
353
  }
352
354
 
353
355
  let n = 0;