AmoebeLabs / swiss-army-knife-card

The versatile custom Swiss Army Knife card for Home Assistant allows you to create your unique visualization using several graphical tools, styling options and animations.
224 stars 19 forks source link

Circular Slider Tool acts weird with "odd" scales #172

Closed KingCruzIII closed 1 year ago

KingCruzIII commented 1 year ago

Bug report notice

Before you file a bug, make sure that you did not make a configuration mistake. The Swiss Army Knife in its current state does not yet have full configuration sanity checks!

So make sure your problem is not related to that!

Bug description

When using "odd" scales the tool acts jittery, wont slide past a certain point, or will only bottom/max out. Example:

  min: 60
  max: 70
  step: 1

will make it only make it want to be 60 or 70.

  min: 50
  max: 70
  step: 1

it wont to below 60

Varous other sets of min/max will also have similar effects. 70/100 15/25

But there are still some that work like you would think 14/24 50/90

To Reproduce

Steps to reproduce the behavior:

  - path: circslider
    title: circslider test
    cards:
      - type: "custom:swiss-army-knife-card"
        entities:
          - entity: climate.thermostat
            attribute: temperature
        aspectratio: 1/1
        layout:
          toolsets:
            # ================================================================
            - toolset: circ-slider-test 
              position:
                cx: 50
                cy: 50
              tools:
                # ------------------------------------------------------------
                - type: circslider
                  position:
                    cx: 50
                    cy: 40
                    radius: 25
                    start_angle: -90
                    end_angle: 90
                    thumb:
                      width: 4
                      height: 4
                    label:
                      placement: "position"
                      cx: 50
                      cy: 50
                  entity_index: 0
                  scale:
                    min: 60
                    max: 70
                    step: 1
                  styles:
                    active:
                      stroke: var(--accent-color)
                      stroke-width: 2em
                      stroke-linecap: round
                    track:
                      stroke: var(--secondary-text-color)
                      fill-opacity: 1
                      stroke-width: 2em
                      stroke-linecap: round
                    thumb:
                      fill: var(--accent-color)
                    capture:
                      fill: none
                    label:
                      text-anchor: middle
                      font-size: 25em
                      font-weight: 500
                      fill: var(--primary-text-color)

Expected behavior

I would expect that you could set any min/max ratio and the slider would not be jittery.

Screenshots

If applicable, add screenshots to help explain your problem. circslider circslider2

Desktop browser (please complete the following information):

Companion App on Smartphone/Tablet (please complete the following information):

github-actions[bot] commented 1 year ago

Thank you for creating your first issue for the Swiss Army Knife custom card!

AmoebeLabs commented 1 year ago

With PR #187 I hope that these problems are completely gone!

This PR is in milestone 2.4.1: https://github.com/AmoebeLabs/swiss-army-knife-card/milestone/3?closed=1, to be released in may 2023.