ruisoftware / jquery-rsSliderLens

UI slider control that magnifies the current value
MIT License
22 stars 5 forks source link

Changing the sliders range causes it's value to reset #4

Closed jculloty closed 7 years ago

jculloty commented 7 years ago

After updating the range the sliders current value should be used to update the handles. Currently the initial value is being used. This causes the slider to reset whenever the range is changed.

I think this change should fix the issue

patch.txt

jculloty commented 7 years ago

I did some more testing and my suggested change did not take into account flipped sliders

if (info.doubleHandles) {
  noIEdrag(elemMagnif.$elemRange2nd);
  info.updateHandles([info.getCurrValue(info.currValue[0], info.getCurrValue(info.currValue[1]]);
 } else {
  info.updateHandles(info.getCurrValue(info.currValue[0]));
}
ruisoftware commented 7 years ago

Hi John!

I have corrected the issue. Your patch was correct, but I decided to make it a bit cleaner, since updateHandles() was designed to be called during initialization with the ops.value parameter, so I renamed it to initHandles() and created another function updateHandles() to update the handles (after the initialization) with the current values. These current values info.currValue already take into account the flipped sliders.

Thanks for you support and interest. Jose Rui Santos

jculloty commented 7 years ago

Jose,

Thanks for the speedy update. I upgraded the npm package and your change is working correctly as far as I can tell. I did notice that the dist folder is an older version. Copying the version form source solved the problem, so it is no big deal.

John

On Wed, Nov 8, 2017 at 7:24 PM, Jose Rui Santos notifications@github.com wrote:

Closed #4 https://github.com/ruisoftware/jquery-rsSliderLens/issues/4.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ruisoftware/jquery-rsSliderLens/issues/4#event-1332554874, or mute the thread https://github.com/notifications/unsubscribe-auth/AdvW2BTRM9aNdLZD7mhaDgrehQ6FrUKXks5s0gAKgaJpZM4QU016 .

ruisoftware commented 7 years ago

Hi John,

The dist folder is created when you run grunt and is not under git version control. There, grunt copies the development javascript file jquery.rsSliderLens.js, generates the production file jquery.rsSliderLens.min.js and the rsSliderLens.css. The CSS file is the result of compiling rsSliderLens.less.

Jose Rui Santos