| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | 2 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. |
| 3 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 3 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 5 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 5 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 6 Code distributed by Google as part of the polymer project is also | 6 Code distributed by Google as part of the polymer project is also |
| 7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 8 --> | 8 --> |
| 9 | 9 |
| 10 <link rel="import" href="../polymer/polymer.html"> | 10 <link rel="import" href="../polymer/polymer.html"> |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 | 385 |
| 386 | 386 |
| 387 // 2d transform for safari because of border-radius and overflow:hidden
clipping bug. | 387 // 2d transform for safari because of border-radius and overflow:hidden
clipping bug. |
| 388 // https://bugs.webkit.org/show_bug.cgi?id=98538 | 388 // https://bugs.webkit.org/show_bug.cgi?id=98538 |
| 389 this.waveContainer.style.webkitTransform = 'translate(' + dx + 'px, ' +
dy + 'px)'; | 389 this.waveContainer.style.webkitTransform = 'translate(' + dx + 'px, ' +
dy + 'px)'; |
| 390 this.waveContainer.style.transform = 'translate3d(' + dx + 'px, ' + dy +
'px, 0)'; | 390 this.waveContainer.style.transform = 'translate3d(' + dx + 'px, ' + dy +
'px, 0)'; |
| 391 this.wave.style.webkitTransform = 'scale(' + scale + ',' + scale + ')'; | 391 this.wave.style.webkitTransform = 'scale(' + scale + ',' + scale + ')'; |
| 392 this.wave.style.transform = 'scale3d(' + scale + ',' + scale + ',1)'; | 392 this.wave.style.transform = 'scale3d(' + scale + ',' + scale + ',1)'; |
| 393 }, | 393 }, |
| 394 | 394 |
| 395 /** @param {Event=} event */ |
| 395 downAction: function(event) { | 396 downAction: function(event) { |
| 396 var xCenter = this.containerMetrics.width / 2; | 397 var xCenter = this.containerMetrics.width / 2; |
| 397 var yCenter = this.containerMetrics.height / 2; | 398 var yCenter = this.containerMetrics.height / 2; |
| 398 | 399 |
| 399 this.resetInteractionState(); | 400 this.resetInteractionState(); |
| 400 this.mouseDownStart = Utility.now(); | 401 this.mouseDownStart = Utility.now(); |
| 401 | 402 |
| 402 if (this.center) { | 403 if (this.center) { |
| 403 this.xStart = xCenter; | 404 this.xStart = xCenter; |
| 404 this.yStart = yCenter; | 405 this.yStart = yCenter; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 429 | 430 |
| 430 this.waveContainer.style.top = | 431 this.waveContainer.style.top = |
| 431 (this.containerMetrics.height - this.containerMetrics.size) / 2 + 'px'
; | 432 (this.containerMetrics.height - this.containerMetrics.size) / 2 + 'px'
; |
| 432 this.waveContainer.style.left = | 433 this.waveContainer.style.left = |
| 433 (this.containerMetrics.width - this.containerMetrics.size) / 2 + 'px'; | 434 (this.containerMetrics.width - this.containerMetrics.size) / 2 + 'px'; |
| 434 | 435 |
| 435 this.waveContainer.style.width = this.containerMetrics.size + 'px'; | 436 this.waveContainer.style.width = this.containerMetrics.size + 'px'; |
| 436 this.waveContainer.style.height = this.containerMetrics.size + 'px'; | 437 this.waveContainer.style.height = this.containerMetrics.size + 'px'; |
| 437 }, | 438 }, |
| 438 | 439 |
| 440 /** @param {Event=} event */ |
| 439 upAction: function(event) { | 441 upAction: function(event) { |
| 440 if (!this.isMouseDown) { | 442 if (!this.isMouseDown) { |
| 441 return; | 443 return; |
| 442 } | 444 } |
| 443 | 445 |
| 444 this.mouseUpStart = Utility.now(); | 446 this.mouseUpStart = Utility.now(); |
| 445 }, | 447 }, |
| 446 | 448 |
| 447 remove: function() { | 449 remove: function() { |
| 448 Polymer.dom(this.waveContainer.parentNode).removeChild( | 450 Polymer.dom(this.waveContainer.parentNode).removeChild( |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 value: function() { | 554 value: function() { |
| 553 return this.animate.bind(this); | 555 return this.animate.bind(this); |
| 554 } | 556 } |
| 555 } | 557 } |
| 556 }, | 558 }, |
| 557 | 559 |
| 558 get target () { | 560 get target () { |
| 559 var ownerRoot = Polymer.dom(this).getOwnerRoot(); | 561 var ownerRoot = Polymer.dom(this).getOwnerRoot(); |
| 560 var target; | 562 var target; |
| 561 | 563 |
| 562 if (ownerRoot) { | 564 if (this.parentNode.nodeType == 11) { // DOCUMENT_FRAGMENT_NODE |
| 563 target = ownerRoot.host; | 565 target = ownerRoot.host; |
| 564 } | 566 } else { |
| 565 | |
| 566 if (!target) { | |
| 567 target = this.parentNode; | 567 target = this.parentNode; |
| 568 } | 568 } |
| 569 | 569 |
| 570 return target; | 570 return target; |
| 571 }, | 571 }, |
| 572 | 572 |
| 573 keyBindings: { | 573 keyBindings: { |
| 574 'enter:keydown': '_onEnterKeydown', | 574 'enter:keydown': '_onEnterKeydown', |
| 575 'space:keydown': '_onSpaceKeydown', | 575 'space:keydown': '_onSpaceKeydown', |
| 576 'space:keyup': '_onSpaceKeyup' | 576 'space:keyup': '_onSpaceKeyup' |
| 577 }, | 577 }, |
| 578 | 578 |
| 579 attached: function() { | 579 attached: function() { |
| 580 this._listen(this.target, 'up', this.upAction.bind(this)); | 580 this.listen(this.target, 'up', 'upAction'); |
| 581 this._listen(this.target, 'down', this.downAction.bind(this)); | 581 this.listen(this.target, 'down', 'downAction'); |
| 582 | 582 |
| 583 if (!this.target.hasAttribute('noink')) { | 583 if (!this.target.hasAttribute('noink')) { |
| 584 this.keyEventTarget = this.target; | 584 this.keyEventTarget = this.target; |
| 585 } | 585 } |
| 586 }, | 586 }, |
| 587 | 587 |
| 588 get shouldKeepAnimating () { | 588 get shouldKeepAnimating () { |
| 589 for (var index = 0; index < this.ripples.length; ++index) { | 589 for (var index = 0; index < this.ripples.length; ++index) { |
| 590 if (!this.ripples[index].isAnimationComplete) { | 590 if (!this.ripples[index].isAnimationComplete) { |
| 591 return true; | 591 return true; |
| 592 } | 592 } |
| 593 } | 593 } |
| 594 | 594 |
| 595 return false; | 595 return false; |
| 596 }, | 596 }, |
| 597 | 597 |
| 598 simulatedRipple: function() { | 598 simulatedRipple: function() { |
| 599 this.downAction(null); | 599 this.downAction(null); |
| 600 | 600 |
| 601 // Please see polymer/polymer#1305 | 601 // Please see polymer/polymer#1305 |
| 602 this.async(function() { | 602 this.async(function() { |
| 603 this.upAction(); | 603 this.upAction(); |
| 604 }, 1); | 604 }, 1); |
| 605 }, | 605 }, |
| 606 | 606 |
| 607 /** @param {Event=} event */ |
| 607 downAction: function(event) { | 608 downAction: function(event) { |
| 608 if (this.holdDown && this.ripples.length > 0) { | 609 if (this.holdDown && this.ripples.length > 0) { |
| 609 return; | 610 return; |
| 610 } | 611 } |
| 611 | 612 |
| 612 var ripple = this.addRipple(); | 613 var ripple = this.addRipple(); |
| 613 | 614 |
| 614 ripple.downAction(event); | 615 ripple.downAction(event); |
| 615 | 616 |
| 616 if (!this._animating) { | 617 if (!this._animating) { |
| 617 this.animate(); | 618 this.animate(); |
| 618 } | 619 } |
| 619 }, | 620 }, |
| 620 | 621 |
| 622 /** @param {Event=} event */ |
| 621 upAction: function(event) { | 623 upAction: function(event) { |
| 622 if (this.holdDown) { | 624 if (this.holdDown) { |
| 623 return; | 625 return; |
| 624 } | 626 } |
| 625 | 627 |
| 626 this.ripples.forEach(function(ripple) { | 628 this.ripples.forEach(function(ripple) { |
| 627 ripple.upAction(event); | 629 ripple.upAction(event); |
| 628 }); | 630 }); |
| 629 | 631 |
| 630 this.animate(); | 632 this.animate(); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 _holdDownChanged: function(holdDown) { | 707 _holdDownChanged: function(holdDown) { |
| 706 if (holdDown) { | 708 if (holdDown) { |
| 707 this.downAction(); | 709 this.downAction(); |
| 708 } else { | 710 } else { |
| 709 this.upAction(); | 711 this.upAction(); |
| 710 } | 712 } |
| 711 } | 713 } |
| 712 }); | 714 }); |
| 713 })(); | 715 })(); |
| 714 </script> | 716 </script> |
| OLD | NEW |