Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
manual-change event
Browse files Browse the repository at this point in the history
Added JSDoc for the `manual-change` event and fire it in the code when
`value` changes due to manual interaction.
  • Loading branch information
jeffposnick committed Jul 16, 2014
1 parent 2b11335 commit bfd21d9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions paper-slider.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@
*
* @event change
*/

/**
* Fired when the slider's value changes due to manual interaction.
*
* Changes to the slider's value due to changes in an underlying
* bound variable will not trigger this event.
*
* @event manual-change
*/

/**
* If true, the slider thumb snaps to tick marks evenly spaced based
Expand Down Expand Up @@ -211,6 +220,7 @@

inputChange: function() {
this.value = this.$.input.value;
this.fire('manual-change');
},

calcKnobPosition: function() {
Expand Down Expand Up @@ -247,6 +257,7 @@
this.$.sliderKnob.classList.remove('dragging');
this.resetKnob();
this.value = this.immediateValue;
this.fire('manual-change');
},

bardown: function(e) {
Expand All @@ -256,6 +267,7 @@
this.positionKnob((e.x - rect.left) / this._w);
this.value = this.calcStep(this.calcKnobPosition());
this.expandJob = this.job(this.expandJob, this.expandKnob, 60);
this.fire('manual-change');
},

knobTransitionEnd: function() {
Expand All @@ -271,10 +283,12 @@

increment: function() {
this.value = this.clampValue(this.value + this.step);
this.fire('manual-change');
},

decrement: function() {
this.value = this.clampValue(this.value - this.step);
this.fire('manual-change');
},

keydown: function(e) {
Expand Down

0 comments on commit bfd21d9

Please sign in to comment.