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

Side by Side Diff: chrome/browser/resources/print_preview/previewarea/margin_control.js

Issue 10450022: Print Preview Print Destination Search Widget (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Set --bary flag Created 8 years, 6 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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('print_preview', function() { 5 cr.define('print_preview', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Draggable control for setting a page margin. 9 * Draggable control for setting a page margin.
10 * @param {print_preview.ticket_items.CustomMargins.Orientation} orientation 10 * @param {!print_preview.ticket_items.CustomMargins.Orientation} orientation
11 * Orientation of the margin control that determines where the margin 11 * Orientation of the margin control that determines where the margin
12 * textbox will be placed. 12 * textbox will be placed.
13 * @constructor 13 * @constructor
14 * @extends {print_preview.Component} 14 * @extends {print_preview.Component}
15 */ 15 */
16 function MarginControl(orientation) { 16 function MarginControl(orientation) {
17 print_preview.Component.call(this); 17 print_preview.Component.call(this);
18 18
19 /** 19 /**
20 * Determines where the margin textbox will be placed. 20 * Determines where the margin textbox will be placed.
21 * @type {print_preview.ticket_items.CustomMargins.Orientation} 21 * @type {!print_preview.ticket_items.CustomMargins.Orientation}
22 * @private 22 * @private
23 */ 23 */
24 this.orientation_ = orientation; 24 this.orientation_ = orientation;
25 25
26 /** 26 /**
27 * Position of the margin control in points. 27 * Position of the margin control in points.
28 * @type {number} 28 * @type {number}
29 * @private 29 * @private
30 */ 30 */
31 this.positionInPts_ = 0; 31 this.positionInPts_ = 0;
(...skipping 28 matching lines...) Expand all
60 60
61 /** 61 /**
62 * Position of the mouse when the dragging starts. 62 * Position of the mouse when the dragging starts.
63 * @type {print_preview.Coordinate2d} 63 * @type {print_preview.Coordinate2d}
64 * @private 64 * @private
65 */ 65 */
66 this.mouseStartPositionInPixels_ = null; 66 this.mouseStartPositionInPixels_ = null;
67 67
68 /** 68 /**
69 * Processing timeout for the textbox. 69 * Processing timeout for the textbox.
70 * @type {Object} 70 * @type {?number}
71 * @private 71 * @private
72 */ 72 */
73 this.textTimeout_ = null; 73 this.textTimeout_ = null;
74 74
75 /** 75 /**
76 * Value of the textbox when the timeout was started. 76 * Value of the textbox when the timeout was started.
77 * @type {?string} 77 * @type {?string}
78 * @private 78 * @private
79 */ 79 */
80 this.preTimeoutValue_ = null; 80 this.preTimeoutValue_ = null;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 TEXTBOX: 'margin-control-textbox', 133 TEXTBOX: 'margin-control-textbox',
134 INVALID: 'invalid', 134 INVALID: 'invalid',
135 INVISIBLE: 'invisible', 135 INVISIBLE: 'invisible',
136 DISABLED: 'margin-control-disabled', 136 DISABLED: 'margin-control-disabled',
137 DRAGGING: 'margin-control-dragging', 137 DRAGGING: 'margin-control-dragging',
138 LINE: 'margin-control-line' 138 LINE: 'margin-control-line'
139 }; 139 };
140 140
141 /** 141 /**
142 * Map from orientation to CSS class name. 142 * Map from orientation to CSS class name.
143 * @type {object.< 143 * @type {!Object.<
144 * print_preview.ticket_items.CustomMargins.Orientation, 144 * !print_preview.ticket_items.CustomMargins.Orientation,
145 * MarginControl.Classes_>} 145 * !MarginControl.Classes_>}
146 * @private 146 * @private
147 */ 147 */
148 MarginControl.OrientationToClass_ = {}; 148 MarginControl.OrientationToClass_ = {};
149 MarginControl.OrientationToClass_[ 149 MarginControl.OrientationToClass_[
150 print_preview.ticket_items.CustomMargins.Orientation.TOP] = 150 print_preview.ticket_items.CustomMargins.Orientation.TOP] =
151 MarginControl.Classes_.TOP; 151 MarginControl.Classes_.TOP;
152 MarginControl.OrientationToClass_[ 152 MarginControl.OrientationToClass_[
153 print_preview.ticket_items.CustomMargins.Orientation.RIGHT] = 153 print_preview.ticket_items.CustomMargins.Orientation.RIGHT] =
154 MarginControl.Classes_.RIGHT; 154 MarginControl.Classes_.RIGHT;
155 MarginControl.OrientationToClass_[ 155 MarginControl.OrientationToClass_[
(...skipping 22 matching lines...) Expand all
178 178
179 MarginControl.prototype = { 179 MarginControl.prototype = {
180 __proto__: print_preview.Component.prototype, 180 __proto__: print_preview.Component.prototype,
181 181
182 /** @return {boolean} Whether this margin control is in focus. */ 182 /** @return {boolean} Whether this margin control is in focus. */
183 getIsFocused: function() { 183 getIsFocused: function() {
184 return this.isFocused_; 184 return this.isFocused_;
185 }, 185 },
186 186
187 /** 187 /**
188 * @return {print_preview.ticket_items.CustomMargins.Orientation} 188 * @return {!print_preview.ticket_items.CustomMargins.Orientation}
189 * Orientation of the margin control. 189 * Orientation of the margin control.
190 */ 190 */
191 getOrientation: function() { 191 getOrientation: function() {
192 return this.orientation_; 192 return this.orientation_;
193 }, 193 },
194 194
195 /** 195 /**
196 * @param {number} scaleTransform New scale transform of the margin control. 196 * @param {number} scaleTransform New scale transform of the margin control.
197 */ 197 */
198 setScaleTransform: function(scaleTransform) { 198 setScaleTransform: function(scaleTransform) {
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 this.setIsFocused_(false); 458 this.setIsFocused_(false);
459 cr.dispatchSimpleEvent(this, MarginControl.EventType.TEXT_CHANGE); 459 cr.dispatchSimpleEvent(this, MarginControl.EventType.TEXT_CHANGE);
460 } 460 }
461 }; 461 };
462 462
463 // Export 463 // Export
464 return { 464 return {
465 MarginControl: MarginControl 465 MarginControl: MarginControl
466 }; 466 };
467 }); 467 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698