OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 cr.define('print_preview', function() { |
| 6 'use strict'; |
| 7 |
| 8 function Coordinate2d(x, y) { |
| 9 this.x_ = x; |
| 10 this.y_ = y; |
| 11 }; |
| 12 |
| 13 Coordinate2d.prototype = { |
| 14 get x() { |
| 15 return this.x_; |
| 16 }, |
| 17 |
| 18 get y() { |
| 19 return this.y_; |
| 20 }, |
| 21 |
| 22 translate: function(x, y) { |
| 23 return new Coordinate2d(this.x_ + x, this.y_ + y); |
| 24 }, |
| 25 |
| 26 scale: function(factor) { |
| 27 return new Coordinate2d(this.x_ * factor, this.y_ * factor); |
| 28 }, |
| 29 |
| 30 equals: function(other) { |
| 31 return other != null && |
| 32 this.x_ == other.x_ && |
| 33 this.y_ == other.y_; |
| 34 } |
| 35 }; |
| 36 |
| 37 // Export |
| 38 return { |
| 39 Coordinate2d: Coordinate2d |
| 40 }; |
| 41 }); |
OLD | NEW |