OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 The Chromium Authors. All rights reserved. | 2 * Copyright 2014 The Chromium Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 /** | 7 /** |
8 * @constructor | 8 * @constructor |
9 * @extends {WebInspector.Object} | 9 * @extends {WebInspector.Object} |
10 * @param {!Element} element | 10 * @param {!Element} element |
11 * @param {boolean=} disableRotate | 11 * @param {boolean=} disableRotate |
12 */ | 12 */ |
13 WebInspector.TransformController = function(element, disableRotate) | 13 WebInspector.TransformController = function(element, disableRotate) |
14 { | 14 { |
15 this._shortcuts = {}; | 15 this._shortcuts = {}; |
16 this.element = element; | 16 this.element = element; |
17 this._registerShortcuts(); | 17 this._registerShortcuts(); |
18 element.addEventListener("keydown", this._onKeyDown.bind(this), false); | 18 element.addEventListener("keydown", this._onKeyDown.bind(this), false); |
19 element.addEventListener("keyup", this._onKeyUp.bind(this), false); | 19 element.addEventListener("keyup", this._onKeyUp.bind(this), false); |
20 element.addEventListener("mousemove", this._onMouseMove.bind(this), false); | 20 element.addEventListener("mousemove", this._onMouseMove.bind(this), false); |
21 element.addEventListener("mousedown", this._onMouseDown.bind(this), false); | 21 element.addEventListener("mousedown", this._onMouseDown.bind(this), false); |
22 element.addEventListener("mouseup", this._onMouseUp.bind(this), false); | 22 element.addEventListener("mouseup", this._onMouseUp.bind(this), false); |
23 element.addEventListener("mousewheel", this._onMouseWheel.bind(this), false)
; | 23 element.addEventListener("mousewheel", this._onMouseWheel.bind(this), false)
; |
24 this._disableRotate = disableRotate; | 24 this._disableRotate = disableRotate; |
25 | 25 |
26 this._controlPanelElement = document.createElement("div"); | 26 this._controlPanelElement = createElement("div"); |
27 this._controlPanelElement.classList.add("transform-control-panel"); | 27 this._controlPanelElement.classList.add("transform-control-panel"); |
28 | 28 |
29 this._modeButtons = {}; | 29 this._modeButtons = {}; |
30 if (!disableRotate) { | 30 if (!disableRotate) { |
31 var panModeButton = new WebInspector.StatusBarButton(WebInspector.UIStri
ng("Pan mode (X)"), "transform-mode-pan"); | 31 var panModeButton = new WebInspector.StatusBarButton(WebInspector.UIStri
ng("Pan mode (X)"), "transform-mode-pan"); |
32 panModeButton.addEventListener("click", this._setMode.bind(this, WebInsp
ector.TransformController.Modes.Pan)); | 32 panModeButton.addEventListener("click", this._setMode.bind(this, WebInsp
ector.TransformController.Modes.Pan)); |
33 this._modeButtons[WebInspector.TransformController.Modes.Pan] = panModeB
utton; | 33 this._modeButtons[WebInspector.TransformController.Modes.Pan] = panModeB
utton; |
34 this._controlPanelElement.appendChild(panModeButton.element); | 34 this._controlPanelElement.appendChild(panModeButton.element); |
35 var rotateModeButton = new WebInspector.StatusBarButton(WebInspector.UIS
tring("Rotate mode (V)"), "transform-mode-rotate"); | 35 var rotateModeButton = new WebInspector.StatusBarButton(WebInspector.UIS
tring("Rotate mode (V)"), "transform-mode-rotate"); |
36 rotateModeButton.addEventListener("click", this._setMode.bind(this, WebI
nspector.TransformController.Modes.Rotate)); | 36 rotateModeButton.addEventListener("click", this._setMode.bind(this, WebI
nspector.TransformController.Modes.Rotate)); |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 */ | 321 */ |
322 _onMouseUp: function(event) | 322 _onMouseUp: function(event) |
323 { | 323 { |
324 if (event.which !== 1) | 324 if (event.which !== 1) |
325 return; | 325 return; |
326 this._resetReferencePoint(); | 326 this._resetReferencePoint(); |
327 }, | 327 }, |
328 | 328 |
329 __proto__: WebInspector.Object.prototype | 329 __proto__: WebInspector.Object.prototype |
330 } | 330 } |
OLD | NEW |