OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Brian Grinstead All rights reserved. | 2 * Copyright (C) 2011 Brian Grinstead All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 181 |
182 var doc = document; | 182 var doc = document; |
183 var dragging; | 183 var dragging; |
184 var offset; | 184 var offset; |
185 var scrollOffset; | 185 var scrollOffset; |
186 var maxHeight; | 186 var maxHeight; |
187 var maxWidth; | 187 var maxWidth; |
188 | 188 |
189 function consume(e) | 189 function consume(e) |
190 { | 190 { |
191 e.consume(); | 191 e.consume(true); |
192 } | 192 } |
193 | 193 |
194 function move(e) | 194 function move(e) |
195 { | 195 { |
196 if (dragging) { | 196 if (dragging) { |
197 var dragX = Math.max(0, Math.min(e.pageX - offset.left + scrollOffse
t.left, maxWidth)); | 197 var dragX = Math.max(0, Math.min(e.pageX - offset.left + scrollOffse
t.left, maxWidth)); |
198 var dragY = Math.max(0, Math.min(e.pageY - offset.top + scrollOffset
.top, maxHeight)); | 198 var dragY = Math.max(0, Math.min(e.pageY - offset.top + scrollOffset
.top, maxHeight)); |
199 | 199 |
200 if (onmove) | 200 if (onmove) |
201 onmove(element, dragX, dragY); | 201 onmove(element, dragX, dragY); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 WebInspector.setCurrentFocusElement(this._previousFocusElement); | 421 WebInspector.setCurrentFocusElement(this._previousFocusElement); |
422 delete this._previousFocusElement; | 422 delete this._previousFocusElement; |
423 | 423 |
424 delete this.anchorElement; | 424 delete this.anchorElement; |
425 }, | 425 }, |
426 | 426 |
427 _onKeyDown: function(event) | 427 _onKeyDown: function(event) |
428 { | 428 { |
429 if (event.keyIdentifier === "Enter" || event.keyIdentifier === "U+001B")
{ // Escape key | 429 if (event.keyIdentifier === "Enter" || event.keyIdentifier === "U+001B")
{ // Escape key |
430 this.hide(); | 430 this.hide(); |
431 event.consume(); | 431 event.consume(true); |
432 } | 432 } |
433 } | 433 } |
434 } | 434 } |
435 | 435 |
436 WebInspector.Spectrum.prototype.__proto__ = WebInspector.Object.prototype; | 436 WebInspector.Spectrum.prototype.__proto__ = WebInspector.Object.prototype; |
OLD | NEW |