OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 cr.define('extensions', function() { | 5 cr.define('extensions', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 /** | 8 /** |
9 * The ExtensionOptionsOverlay will show an extension's options page using | 9 * The ExtensionOptionsOverlay will show an extension's options page using |
10 * an <extensionoptions> element. | 10 * an <extensionoptions> element. |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 extensionoptions.onpreferredsizechanged = function(evt) { | 124 extensionoptions.onpreferredsizechanged = function(evt) { |
125 var oldWidth = parseInt(overlayStyle.width, 10); | 125 var oldWidth = parseInt(overlayStyle.width, 10); |
126 var oldHeight = parseInt(overlayStyle.height, 10); | 126 var oldHeight = parseInt(overlayStyle.height, 10); |
127 var newWidth = Math.max(evt.width, minWidth); | 127 var newWidth = Math.max(evt.width, minWidth); |
128 var newHeight = Math.min(evt.height, maxHeight); | 128 var newHeight = Math.min(evt.height, maxHeight); |
129 | 129 |
130 // animationTime is the amount of time in ms that will be used to resize | 130 // animationTime is the amount of time in ms that will be used to resize |
131 // the overlay. It is calculated by multiplying the pythagorean distance | 131 // the overlay. It is calculated by multiplying the pythagorean distance |
132 // between old and the new size (in px) with a constant speed of | 132 // between old and the new size (in px) with a constant speed of |
133 // 0.25 ms/px. | 133 // 0.25 ms/px. |
134 var loading = document.documentElement.classlist.contains('loading'); | 134 var loading = document.documentElement.classList.contains('loading'); |
Dan Beam
2015/02/05 20:33:35
dammit
| |
135 var animationTime = loading ? 0 : | 135 var animationTime = loading ? 0 : |
136 0.25 * Math.sqrt(Math.pow(newWidth - oldWidth, 2) + | 136 0.25 * Math.sqrt(Math.pow(newWidth - oldWidth, 2) + |
137 Math.pow(newHeight - oldHeight, 2)); | 137 Math.pow(newHeight - oldHeight, 2)); |
138 | 138 |
139 if (animation) | 139 if (animation) |
140 animation.cancel(); | 140 animation.cancel(); |
141 | 141 |
142 animation = overlay.animate([ | 142 animation = overlay.animate([ |
143 {width: oldWidth + 'px', height: oldHeight + 'px'}, | 143 {width: oldWidth + 'px', height: oldHeight + 'px'}, |
144 {width: newWidth + 'px', height: newHeight + 'px'} | 144 {width: newWidth + 'px', height: newHeight + 'px'} |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
190 /** @type {HTMLDivElement} */($('extension-options-overlay')) : | 190 /** @type {HTMLDivElement} */($('extension-options-overlay')) : |
191 null); | 191 null); |
192 } | 192 } |
193 }; | 193 }; |
194 | 194 |
195 // Export | 195 // Export |
196 return { | 196 return { |
197 ExtensionOptionsOverlay: ExtensionOptionsOverlay | 197 ExtensionOptionsOverlay: ExtensionOptionsOverlay |
198 }; | 198 }; |
199 }); | 199 }); |
OLD | NEW |