diff options
author | Valerio Virgillito | 2012-02-01 00:09:27 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-01 00:09:27 -0800 |
commit | 8592cfb89db05f0e52d8c1b8c7046e6f49e3522d (patch) | |
tree | a6f9b5adfe16fd6232708f8a2345cd79056caca9 /node_modules/montage-user/core/geometry/point.js | |
parent | c6d1a1da9e7cdf477daf32410d80691eb1e828d5 (diff) | |
download | ninja-8592cfb89db05f0e52d8c1b8c7046e6f49e3522d.tar.gz |
Adding a montage framework copy for the user document
Adding a new montage copy containing the latest version of montage to use the new native widgets
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'node_modules/montage-user/core/geometry/point.js')
-rwxr-xr-x | node_modules/montage-user/core/geometry/point.js | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/node_modules/montage-user/core/geometry/point.js b/node_modules/montage-user/core/geometry/point.js new file mode 100755 index 00000000..cec433be --- /dev/null +++ b/node_modules/montage-user/core/geometry/point.js | |||
@@ -0,0 +1,66 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | /** | ||
7 | @module montage/core/geometry/point | ||
8 | @requires montage/core/core | ||
9 | */ | ||
10 | var Montage = require("montage").Montage; | ||
11 | /** | ||
12 | @class module:montage/core/geometry/point.Point | ||
13 | @extends module:montage/core/core.Montage | ||
14 | */ | ||
15 | |||
16 | exports.Point = Montage.create(Montage, /** @lends module:montage/core/geometry/point.Point# */ { | ||
17 | init: { | ||
18 | enumerable: false, | ||
19 | value: function(x, y) { | ||
20 | this.x = x === null ? 0 : x; | ||
21 | this.y = y === null ? 0 : y; | ||
22 | return this; | ||
23 | } | ||
24 | }, | ||
25 | /** | ||
26 | Interpolates between two points. | ||
27 | @function | ||
28 | @param {Axis} percent The interpolation percentage. | ||
29 | @param {Axis} point0 The 0 interpolation point. | ||
30 | @param {Axis} point1 The 1 interpolation point. | ||
31 | @param {Axis} precision The interpolation precision. | ||
32 | @returns Montage.create(Point).init(xValue, yValue) | ||
33 | */ | ||
34 | interpolate: { | ||
35 | enumerable: false, | ||
36 | value: function(percent, point0, point1, precision) { | ||
37 | var xValue, | ||
38 | yValue; | ||
39 | xValue = point0.x + (point1.x - point0.x) * percent; | ||
40 | yValue = point0.y + (point1.y - point0.y) * percent; | ||
41 | if (precision > 0) { | ||
42 | xValue = Math.round(xValue * precision) / precision; | ||
43 | yValue = Math.round(yValue * precision) / precision; | ||
44 | } | ||
45 | return exports.Point.create().init(xValue, yValue); | ||
46 | } | ||
47 | }, | ||
48 | /** | ||
49 | The x axis point. | ||
50 | @type {Number} | ||
51 | @default 0 | ||
52 | */ | ||
53 | x: { | ||
54 | enumerable: true, | ||
55 | value: 0 | ||
56 | }, | ||
57 | /** | ||
58 | The y axis point. | ||
59 | @type {Number} | ||
60 | @default 0 | ||
61 | */ | ||
62 | y: { | ||
63 | enumerable: true, | ||
64 | value: 0 | ||
65 | } | ||
66 | }); | ||