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 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @extends {WebInspector.VBox} | 7 * @extends {WebInspector.VBox} |
8 * @implements {WebInspector.OverridesSupport.PageResizer} | 8 * @implements {WebInspector.OverridesSupport.PageResizer} |
9 * @param {!WebInspector.InspectedPagePlaceholder} inspectedPagePlaceholder | 9 * @param {!WebInspector.InspectedPagePlaceholder} inspectedPagePlaceholder |
10 */ | 10 */ |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
159 resizer.addEventListener(WebInspector.ResizerWidget.Events.ResizeEnd, th is._onResizeEnd, this); | 159 resizer.addEventListener(WebInspector.ResizerWidget.Events.ResizeEnd, th is._onResizeEnd, this); |
160 return resizer; | 160 return resizer; |
161 }, | 161 }, |
162 | 162 |
163 /** | 163 /** |
164 * @param {!WebInspector.Event} event | 164 * @param {!WebInspector.Event} event |
165 */ | 165 */ |
166 _onResizeStart: function(event) | 166 _onResizeStart: function(event) |
167 { | 167 { |
168 var available = this.availableDipSize(); | 168 var available = this.availableDipSize(); |
169 this._slowPositionStart = null; | |
169 this._resizeStartSize = event.target.isVertical() ? (this._dipHeight || available.height) : (this._dipWidth || available.width); | 170 this._resizeStartSize = event.target.isVertical() ? (this._dipHeight || available.height) : (this._dipWidth || available.width); |
170 }, | 171 }, |
171 | 172 |
172 /** | 173 /** |
173 * @param {!WebInspector.Event} event | 174 * @param {!WebInspector.Event} event |
174 */ | 175 */ |
175 _onResizeUpdate: function(event) | 176 _onResizeUpdate: function(event) |
176 { | 177 { |
177 var cssOffset = event.data.currentPosition - event.data.startPosition; | 178 if (event.data.shiftKey !== !!this._slowPositionStart) |
178 var dipOffset = cssOffset * WebInspector.zoomManager.zoomFactor(); | 179 this._slowPositionStart = event.data.shiftKey ? event.data.currentPo sition : null; |
180 var cssOffset = this._slowPositionStart ? (event.data.currentPosition - this._slowPositionStart) / 10 + this._slowPositionStart - event.data.startPositi on : event.data.currentPosition - event.data.startPosition; | |
181 var dipOffset = Math.round(cssOffset * WebInspector.zoomManager.zoomFact or()); | |
lushnikov
2014/06/04 09:15:42
added Math.round statement we've talked about.
| |
179 var newSize = Math.max(this._resizeStartSize + dipOffset, 1); | 182 var newSize = Math.max(this._resizeStartSize + dipOffset, 1); |
180 var requested = new Size(this._dipWidth, this._dipHeight); | 183 var requested = new Size(this._dipWidth, this._dipHeight); |
181 if (event.target.isVertical()) | 184 if (event.target.isVertical()) |
182 requested.height = newSize; | 185 requested.height = newSize; |
183 else | 186 else |
184 requested.width = newSize; | 187 requested.width = newSize; |
185 this.dispatchEventToListeners(WebInspector.OverridesSupport.PageResizer. Events.ResizeRequested, requested); | 188 this.dispatchEventToListeners(WebInspector.OverridesSupport.PageResizer. Events.ResizeRequested, requested); |
186 }, | 189 }, |
187 | 190 |
188 /** | 191 /** |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
461 if (this._warningMessage.textContent === message) | 464 if (this._warningMessage.textContent === message) |
462 return; | 465 return; |
463 this._warningMessage.classList.toggle("hidden", !message); | 466 this._warningMessage.classList.toggle("hidden", !message); |
464 this._warningMessage.textContent = message; | 467 this._warningMessage.textContent = message; |
465 this._responsiveDesignModeChanged(); | 468 this._responsiveDesignModeChanged(); |
466 this.onResize(); | 469 this.onResize(); |
467 }, | 470 }, |
468 | 471 |
469 __proto__: WebInspector.VBox.prototype | 472 __proto__: WebInspector.VBox.prototype |
470 }; | 473 }; |
OLD | NEW |