angularjs-slider icon indicating copy to clipboard operation
angularjs-slider copied to clipboard

Slider doesn't work properly when parent container is rotated

Open kfmorton opened this issue 4 years ago • 5 comments

Describe the bug When the slider is embedded in a container (div) and the div is rotated 90 deg using CSS "transform: rotate(90deg);" the slider doesn't work. The behavior is broken, where it doesn't slide or move at all, and the labels are not aligned properly.

To Reproduce Steps to reproduce the behavior:

  1. Put the ng-slider in a div
  2. Rotate the div using css 90 deg
  3. The slider doesn't work, see issue

Expected behavior The slider is supposed to work as normal

Screenshots

image

CSS .availability-edit-container { -webkit-transform: rotate(90deg); /* Safari and Chrome / -moz-transform: rotate(90deg); / Firefox / -ms-transform: rotate(90deg); / IE 9 / -o-transform: rotate(90deg); / Opera */ transform: rotate(90deg); }

HTML

options are: draggableRange: true

kfmorton avatar Dec 16 '20 04:12 kfmorton

It's been a while since I worked on this library. However, if I recall correctly, mouse events are not taking any transformations into account. There was the same issue with using transform: scale(2) and that's why the scale option was created.

I think that something similar should be done for your use case.

ValentinH avatar Dec 16 '20 07:12 ValentinH

Thanks for your response. I did see the scale property solution when using transform: scale(2). But, the slider's behavior is incorrect before mouse interaction/events. It's almost like the slider's controls or settings are not updating after the css rotation, because the slider attempts to slide in the incorrect opposite direction. I have tried all slider options but nothing seems to work.

kfmorton avatar Dec 16 '20 23:12 kfmorton

This is because a new option would be required to tell the slider it is rotated so that the internal logic takes it into account. Such an option doesn't exist at the moment. If you want, you can try to work on a PR though.

ValentinH avatar Dec 17 '20 07:12 ValentinH

I don't mind if you provide a little direction on what needs to be done. Also, I just noticed I reported this issue in "angularjs-slider", should I move it to "ngx-slider"

kfmorton avatar Dec 17 '20 16:12 kfmorton

It depends which library you are using. If it's the Angular one, yes this is not the right issue board 🙂

ValentinH avatar Dec 17 '20 16:12 ValentinH