[Eraser strings] Remove unused Supervised User infobar and corresponding strings
[chromium-blink-merge.git] / chrome / browser / resources / print_preview / data / coordinate2d.js
blob4b10af63808508e18669be00dfaab9f0d1986602
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.
5 cr.define('print_preview', function() {
6 'use strict';
8 /**
9 * Immutable two dimensional point in space. The units of the dimensions are
10 * undefined.
11 * @param {number} x X-dimension of the point.
12 * @param {number} y Y-dimension of the point.
13 * @constructor
15 function Coordinate2d(x, y) {
16 /**
17 * X-dimension of the point.
18 * @type {number}
19 * @private
21 this.x_ = x;
23 /**
24 * Y-dimension of the point.
25 * @type {number}
26 * @private
28 this.y_ = y;
31 Coordinate2d.prototype = {
32 /** @return {number} X-dimension of the point. */
33 get x() {
34 return this.x_;
37 /** @return {number} Y-dimension of the point. */
38 get y() {
39 return this.y_;
42 /**
43 * @param {number} x Amount to translate in the X dimension.
44 * @param {number} y Amount to translate in the Y dimension.
45 * @return {!print_preview.Coordinate2d} A new two-dimensional point
46 * translated along the X and Y dimensions.
48 translate: function(x, y) {
49 return new Coordinate2d(this.x_ + x, this.y_ + y);
52 /**
53 * @param {number} factor Amount to scale the X and Y dimensions.
54 * @return {!print_preview.Coordinate2d} A new two-dimensional point scaled
55 * by the given factor.
57 scale: function(factor) {
58 return new Coordinate2d(this.x_ * factor, this.y_ * factor);
61 /**
62 * @param {print_preview.Coordinate2d} other The point to compare against.
63 * @return {boolean} Whether another point is equal to this one.
65 equals: function(other) {
66 return other != null &&
67 this.x_ == other.x_ &&
68 this.y_ == other.y_;
72 // Export
73 return {
74 Coordinate2d: Coordinate2d
76 });