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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 }, | 392 }, |
393 | 393 |
394 _boundAnimate: { | 394 _boundAnimate: { |
395 type: Function, | 395 type: Function, |
396 value: function() { | 396 value: function() { |
397 return this.animate.bind(this); | 397 return this.animate.bind(this); |
398 } | 398 } |
399 } | 399 } |
400 }, | 400 }, |
401 | 401 |
402 observers: [ | |
403 '_noinkChanged(noink, isAttached)' | |
404 ], | |
405 | |
406 get target () { | 402 get target () { |
407 var ownerRoot = Polymer.dom(this).getOwnerRoot(); | 403 var ownerRoot = Polymer.dom(this).getOwnerRoot(); |
408 var target; | 404 var target; |
409 | 405 |
410 if (this.parentNode.nodeType == 11) { // DOCUMENT_FRAGMENT_NODE | 406 if (this.parentNode.nodeType == 11) { // DOCUMENT_FRAGMENT_NODE |
411 target = ownerRoot.host; | 407 target = ownerRoot.host; |
412 } else { | 408 } else { |
413 target = this.parentNode; | 409 target = this.parentNode; |
414 } | 410 } |
415 | 411 |
416 return target; | 412 return target; |
417 }, | 413 }, |
418 | 414 |
419 keyBindings: { | 415 keyBindings: { |
420 'enter:keydown': '_onEnterKeydown', | 416 'enter:keydown': '_onEnterKeydown', |
421 'space:keydown': '_onSpaceKeydown', | 417 'space:keydown': '_onSpaceKeydown', |
422 'space:keyup': '_onSpaceKeyup' | 418 'space:keyup': '_onSpaceKeyup' |
423 }, | 419 }, |
424 | 420 |
425 attached: function() { | 421 attached: function() { |
| 422 // Set up a11yKeysBehavior to listen to key events on the target, |
| 423 // so that space and enter activate the ripple even if the target doesn'
t |
| 424 // handle key events. The key handlers deal with `noink` themselves. |
| 425 this.keyEventTarget = this.target; |
426 this.listen(this.target, 'up', 'uiUpAction'); | 426 this.listen(this.target, 'up', 'uiUpAction'); |
427 this.listen(this.target, 'down', 'uiDownAction'); | 427 this.listen(this.target, 'down', 'uiDownAction'); |
428 }, | 428 }, |
429 | 429 |
430 detached: function() { | 430 detached: function() { |
431 this.unlisten(this.target, 'up', 'uiUpAction'); | 431 this.unlisten(this.target, 'up', 'uiUpAction'); |
432 this.unlisten(this.target, 'down', 'uiDownAction'); | 432 this.unlisten(this.target, 'down', 'uiDownAction'); |
433 }, | 433 }, |
434 | 434 |
435 get shouldKeepAnimating () { | 435 get shouldKeepAnimating () { |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 // effect. | 585 // effect. |
586 _holdDownChanged: function(newVal, oldVal) { | 586 _holdDownChanged: function(newVal, oldVal) { |
587 if (oldVal === undefined) { | 587 if (oldVal === undefined) { |
588 return; | 588 return; |
589 } | 589 } |
590 if (newVal) { | 590 if (newVal) { |
591 this.downAction(); | 591 this.downAction(); |
592 } else { | 592 } else { |
593 this.upAction(); | 593 this.upAction(); |
594 } | 594 } |
595 }, | |
596 | |
597 _noinkChanged: function(noink, attached) { | |
598 if (attached) { | |
599 this.keyEventTarget = noink ? this : this.target; | |
600 } | |
601 } | 595 } |
602 }); | 596 }); |
603 })(); | 597 })(); |
OLD | NEW |