| Index: chrome/browser/resources/print_preview/data/coordinate2d.js
|
| diff --git a/chrome/browser/resources/print_preview/data/coordinate2d.js b/chrome/browser/resources/print_preview/data/coordinate2d.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..df7789c33a71903233f76c2828a81891d7363c44
|
| --- /dev/null
|
| +++ b/chrome/browser/resources/print_preview/data/coordinate2d.js
|
| @@ -0,0 +1,41 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +cr.define('print_preview', function() {
|
| + 'use strict';
|
| +
|
| + function Coordinate2d(x, y) {
|
| + this.x_ = x;
|
| + this.y_ = y;
|
| + };
|
| +
|
| + Coordinate2d.prototype = {
|
| + get x() {
|
| + return this.x_;
|
| + },
|
| +
|
| + get y() {
|
| + return this.y_;
|
| + },
|
| +
|
| + translate: function(x, y) {
|
| + return new Coordinate2d(this.x_ + x, this.y_ + y);
|
| + },
|
| +
|
| + scale: function(factor) {
|
| + return new Coordinate2d(this.x_ * factor, this.y_ * factor);
|
| + },
|
| +
|
| + equals: function(other) {
|
| + return other != null &&
|
| + this.x_ == other.x_ &&
|
| + this.y_ == other.y_;
|
| + }
|
| + };
|
| +
|
| + // Export
|
| + return {
|
| + Coordinate2d: Coordinate2d
|
| + };
|
| +});
|
|
|