OLD | NEW |
1 (function() { | 1 (function() { |
2 var Utility = { | 2 var Utility = { |
3 distance: function(x1, y1, x2, y2) { | 3 distance: function(x1, y1, x2, y2) { |
4 var xDelta = (x1 - x2); | 4 var xDelta = (x1 - x2); |
5 var yDelta = (y1 - y2); | 5 var yDelta = (y1 - y2); |
6 | 6 |
7 return Math.sqrt(xDelta * xDelta + yDelta * yDelta); | 7 return Math.sqrt(xDelta * xDelta + yDelta * yDelta); |
8 }, | 8 }, |
9 | 9 |
10 now: window.performance && window.performance.now ? | 10 now: window.performance && window.performance.now ? |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 * If true, the ripple will remain in the "down" state until `holdDown` | 370 * If true, the ripple will remain in the "down" state until `holdDown` |
371 * is set to false again. | 371 * is set to false again. |
372 */ | 372 */ |
373 holdDown: { | 373 holdDown: { |
374 type: Boolean, | 374 type: Boolean, |
375 value: false, | 375 value: false, |
376 observer: '_holdDownChanged' | 376 observer: '_holdDownChanged' |
377 }, | 377 }, |
378 | 378 |
379 /** | 379 /** |
380 * If true, the ripple will not generate a ripple effect | 380 * If true, the ripple will not generate a ripple effect |
381 * via pointer interaction. | 381 * via pointer interaction. |
382 * Calling ripple's imperative api like `simulatedRipple` will | 382 * Calling ripple's imperative api like `simulatedRipple` will |
383 * still generate the ripple effect. | 383 * still generate the ripple effect. |
384 */ | 384 */ |
385 noink: { | 385 noink: { |
386 type: Boolean, | 386 type: Boolean, |
387 value: false | 387 value: false |
388 }, | 388 }, |
389 | 389 |
390 _animating: { | 390 _animating: { |
391 type: Boolean | 391 type: Boolean |
392 }, | 392 }, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 | 444 |
445 simulatedRipple: function() { | 445 simulatedRipple: function() { |
446 this.downAction(null); | 446 this.downAction(null); |
447 | 447 |
448 // Please see polymer/polymer#1305 | 448 // Please see polymer/polymer#1305 |
449 this.async(function() { | 449 this.async(function() { |
450 this.upAction(); | 450 this.upAction(); |
451 }, 1); | 451 }, 1); |
452 }, | 452 }, |
453 | 453 |
454 /** | 454 /** |
455 * Provokes a ripple down effect via a UI event, | 455 * Provokes a ripple down effect via a UI event, |
456 * respecting the `noink` property. | 456 * respecting the `noink` property. |
457 * @param {Event=} event | 457 * @param {Event=} event |
458 */ | 458 */ |
459 uiDownAction: function(event) { | 459 uiDownAction: function(event) { |
460 if (!this.noink) { | 460 if (!this.noink) { |
461 this.downAction(event); | 461 this.downAction(event); |
462 } | 462 } |
463 }, | 463 }, |
464 | 464 |
465 /** | 465 /** |
466 * Provokes a ripple down effect via a UI event, | 466 * Provokes a ripple down effect via a UI event, |
467 * *not* respecting the `noink` property. | 467 * *not* respecting the `noink` property. |
468 * @param {Event=} event | 468 * @param {Event=} event |
469 */ | 469 */ |
470 downAction: function(event) { | 470 downAction: function(event) { |
471 if (this.holdDown && this.ripples.length > 0) { | 471 if (this.holdDown && this.ripples.length > 0) { |
472 return; | 472 return; |
473 } | 473 } |
474 | 474 |
475 var ripple = this.addRipple(); | 475 var ripple = this.addRipple(); |
476 | 476 |
477 ripple.downAction(event); | 477 ripple.downAction(event); |
478 | 478 |
479 if (!this._animating) { | 479 if (!this._animating) { |
480 this.animate(); | 480 this.animate(); |
481 } | 481 } |
482 }, | 482 }, |
483 | 483 |
484 /** | 484 /** |
485 * Provokes a ripple up effect via a UI event, | 485 * Provokes a ripple up effect via a UI event, |
486 * respecting the `noink` property. | 486 * respecting the `noink` property. |
487 * @param {Event=} event | 487 * @param {Event=} event |
488 */ | 488 */ |
489 uiUpAction: function(event) { | 489 uiUpAction: function(event) { |
490 if (!this.noink) { | 490 if (!this.noink) { |
491 this.upAction(event); | 491 this.upAction(event); |
492 } | 492 } |
493 }, | 493 }, |
494 | 494 |
495 /** | 495 /** |
496 * Provokes a ripple up effect via a UI event, | 496 * Provokes a ripple up effect via a UI event, |
497 * *not* respecting the `noink` property. | 497 * *not* respecting the `noink` property. |
498 * @param {Event=} event | 498 * @param {Event=} event |
499 */ | 499 */ |
500 upAction: function(event) { | 500 upAction: function(event) { |
501 if (this.holdDown) { | 501 if (this.holdDown) { |
502 return; | 502 return; |
503 } | 503 } |
504 | 504 |
505 this.ripples.forEach(function(ripple) { | 505 this.ripples.forEach(function(ripple) { |
506 ripple.upAction(event); | 506 ripple.upAction(event); |
507 }); | 507 }); |
508 | 508 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 } | 594 } |
595 }, | 595 }, |
596 | 596 |
597 _noinkChanged: function(noink, attached) { | 597 _noinkChanged: function(noink, attached) { |
598 if (attached) { | 598 if (attached) { |
599 this.keyEventTarget = noink ? this : this.target; | 599 this.keyEventTarget = noink ? this : this.target; |
600 } | 600 } |
601 } | 601 } |
602 }); | 602 }); |
603 })(); | 603 })(); |
OLD | NEW |