aboutsummaryrefslogtreecommitdiff
path: root/js/components/popup.reel/popup.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/components/popup.reel/popup.js')
-rwxr-xr-xjs/components/popup.reel/popup.js359
1 files changed, 180 insertions, 179 deletions
diff --git a/js/components/popup.reel/popup.js b/js/components/popup.reel/popup.js
index c66a39fa..a3b1e188 100755
--- a/js/components/popup.reel/popup.js
+++ b/js/components/popup.reel/popup.js
@@ -1,24 +1,25 @@
1/* <copyright> 1/* <copyright>
2Copyright (c) 2012, Motorola Mobility, Inc 2Copyright (c) 2012, Motorola Mobility LLC.
3All Rights Reserved. 3All Rights Reserved.
4BSD License.
5 4
6Redistribution and use in source and binary forms, with or without 5Redistribution and use in source and binary forms, with or without
7modification, are permitted provided that the following conditions are met: 6modification, are permitted provided that the following conditions are met:
8 7
9 - Redistributions of source code must retain the above copyright notice, 8* Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 9 this list of conditions and the following disclaimer.
11 - Redistributions in binary form must reproduce the above copyright 10
12 notice, this list of conditions and the following disclaimer in the 11* Redistributions in binary form must reproduce the above copyright notice,
13 documentation and/or other materials provided with the distribution. 12 this list of conditions and the following disclaimer in the documentation
14 - Neither the name of Motorola Mobility nor the names of its contributors 13 and/or other materials provided with the distribution.
15 may be used to endorse or promote products derived from this software 14
16 without specific prior written permission. 15* Neither the name of Motorola Mobility LLC nor the names of its
16 contributors may be used to endorse or promote products derived from this
17 software without specific prior written permission.
17 18
18THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -30,237 +31,237 @@ POSSIBILITY OF SUCH DAMAGE.
30 31
31//////////////////////////////////////////////////////////////////////// 32////////////////////////////////////////////////////////////////////////
32// 33//
33var Montage = require("montage/core/core").Montage, 34var Montage = require("montage/core/core").Montage,
34 Component = require("montage/ui/component").Component; 35 Component = require("montage/ui/component").Component;
35//////////////////////////////////////////////////////////////////////// 36////////////////////////////////////////////////////////////////////////
36//Exporting as Popup 37//Exporting as Popup
37exports.Popup = Montage.create(Component, { 38exports.Popup = Montage.create(Component, {
38 //////////////////////////////////////////////////////////////////// 39 ////////////////////////////////////////////////////////////////////
39 // 40 //
40 hasTemplate: { 41 hasTemplate: {
41 value: true 42 value: true
42 }, 43 },
43 //////////////////////////////////////////////////////////////////// 44 ////////////////////////////////////////////////////////////////////
44 // 45 //
45 _content: { 46 _content: {
46 numerable: false, 47 numerable: false,
47 value: null 48 value: null
48 }, 49 },
49 //////////////////////////////////////////////////////////////////// 50 ////////////////////////////////////////////////////////////////////
50 // 51 //
51 content: { 52 content: {
52 enumerable: true, 53 enumerable: true,
53 get: function() { 54 get: function() {
54 return this._content; 55 return this._content;
55 }, 56 },
56 set: function(value) { 57 set: function(value) {
57 this._content = value; 58 this._content = value;
58 } 59 }
59 }, 60 },
60 //////////////////////////////////////////////////////////////////// 61 ////////////////////////////////////////////////////////////////////
61 // 62 //
62 _position: { 63 _position: {
63 numerable: false, 64 numerable: false,
64 value: null 65 value: null
65 }, 66 },
66 //////////////////////////////////////////////////////////////////// 67 ////////////////////////////////////////////////////////////////////
67 //Position is set with X,Y Coordinates from Top and Left respetively 68 //Position is set with X,Y Coordinates from Top and Left respetively
68 position: { 69 position: {
69 enumerable: true, 70 enumerable: true,
70 get: function() { 71 get: function() {
71 return this._position; 72 return this._position;
72 }, 73 },
73 set: function(value) { 74 set: function(value) {
74 this._position = value; 75 this._position = value;
75 if (value.x) { 76 if (value.x) {
76 this.element.style.left = value.x; 77 this.element.style.left = value.x;
77 } 78 }
78 if (value.y) { 79 if (value.y) {
79 this.element.style.top = value.y; 80 this.element.style.top = value.y;
80 } 81 }
81 } 82 }
82 }, 83 },
83 //////////////////////////////////////////////////////////////////// 84 ////////////////////////////////////////////////////////////////////
84 // 85 //
85 _tooltip: { 86 _tooltip: {
86 numerable: false, 87 numerable: false,
87 value: null 88 value: null
88 }, 89 },
89 //////////////////////////////////////////////////////////////////// 90 ////////////////////////////////////////////////////////////////////
90 // 91 //
91 tooltip: { 92 tooltip: {
92 enumerable: true, 93 enumerable: true,
93 get: function() { 94 get: function() {
94 return this._tooltip; 95 return this._tooltip;
95 }, 96 },
96 set: function(value) { 97 set: function(value) {
97 this._tooltip = value; 98 this._tooltip = value;
98 } 99 }
99 }, 100 },
100 //////////////////////////////////////////////////////////////////// 101 ////////////////////////////////////////////////////////////////////
101 // 102 //
102 prepareForDraw: { 103 prepareForDraw: {
103 enumerable: false, 104 enumerable: false,
104 value: function() { 105 value: function() {
105 this.element.style.pointerEvents = 'auto'; 106 this.element.style.pointerEvents = 'auto';
106 } 107 }
107 }, 108 },
108 //////////////////////////////////////////////////////////////////// 109 ////////////////////////////////////////////////////////////////////
109 // 110 //
110 willDraw: { 111 willDraw: {
111 enumerable: false, 112 enumerable: false,
112 value: function() { 113 value: function() {
113 // 114 //
114 } 115 }
115 }, 116 },
116 //////////////////////////////////////////////////////////////////// 117 ////////////////////////////////////////////////////////////////////
117 // 118 //
118 draw: { 119 draw: {
119 enumerable: false, 120 enumerable: false,
120 value: function() { 121 value: function() {
121 // 122 //
122 if (!this._content) { 123 if (!this._content) {
123 return; 124 return;
124 } 125 }
125 if (!this._content.style.width) { 126 if (!this._content.style.width) {
126 this._content.style.width = 'auto'; 127 this._content.style.width = 'auto';
127 } 128 }
128 if (!this._content.style.float) { 129 if (!this._content.style.float) {
129 this._content.style.float = 'left'; 130 this._content.style.float = 'left';
130 } 131 }
131 this.popupContent.appendChild(this._content); 132 this.popupContent.appendChild(this._content);
132 // 133 //
133 if (!this.tooltip) { 134 if (!this.tooltip) {
134 this.tooltip = {}; 135 this.tooltip = {};
135 this.tooltip.side = 'none'; 136 this.tooltip.side = 'none';
136 this.tooltip.align = 'none'; 137 this.tooltip.align = 'none';
137 } 138 }
138 switch (this.tooltip.side.toLowerCase()) { 139 switch (this.tooltip.side.toLowerCase()) {
139 case 'top': 140 case 'top':
140 this.element.style.marginTop = (this.popupTooltip.clientHeight) + 'px'; 141 this.element.style.marginTop = (this.popupTooltip.clientHeight) + 'px';
141 break; 142 break;
142 case 'bottom': 143 case 'bottom':
143 this.element.style.marginTop = -(this.element.clientHeight+(this.popupTooltip.clientHeight)) + 'px'; 144 this.element.style.marginTop = -(this.element.clientHeight+(this.popupTooltip.clientHeight)) + 'px';
144 break; 145 break;
145 case 'left': 146 case 'left':
146 this.element.style.marginLeft = (this.popupTooltip.clientWidth) + 'px'; 147 this.element.style.marginLeft = (this.popupTooltip.clientWidth) + 'px';
147 break; 148 break;
148 case 'right': 149 case 'right':
149 this.element.style.marginLeft = -(this.element.clientWidth + this.popupTooltip.clientWidth) + 'px'; 150 this.element.style.marginLeft = -(this.element.clientWidth + this.popupTooltip.clientWidth) + 'px';
150 break;