Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/layer_viewer/TransformController.js

Issue 2623743002: DevTools: extract modules (non-extensions) (Closed)
Patch Set: rebaseline Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 * @unrestricted 8 * @unrestricted
9 */ 9 */
10 LayerViewer.TransformController = class extends Common.Object { 10 LayerViewer.TransformController = class extends Common.Object {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 if (event.keyCode === UI.KeyboardShortcut.Keys.Shift.code) 75 if (event.keyCode === UI.KeyboardShortcut.Keys.Shift.code)
76 this._toggleMode(); 76 this._toggleMode();
77 } 77 }
78 78
79 _addShortcuts(keys, handler) { 79 _addShortcuts(keys, handler) {
80 for (var i = 0; i < keys.length; ++i) 80 for (var i = 0; i < keys.length; ++i)
81 this._shortcuts[keys[i].key] = handler; 81 this._shortcuts[keys[i].key] = handler;
82 } 82 }
83 83
84 _registerShortcuts() { 84 _registerShortcuts() {
85 this._addShortcuts(Components.ShortcutsScreen.LayersPanelShortcuts.ResetView , this.resetAndNotify.bind(this)); 85 this._addShortcuts(UI.ShortcutsScreen.LayersPanelShortcuts.ResetView, this.r esetAndNotify.bind(this));
86 this._addShortcuts( 86 this._addShortcuts(
87 Components.ShortcutsScreen.LayersPanelShortcuts.PanMode, 87 UI.ShortcutsScreen.LayersPanelShortcuts.PanMode,
88 this._setMode.bind(this, LayerViewer.TransformController.Modes.Pan)); 88 this._setMode.bind(this, LayerViewer.TransformController.Modes.Pan));
89 this._addShortcuts( 89 this._addShortcuts(
90 Components.ShortcutsScreen.LayersPanelShortcuts.RotateMode, 90 UI.ShortcutsScreen.LayersPanelShortcuts.RotateMode,
91 this._setMode.bind(this, LayerViewer.TransformController.Modes.Rotate)); 91 this._setMode.bind(this, LayerViewer.TransformController.Modes.Rotate));
92 var zoomFactor = 1.1; 92 var zoomFactor = 1.1;
93 this._addShortcuts(UI.ShortcutsScreen.LayersPanelShortcuts.ZoomIn, this._onK eyboardZoom.bind(this, zoomFactor));
93 this._addShortcuts( 94 this._addShortcuts(
94 Components.ShortcutsScreen.LayersPanelShortcuts.ZoomIn, this._onKeyboard Zoom.bind(this, zoomFactor)); 95 UI.ShortcutsScreen.LayersPanelShortcuts.ZoomOut, this._onKeyboardZoom.bi nd(this, 1 / zoomFactor));
95 this._addShortcuts( 96 this._addShortcuts(UI.ShortcutsScreen.LayersPanelShortcuts.Up, this._onKeybo ardPanOrRotate.bind(this, 0, -1));
96 Components.ShortcutsScreen.LayersPanelShortcuts.ZoomOut, this._onKeyboar dZoom.bind(this, 1 / zoomFactor)); 97 this._addShortcuts(UI.ShortcutsScreen.LayersPanelShortcuts.Down, this._onKey boardPanOrRotate.bind(this, 0, 1));
97 this._addShortcuts( 98 this._addShortcuts(UI.ShortcutsScreen.LayersPanelShortcuts.Left, this._onKey boardPanOrRotate.bind(this, -1, 0));
98 Components.ShortcutsScreen.LayersPanelShortcuts.Up, this._onKeyboardPanO rRotate.bind(this, 0, -1)); 99 this._addShortcuts(UI.ShortcutsScreen.LayersPanelShortcuts.Right, this._onKe yboardPanOrRotate.bind(this, 1, 0));
99 this._addShortcuts(
100 Components.ShortcutsScreen.LayersPanelShortcuts.Down, this._onKeyboardPa nOrRotate.bind(this, 0, 1));
101 this._addShortcuts(
102 Components.ShortcutsScreen.LayersPanelShortcuts.Left, this._onKeyboardPa nOrRotate.bind(this, -1, 0));
103 this._addShortcuts(
104 Components.ShortcutsScreen.LayersPanelShortcuts.Right, this._onKeyboardP anOrRotate.bind(this, 1, 0));
105 } 100 }
106 101
107 _postChangeEvent() { 102 _postChangeEvent() {
108 this.dispatchEventToListeners(LayerViewer.TransformController.Events.Transfo rmChanged); 103 this.dispatchEventToListeners(LayerViewer.TransformController.Events.Transfo rmChanged);
109 } 104 }
110 105
111 _reset() { 106 _reset() {
112 this._scale = 1; 107 this._scale = 1;
113 this._offsetX = 0; 108 this._offsetX = 0;
114 this._offsetY = 0; 109 this._offsetY = 0;
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 TransformChanged: Symbol('TransformChanged') 310 TransformChanged: Symbol('TransformChanged')
316 }; 311 };
317 312
318 /** 313 /**
319 * @enum {string} 314 * @enum {string}
320 */ 315 */
321 LayerViewer.TransformController.Modes = { 316 LayerViewer.TransformController.Modes = {
322 Pan: 'Pan', 317 Pan: 'Pan',
323 Rotate: 'Rotate', 318 Rotate: 'Rotate',
324 }; 319 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698