diff --git a/dist/slider-button-card.js b/dist/slider-button-card.js index b680350..8a11da0 100644 --- a/dist/slider-button-card.js +++ b/dist/slider-button-card.js @@ -5443,7 +5443,7 @@ class Controller { } moveSlider(event, { left, top, width, height }) { let percentage = this.calcMovementPercentage(event, { left, top, width, height }); - percentage = this.applyStep(percentage); + //percentage = this.applyStep(percentage); percentage = normalize(percentage, 0, 100); if (!this.isValuePercentage) { percentage = percentageToValue(percentage, this.min, this.max); @@ -5476,7 +5476,10 @@ class Controller { return percentage; } applyStep(value) { - return Math.round(value / this.step) * this.step; + this.log("applyStep value", value); + let rounded = Math.round(value / this.step) * this.step; + this.log("applyStep round", rounded); + return rounded; } log(name = '', value = '') { if (this._config.debug) { @@ -7422,7 +7425,7 @@ let SliderButtonCard = class SliderButtonCard extends LitElement { // eslint-disable-next-line @typescript-eslint/camelcase show_state: true, compact: false, // eslint-disable-next-line @typescript-eslint/camelcase - action_button: copy(ActionButtonConfigDefault), debug: false }, config); + action_button: copy(ActionButtonConfigDefault), debug: true }, config); this.ctrl = ControllerFactory.getInstance(this.config); } shouldUpdate(changedProps) { diff --git a/src/controllers/controller.ts b/src/controllers/controller.ts index 9d7a9c0..38156f9 100644 --- a/src/controllers/controller.ts +++ b/src/controllers/controller.ts @@ -235,7 +235,7 @@ export abstract class Controller { moveSlider(event: any, {left, top, width, height}): number { let percentage = this.calcMovementPercentage(event, {left, top, width, height}); - percentage = this.applyStep(percentage); + //percentage = this.applyStep(percentage); percentage = normalize(percentage, 0, 100); if (!this.isValuePercentage) { percentage = percentageToValue(percentage, this.min, this.max); @@ -282,7 +282,10 @@ export abstract class Controller { } applyStep(value: number): number { - return Math.round(value / this.step) * this.step; + this.log("applyStep value", value); + let rounded = Math.round(value / this.step) * this.step; + this.log("applyStep round", rounded); + return rounded; } log(name = '', value: string | number | object = ''): void { diff --git a/src/slider-button-card.ts b/src/slider-button-card.ts index 8ab80ad..780d1dc 100644 --- a/src/slider-button-card.ts +++ b/src/slider-button-card.ts @@ -91,7 +91,7 @@ export class SliderButtonCard extends LitElement implements LovelaceCard { compact: false, // eslint-disable-next-line @typescript-eslint/camelcase action_button: copy(ActionButtonConfigDefault), - debug: false, + debug: true, ...config }; this.ctrl = ControllerFactory.getInstance(this.config);