aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Resizer.js
diff options
context:
space:
mode:
authorJohn Mayhew2012-07-09 17:28:24 -0700
committerJohn Mayhew2012-07-09 17:28:24 -0700
commit770bcb52422742ff741a88a75ecefbeb90bc9247 (patch)
tree64cb3e09a8daeb340261dd7f3869c73f7b90b643 /js/panels/Resizer.js
parent8c5ecaf90062f9e030386f338bdc19fd62b826c8 (diff)
parent2b2b5fbb4b6a786daa4e9d4ee9eba9ac78924842 (diff)
downloadninja-770bcb52422742ff741a88a75ecefbeb90bc9247.tar.gz
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal
Conflicts: manifest.json
Diffstat (limited to 'js/panels/Resizer.js')
-rwxr-xr-xjs/panels/Resizer.js77
1 files changed, 39 insertions, 38 deletions
diff --git a/js/panels/Resizer.js b/js/panels/Resizer.js
index 6bfcb9e7..fad45f24 100755
--- a/js/panels/Resizer.js
+++ b/js/panels/Resizer.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
@@ -71,7 +72,7 @@ exports.Resizer = Montage.create(Component, {
71 _isInversed: { 72 _isInversed: {
72 value: false 73 value: false
73 }, 74 },
74 75
75 isInversed: { 76 isInversed: {
76 get: function() { 77 get: function() {
77 return this._isInversed; 78 return this._isInversed;
@@ -81,11 +82,11 @@ exports.Resizer = Montage.create(Component, {
81 }, 82 },
82 serializable: true 83 serializable: true
83 }, 84 },
84 85
85 _isVertical: { 86 _isVertical: {
86 value: null 87 value: null
87 }, 88 },
88 89
89 isVertical: { 90 isVertical: {
90 get: function() { 91 get: function() {
91 return this._isVertical; 92 return this._isVertical;
@@ -97,22 +98,22 @@ exports.Resizer = Montage.create(Component, {
97 }, 98 },
98 99
99 _isPanel: { 100 _isPanel: {
100 value: true 101 value: true
101 }, 102 },
102 isPanel: { 103 isPanel: {
103 get: function() { 104 get: function() {
104 return this._isPanel; 105 return this._isPanel;
105 }, 106 },
106 set: function(value) { 107 set: function(value) {
107 this._isPanel = value; 108 this._isPanel = value;
108 }, 109 },
109 serializable: true 110 serializable: true
110 }, 111 },
111 112
112 _panel : { 113 _panel : {
113 value: null 114 value: null
114 }, 115 },
115 116
116 panel : { 117 panel : {
117 get: function() { 118 get: function() {
118 return this._panel; 119 return this._panel;
@@ -127,10 +128,10 @@ exports.Resizer = Montage.create(Component, {
127 height: { 128 height: {
128 value: null 129 value: null
129 }, 130 },
130 131
131 handleClick: { 132 handleClick: {
132 value: function() { 133 value: function() {
133 134
134 } 135 }
135 }, 136 },
136 137
@@ -147,14 +148,14 @@ exports.Resizer = Montage.create(Component, {
147 this._startPosition = e.x; 148 this._startPosition = e.x;
148 this._initDimension = this.panel.offsetWidth; 149 this._initDimension = this.panel.offsetWidth;
149 } 150 }
150 151
151 this.panel.classList.add("disableTransition"); 152 this.panel.classList.add("disableTransition");
152 window.addEventListener("mousemove", this, false); 153 window.addEventListener("mousemove", this, false);
153 window.addEventListener("mouseup", this, false); 154 window.addEventListener("mouseup", this, false);
154 NJevent("panelResizedStart", this) 155 NJevent("panelResizedStart", this)
155 } 156 }
156 }, 157 },
157 158
158 handleDblclick: { 159 handleDblclick: {
159 value : function() { 160 value : function() {
160 this.panel.addEventListener("webkitTransitionEnd", this, false); 161 this.panel.addEventListener("webkitTransitionEnd", this, false);
@@ -179,7 +180,7 @@ exports.Resizer = Montage.create(Component, {
179 180
180 } 181 }
181 }, 182 },
182 183
183 prepareForDraw: { 184 prepareForDraw: {
184 value: function() { 185 value: function() {
185 if(this.willSave) { 186 if(this.willSave) {
@@ -202,13 +203,13 @@ exports.Resizer = Montage.create(Component, {
202 this.element.addEventListener("dblclick", this, false); 203 this.element.addEventListener("dblclick", this, false);
203 } 204 }
204 }, 205 },
205 206
206 draw: { 207 draw: {
207 value: function() { 208 value: function() {
208 209
209 } 210 }
210 }, 211 },
211 212
212 handleMouseup: { 213 handleMouseup: {
213 value: function(e) { 214 value: function(e) {
214 e.preventDefault(); 215 e.preventDefault();
@@ -231,7 +232,7 @@ exports.Resizer = Montage.create(Component, {
231 NJevent("panelResizedEnd", this) 232 NJevent("panelResizedEnd", this)
232 } 233 }
233 }, 234 },
234 235
235 handleMousemove: { 236 handleMousemove: {
236 value: function(e) { 237 value: function(e) {
237 if(this.isVertical) { 238 if(this.isVertical) {
@@ -239,18 +240,18 @@ exports.Resizer = Montage.create(Component, {
239 this.panel.style.height = this.value + "px"; 240 this.panel.style.height = this.value + "px";
240 } 241 }
241 else { 242 else {
242 if (this.isPanel) { 243 if (this.isPanel) {
243 this.value = this._initDimension + (this._startPosition - e.x); 244 this.value = this._initDimension + (this._startPosition - e.x);
244 } else { 245 } else {
245 this.value = this._isInversed ? this._initDimension + (this._startPosition - e.x) : this._initDimension + (e.x - this._startPosition); 246 this.value = this._isInversed ? this._initDimension + (this._startPosition - e.x) : this._initDimension + (e.x - this._startPosition);
246 } 247 }
247 this.panel.style.width = this.value + "px"; 248 this.panel.style.width = this.value + "px";
248 } 249 }
249 250
250 if(this.redrawStage) { 251 if(this.redrawStage) {
251 this.application.ninja.stage.resizeCanvases = true; 252 this.application.ninja.stage.resizeCanvases = true;
252 } 253 }
253 254
254 NJevent("panelResizing", this); 255 NJevent("panelResizing", this);
255 } 256 }
256 } 257 }