| OLD | NEW |
| 1 (function() { | 1 (function() { |
| 2 var Utility = { | 2 var Utility = { |
| 3 cssColorWithAlpha: function(cssColor, alpha) { | |
| 4 var parts = cssColor.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); | |
| 5 | |
| 6 if (typeof alpha == 'undefined') { | |
| 7 alpha = 1; | |
| 8 } | |
| 9 | |
| 10 if (!parts) { | |
| 11 return 'rgba(255, 255, 255, ' + alpha + ')'; | |
| 12 } | |
| 13 | |
| 14 return 'rgba(' + parts[1] + ', ' + parts[2] + ', ' + parts[3] + ', ' + a
lpha + ')'; | |
| 15 }, | |
| 16 | |
| 17 distance: function(x1, y1, x2, y2) { | 3 distance: function(x1, y1, x2, y2) { |
| 18 var xDelta = (x1 - x2); | 4 var xDelta = (x1 - x2); |
| 19 var yDelta = (y1 - y2); | 5 var yDelta = (y1 - y2); |
| 20 | 6 |
| 21 return Math.sqrt(xDelta * xDelta + yDelta * yDelta); | 7 return Math.sqrt(xDelta * xDelta + yDelta * yDelta); |
| 22 }, | 8 }, |
| 23 | 9 |
| 24 now: (function() { | 10 now: window.performance && window.performance.now ? |
| 25 if (window.performance && window.performance.now) { | 11 window.performance.now.bind(window.performance) : Date.now |
| 26 return window.performance.now.bind(window.performance); | |
| 27 } | |
| 28 | |
| 29 return Date.now; | |
| 30 })() | |
| 31 }; | 12 }; |
| 32 | 13 |
| 33 /** | 14 /** |
| 34 * @param {HTMLElement} element | 15 * @param {HTMLElement} element |
| 35 * @constructor | 16 * @constructor |
| 36 */ | 17 */ |
| 37 function ElementMetrics(element) { | 18 function ElementMetrics(element) { |
| 38 this.element = element; | 19 this.element = element; |
| 39 this.width = this.boundingRect.width; | 20 this.width = this.boundingRect.width; |
| 40 this.height = this.boundingRect.height; | 21 this.height = this.boundingRect.height; |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 | 537 |
| 557 _holdDownChanged: function(holdDown) { | 538 _holdDownChanged: function(holdDown) { |
| 558 if (holdDown) { | 539 if (holdDown) { |
| 559 this.downAction(); | 540 this.downAction(); |
| 560 } else { | 541 } else { |
| 561 this.upAction(); | 542 this.upAction(); |
| 562 } | 543 } |
| 563 } | 544 } |
| 564 }); | 545 }); |
| 565 })(); | 546 })(); |
| OLD | NEW |