Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.0: With initial value set, when dragging for first time makes the slider value go to max. #177

Closed
1 task done
Desproposito opened this issue Mar 30, 2017 · 2 comments · Fixed by #194
Closed
1 task done

Comments

@Desproposito
Copy link

Description

This is for 2.0-preview.

When you use the paper-slider 2.0-preview with polymer 2.0, and a initial value is set for the slider, the first time you drag the knob the sliders automatically jumps to max value.

It seems to be a problem with the ratio calculated for the first time, as it goes to a value much greater than 1.

I'll try to find the problem and let you know.

Expected outcome

When you drag the knob is expected to be set on the mouse position, not on the end of the slider (max value).

Actual outcome

When you drag the knob for first time, it jumps to max value.

Steps to reproduce

It fails with a binded or static value.

<paper-slider id="ratings" max="100" value="{{val}}"></paper-slider> <paper-slider id="ratings" max="100" value="40"></paper-slider>

Browsers Affected

  • Chrome
@Desproposito
Copy link
Author

Hi,

I think I found the solution, at least for me is working right now, I added the first line in the _trackStart function:

        _trackStart: function (event) {
            this._setRatio(this.value / this.max);  // <------------ This line must be added
            this._setTransiting(false);
            this._w = this.$.sliderBar.offsetWidth;
            this._x = this.ratio * this._w;
            this._startx = this._x;
            this._knobstartx = this._startx;
            this._minx = -this._startx;
            this._maxx = this._w - this._startx;
            this.$.sliderKnob.classList.add('dragging');
            this._setDragging(true);
        },

I'm sorry, I'm not familiar with opensource/github contribution and I don't know how to directly change or propose it.

Juravenator added a commit to Juravenator/paper-slider that referenced this issue May 19, 2017
@bradrydzewski
Copy link

I can confirm the issue (chrome and firefox)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants