Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Unified Diff: third_party/polymer/components-chromium/paper-slider/paper-slider-extracted.js

Issue 1215543002: Remove Polymer 0.5. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unit test Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/polymer/components-chromium/paper-slider/paper-slider-extracted.js
diff --git a/third_party/polymer/components-chromium/paper-slider/paper-slider-extracted.js b/third_party/polymer/components-chromium/paper-slider/paper-slider-extracted.js
deleted file mode 100644
index 4b967d8f90f332abb97c23b599f53cdf24cded57..0000000000000000000000000000000000000000
--- a/third_party/polymer/components-chromium/paper-slider/paper-slider-extracted.js
+++ /dev/null
@@ -1,245 +0,0 @@
-
-
- Polymer('paper-slider', {
-
- /**
- * Fired when the slider's value changes.
- *
- * @event core-change
- */
-
- /**
- * Fired when the slider's immediateValue changes.
- *
- * @event immediate-value-change
- */
-
- /**
- * Fired when the slider's value changes due to user interaction.
- *
- * Changes to the slider's value due to changes in an underlying
- * bound variable will not trigger this event.
- *
- * @event change
- */
-
- /**
- * If true, the slider thumb snaps to tick marks evenly spaced based
- * on the `step` property value.
- *
- * @attribute snaps
- * @type boolean
- * @default false
- */
- snaps: false,
-
- /**
- * If true, a pin with numeric value label is shown when the slider thumb
- * is pressed. Use for settings for which users need to know the exact
- * value of the setting.
- *
- * @attribute pin
- * @type boolean
- * @default false
- */
- pin: false,
-
- /**
- * If true, this slider is disabled. A disabled slider cannot be tapped
- * or dragged to change the slider value.
- *
- * @attribute disabled
- * @type boolean
- * @default false
- */
- disabled: false,
-
- /**
- * The number that represents the current secondary progress.
- *
- * @attribute secondaryProgress
- * @type number
- * @default 0
- */
- secondaryProgress: 0,
-
- /**
- * If true, an input is shown and user can use it to set the slider value.
- *
- * @attribute editable
- * @type boolean
- * @default false
- */
- editable: false,
-
- /**
- * The immediate value of the slider. This value is updated while the user
- * is dragging the slider.
- *
- * @attribute immediateValue
- * @type number
- * @default 0
- */
-
- maxMarkers: 100,
-
- observe: {
- 'step snaps': 'update'
- },
-
- ready: function() {
- this.update();
- },
-
- update: function() {
- this.positionKnob(this.calcRatio(this.value));
- this.updateMarkers();
- },
-
- minChanged: function() {
- this.update();
- this.setAttribute('aria-valuemin', this.min);
- },
-
- maxChanged: function() {
- this.update();
- this.setAttribute('aria-valuemax', this.max);
- },
-
- valueChanged: function() {
- this.update();
- this.setAttribute('aria-valuenow', this.value);
- this.fire('core-change');
- },
-
- disabledChanged: function() {
- if (this.disabled) {
- this.removeAttribute('tabindex');
- } else {
- this.tabIndex = 0;
- }
- },
-
- immediateValueChanged: function() {
- if (!this.dragging) {
- this.value = this.immediateValue;
- }
- this.fire('immediate-value-change');
- },
-
- expandKnob: function() {
- this.expand = true;
- },
-
- resetKnob: function() {
- this.expandJob && this.expandJob.stop();
- this.expand = false;
- },
-
- positionKnob: function(ratio) {
- this.immediateValue = this.calcStep(this.calcKnobPosition(ratio)) || 0;
- this._ratio = this.snaps ? this.calcRatio(this.immediateValue) : ratio;
- this.$.sliderKnob.style.left = this._ratio * 100 + '%';
- },
-
- inputChange: function() {
- this.value = this.$.input.value;
- this.fire('change');
- },
-
- calcKnobPosition: function(ratio) {
- return (this.max - this.min) * ratio + this.min;
- },
-
- trackStart: function(e) {
- this._w = this.$.sliderBar.offsetWidth;
- this._x = this._ratio * this._w;
- this._startx = this._x || 0;
- this._minx = - this._startx;
- this._maxx = this._w - this._startx;
- this.$.sliderKnob.classList.add('dragging');
- this.dragging = true;
- e.preventTap();
- },
-
- trackx: function(e) {
- var x = Math.min(this._maxx, Math.max(this._minx, e.dx));
- this._x = this._startx + x;
- this.immediateValue = this.calcStep(
- this.calcKnobPosition(this._x / this._w)) || 0;
- var s = this.$.sliderKnob.style;
- s.transform = s.webkitTransform = 'translate3d(' + (this.snaps ?
- (this.calcRatio(this.immediateValue) * this._w) - this._startx : x) + 'px, 0, 0)';
- },
-
- trackEnd: function() {
- var s = this.$.sliderKnob.style;
- s.transform = s.webkitTransform = '';
- this.$.sliderKnob.classList.remove('dragging');
- this.dragging = false;
- this.resetKnob();
- this.value = this.immediateValue;
- this.fire('change');
- },
-
- knobdown: function(e) {
- e.preventDefault();
- this.expandKnob();
- },
-
- bardown: function(e) {
- e.preventDefault();
- this.transiting = true;
- this._w = this.$.sliderBar.offsetWidth;
- var rect = this.$.sliderBar.getBoundingClientRect();
- var ratio = (e.x - rect.left) / this._w;
- this.positionKnob(ratio);
- this.expandJob = this.job(this.expandJob, this.expandKnob, 60);
- this.fire('change');
- },
-
- knobTransitionEnd: function(e) {
- if (e.target === this.$.sliderKnob) {
- this.transiting = false;
- }
- },
-
- updateMarkers: function() {
- this.markers = [];
- var l = (this.max - this.min) / this.step;
- if (!this.snaps && l > this.maxMarkers) {
- return;
- }
- for (var i = 0; i < l; i++) {
- this.markers.push('');
- }
- },
-
- increment: function() {
- this.value = this.clampValue(this.value + this.step);
- },
-
- decrement: function() {
- this.value = this.clampValue(this.value - this.step);
- },
-
- incrementKey: function(ev, keys) {
- if (keys.key === "end") {
- this.value = this.max;
- } else {
- this.increment();
- }
- this.fire('change');
- },
-
- decrementKey: function(ev, keys) {
- if (keys.key === "home") {
- this.value = this.min;
- } else {
- this.decrement();
- }
- this.fire('change');
- }
-
- });
-

Powered by Google App Engine
This is Rietveld 408576698