OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 'strict'; | 6 'strict'; |
7 | 7 |
8 /** | 8 /** |
9 * @constructor | 9 * @constructor |
10 * This class represents a margin line and a textbox corresponding to that | 10 * This class represents a margin line and a textbox corresponding to that |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 */ | 169 */ |
170 onMouseDown_: function(e) { | 170 onMouseDown_: function(e) { |
171 if (e.button != 0) | 171 if (e.button != 0) |
172 return; | 172 return; |
173 if (e.target != this) | 173 if (e.target != this) |
174 return; | 174 return; |
175 var point = print_preview.MarginsUI.convert({x: e.x, y: e.y}); | 175 var point = print_preview.MarginsUI.convert({x: e.x, y: e.y}); |
176 this.originBeforeDragging = { x: this.offsetLeft, y: this.offsetTop }; | 176 this.originBeforeDragging = { x: this.offsetLeft, y: this.offsetTop }; |
177 this.mousePointerOffset = | 177 this.mousePointerOffset = |
178 { x: point.x - this.offsetLeft, y: point.y - this.offsetTop }; | 178 { x: point.x - this.offsetLeft, y: point.y - this.offsetTop }; |
179 cr.dispatchSimpleEvent(this, 'MarginsLineMouseDown'); | 179 cr.dispatchSimpleEvent(this, customEvents.MARGIN_LINE_MOUSE_DOWN); |
180 }, | 180 }, |
181 | 181 |
182 /** | 182 /** |
183 * Executes whenever a mouseup event occurs while |this| is dragged. | 183 * Executes whenever a mouseup event occurs while |this| is dragged. |
184 */ | 184 */ |
185 onMouseUp: function() { | 185 onMouseUp: function() { |
186 this.box_.onTextValueMayHaveChanged(); | 186 this.box_.onTextValueMayHaveChanged(); |
187 }, | 187 }, |
188 | 188 |
189 /** | 189 /** |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 | 287 |
288 this.rectangle = this.getCoordinates_(newMarginsRectangle); | 288 this.rectangle = this.getCoordinates_(newMarginsRectangle); |
289 this.drawDraggableArea_(); | 289 this.drawDraggableArea_(); |
290 }, | 290 }, |
291 }; | 291 }; |
292 | 292 |
293 return { | 293 return { |
294 MarginsUIPair: MarginsUIPair | 294 MarginsUIPair: MarginsUIPair |
295 }; | 295 }; |
296 }); | 296 }); |
OLD | NEW |