Skip to content
This repository has been archived by the owner on Nov 4, 2023. It is now read-only.

fix(SLIDER): update value in real-time on change #652

Merged
merged 2 commits into from
Feb 23, 2021
Merged

Conversation

timota
Copy link
Contributor

@timota timota commented Feb 22, 2021

Makes Slider Tile Value more dynamic.

Currently Value for Slider Tile not changing during slider movement. It changes only if slider released. With this change value become dynamic - it changes during slider move, and doesnt wait slider released, so it means you can see actual slider value.

Also, it saves ability to use filter that applied to Value.

Example:

                  {
                     position: [2, 0],
                     height: 2,
                     id: 'light.f1_r2_light_tv_wall',
                     type: TYPES.SLIDER,
                     unit: '%',
                     title: '',
                     state: false,
                     bottom: true,
                     filter: function (value) {
                        var num = parseFloat(value) / 2.55 ;
                        return num && !isNaN(num) ? num.toFixed() : 0;
                     },
                     value: '@attributes.brightness',
                     slider: {
                        max: 255,
                        min: 0,
                        step: 5,
                        field: 'brightness',
                        request: {
                           type: "call_service",
                           domain: "light",
                           service: "turn_on",
                           field: "brightness"
                        },
                     },
                  },

scripts/directives/tile.html Outdated Show resolved Hide resolved
scripts/directives/tile.html Outdated Show resolved Hide resolved
@rchl rchl changed the title TYPES.SLIDER: dynamic value fix(SLIDER): update value in real-time on change Feb 23, 2021
@rchl rchl merged commit 7d83970 into resoai:master Feb 23, 2021
@rchl
Copy link
Collaborator

rchl commented Feb 23, 2021

Looks good. Thanks.

Will release a new version in not too long.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants