Skip to content

max size is clamped #16

@OriginLive

Description

@OriginLive

Hello, the max size of the circle and container is clamped, i'm trying to create a switch, where the circle's height is bigger or equal to the container;

the following line is the problem:
this.styleProps.maxCircleSize = height - (this.styleProps.circleMargin * 2 + 1)

having some sort of prop to add or remove pixel size from container would do that exactly.

There's also a couple of bugs relating to fast clicking or dragging, it looks like it's not calculating correctly if you don't move much, or if you move way too fast.

Edit:
pinned the mistake down:
it has to do with
const isGoingLeft = (direction < 0 ? this.boundary : 0) + direction < this.boundary / 2

Somehow that doesn't calculate it right.

Ok, i've seemed to solve my issue by doing:

   isGoingLeft = null

   if(!this.props.value) //0 is left
   {
     if(direction <  this.boundary / 2)
     {
      isGoingLeft=true
     }
     else
     {
       isGoingLeft=false
     }
   }
   else
   {
    if(direction <  this.boundary / 2)
    {
     isGoingLeft=true
    }
    else
    {
      isGoingLeft=false
    }
   }

instead of that part. I've also removed this.debounce lines from component did update, because if you change sliders in less than 150ms it screws up animations and switches sides. This can make it infidelity loop.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions