ui icon indicating copy to clipboard operation
ui copied to clipboard

[Feature request] Add more Slider configurations

Open CatchABus opened this issue 1 year ago • 4 comments
trafficstars

Please Describe The Problem To Be Solved

  • There are cases when one might need slider to be vertical (changing angle breaks other things)
  • Slider does not support steps as described in #37

(Optional): Suggest A Solution I imagine a type property for slider orientation would do. Then, a step property with default value of 1 to maintain backwards compatibility.

If the team is open to these features, I could create PRs for the things mentioned above.

CatchABus avatar Jul 02 '24 00:07 CatchABus

Hi, @CatchABus. Feel free to make a PR. The progress bar, which is the base for the slider, already supports orientation.

CyberDex avatar Jul 02 '24 09:07 CyberDex

Hi, @CatchABus. Feel free to make a PR. The progress bar, which is the base for the slider, already supports orientation.

Hi @CyberDex . Thanks a lot for the quick response! Is there any example regarding vertical progress bar? I couldn't find anything in the docs.

CatchABus avatar Jul 02 '24 12:07 CatchABus

Hi, @CatchABus. Feel free to make a PR. The progress bar, which is the base for the slider, already supports orientation.

Hi @CyberDex . Thanks a lot for the quick response! Is there any example regarding vertical progress bar? I couldn't find anything in the docs.

It is here: https://pixijs.io/ui/storybook/?path=/story/components-progressbar-usegraphics--use-graphics (check the Controls tab)

CyberDex avatar Jul 02 '24 12:07 CyberDex

Hi, @CatchABus. Feel free to make a PR. The progress bar, which is the base for the slider, already supports orientation.

Hi @CyberDex . Thanks a lot for the quick response! Is there any example regarding vertical progress bar? I couldn't find anything in the docs.

It is here: https://pixijs.io/ui/storybook/?path=/story/components-progressbar-usegraphics--use-graphics (check the Controls tab)

That is the rotation approach which I've already tried. Storybook sample code contains this:

        if (vertical)
        {
            progressBar.rotation = -Math.PI / 2;
            view.y += view.height / 2;
        }
        else
        {
            view.x += -view.width / 2;
        }

Unfortunately this doesn't work very well on Slider. That component uses sprites width and height for calculating slider alignment and rotation doesn't work very well at times. I'll create a PR for this one just to make the problem more apparent.

CatchABus avatar Jul 02 '24 13:07 CatchABus