Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Added pinLabel property. #167

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "paper-slider",
"version": "1.0.12",
"version": "1.0.13",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't update bower.json/version number with this PR - we will do that separately and publish a release separately.

"description": "A material design-style slider",
"license": "http://polymer.github.io/LICENSE.txt",
"authors": "The Polymer Authors",
Expand Down
14 changes: 13 additions & 1 deletion paper-slider.html
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@
on-up="_resetKnob"
on-track="_onTrack"
on-transitionend="_knobTransitionEnd">
<div class="slider-knob-inner" value$="[[immediateValue]]"></div>
<div class="slider-knob-inner" value$="[[_getPinLabel(pinLabel, immediateValue)]]"></div>
</div>
</div>

Expand Down Expand Up @@ -388,6 +388,14 @@
notify: true
},

/**
* If set, a this text will be used in the pin instead of just the numeric
* number. Use if you need to format the label in any way.
*/
pinLabel: {
type: String
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My mistake - you do need a default value of '' for pinLabel because the value$="[[_getPinLabel(pinLabel, immediateValue)]]" computed binding won't be evaluated unless both arguments are defined.

},

/**
* The number that represents the current secondary progress.
*/
Expand Down Expand Up @@ -704,6 +712,10 @@
event.stopPropagation();
},

_getPinLabel: function(pinLabel, value) {
return pinLabel ? pinLabel : value;
},

// create the element ripple inside the `sliderKnob`
_createRipple: function() {
this._rippleContainer = this.$.sliderKnob;
Expand Down