aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js44
-rwxr-xr-xjs/mediators/keyboard-mediator.js7
-rwxr-xr-xjs/panels/Splitter.js8
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js12
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js56
-rwxr-xr-xjs/stage/stage.reel/stage.js37
-rwxr-xr-xjs/tools/PanTool.js6
7 files changed, 128 insertions, 42 deletions
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index 87151964..9c4f31b7 100755
--- a/js/helper-classes/3D/draw-utils.js
+++ b/js/helper-classes/3D/draw-utils.js
@@ -73,6 +73,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
73 73
74 // Properties that require element planes to be updated 74 // Properties that require element planes to be updated
75 _updatePlaneProps : {value: ["matrix", "left", "top", "width", "height"], writable: false }, 75 _updatePlaneProps : {value: ["matrix", "left", "top", "width", "height"], writable: false },
76 _recalculateScrollOffsets : { value: false },
76 77
77 /////////////////////////////////////////////////////////////////////// 78 ///////////////////////////////////////////////////////////////////////
78 // Property accessors 79 // Property accessors
@@ -117,7 +118,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
117 }, 118 },
118 119
119 initializeFromDocument:{ 120 initializeFromDocument:{
120 value:function(adjustScrollOffsets){ 121 value:function(adjustScrollOffsets, useStageValues){
121 var i, 122 var i,
122 documentRootChildren = this.application.ninja.currentDocument.model.views.design.getLiveNodeList(true), 123 documentRootChildren = this.application.ninja.currentDocument.model.views.design.getLiveNodeList(true),
123 stage = this.application.ninja.stage, 124 stage = this.application.ninja.stage,
@@ -141,6 +142,13 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
141 t, 142 t,
142 plane, 143 plane,
143 elt; 144 elt;
145 if(useStageValues) {
146 initL = stage.userPaddingLeft;
147 initT = stage.userPaddingTop;
148 minLeft = stage.templateLeft;
149 minTop = stage.templateTop;
150 this._recalculateScrollOffsets = false;
151 }
144 for(i=0; i<len; i++) { 152 for(i=0; i<len; i++) {
145 elt = documentRootChildren[i]; 153 elt = documentRootChildren[i];
146 plane = this.addElement(elt); 154 plane = this.addElement(elt);
@@ -149,17 +157,19 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
149 t = plane._rect.m_top - docTop; 157 t = plane._rect.m_top - docTop;
150 if(l < minLeft) { 158 if(l < minLeft) {
151 minLeft = l; 159 minLeft = l;
160 stage.minLeftElement = elt;
152 } 161 }
153 if(t < minTop) { 162 if(t < minTop) {
154 minTop = t; 163 minTop = t;
164 stage.minTopElement = elt;
155 } 165 }
156 } 166 }
157 } 167 }
158 if(minLeft !== initL) { 168 if(minLeft !== initL) {
159 stage.userPaddingLeft = minLeft; 169 stage.userPaddingLeft = (minLeft < 0) ? minLeft : 0;
160 } 170 }
161 if(minTop !== initT) { 171 if(minTop !== initT) {
162 stage.userPaddingTop = minTop; 172 stage.userPaddingTop = (minTop < 0) ? minTop : 0;
163 } 173 }
164 } 174 }
165 } 175 }
@@ -274,9 +284,11 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
274 t, 284 t,
275 plane, 285 plane,
276 changed = false, 286 changed = false,
287 elt,
277 adjustStagePadding = !isChanging || (event.detail.data.prop !== "matrix"); 288 adjustStagePadding = !isChanging || (event.detail.data.prop !== "matrix");
278 for(var i=0; i < len; i++) { 289 for(var i=0; i < len; i++) {
279 plane = els[i].elementModel.props3D.elementPlane; 290 elt = els[i];
291 plane = elt.elementModel.props3D.elementPlane;
280 if(plane) { 292 if(plane) {
281 plane.init(); 293 plane.init();
282 if(adjustStagePadding) { 294 if(adjustStagePadding) {
@@ -284,22 +296,34 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
284 t = plane._rect.m_top - docTop; 296 t = plane._rect.m_top - docTop;
285 if(l < minLeft) { 297 if(l < minLeft) {
286 minLeft = l; 298 minLeft = l;
299 stage.minLeftElement = elt;
300 } else if((elt === stage.minLeftElement) && (l > minLeft)) {
301 this._recalculateScrollOffsets = true;
287 } 302 }
303
288 if(t < minTop) { 304 if(t < minTop) {
289 minTop = t; 305 minTop = t;
306 stage.minTopElement = elt;
307 } else if((elt === stage.minTopElement) && (t > minTop)) {
308 this._recalculateScrollOffsets = true;
290 } 309 }
291 } 310 }
292 } 311 }
293 } 312 }
294 313
295 if(adjustStagePadding) { 314 if(adjustStagePadding) {
296 if(minLeft !== stage.userPaddingLeft) { 315 if(this._recalculateScrollOffsets && !isChanging) {
297 stage.userPaddingLeft = minLeft; 316 this.initializeFromDocument(true, true);
298 changed = true;
299 }
300 if(minTop !== stage.userPaddingTop) {
301 stage.userPaddingTop = minTop;
302 changed = true; 317 changed = true;
318 } else {
319 if(minLeft !== stage.userPaddingLeft) {
320 stage.userPaddingLeft = minLeft;
321 changed = true;
322 }
323 if(minTop !== stage.userPaddingTop) {
324 stage.userPaddingTop = minTop;
325 changed = true;
326 }
303 } 327 }
304 } 328 }
305 329
diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js
index c7288d28..18568619 100755
--- a/js/mediators/keyboard-mediator.js
+++ b/js/mediators/keyboard-mediator.js
@@ -50,6 +50,7 @@ var Keyboard = exports.Keyboard = {
50 X:88, 50 X:88,
51 Y:89, 51 Y:89,
52 Z:90, 52 Z:90,
53 F5:116,
53 F6:117, 54 F6:117,
54 PLUS:187, 55 PLUS:187,
55 MINUS:189 56 MINUS:189
@@ -218,7 +219,11 @@ exports.KeyboardMediator = Montage.create(Component, {
218 219
219 // F6 keyboard shortcut to add a keyframe to the timeline 220 // F6 keyboard shortcut to add a keyframe to the timeline
220 if (evt.keyCode == Keyboard.F6) { 221 if (evt.keyCode == Keyboard.F6) {
221 this.application.ninja.timeline.handleKeyframeShortcut(); 222 this.application.ninja.timeline.handleKeyframeShortcut("insert");
223 return;
224 }
225 if (evt.keyCode == Keyboard.F5) {
226 this.application.ninja.timeline.handleKeyframeShortcut("remove");
222 return; 227 return;
223 } 228 }
224 229
diff --git a/js/panels/Splitter.js b/js/panels/Splitter.js
index c6d46911..4f2a137e 100755
--- a/js/panels/Splitter.js
+++ b/js/panels/Splitter.js
@@ -156,7 +156,7 @@ exports.Splitter = Montage.create(Component, {
156 } 156 }
157 }, 157 },
158 restore:{ 158 restore:{
159 value: function() { 159 value: function(onSwitchFromCodeDocument) {
160 //Get splitter initial value from SettingManager 160 //Get splitter initial value from SettingManager
161 var storedData = this.application.localStorage.getItem(this.element.getAttribute("data-montage-id")), temp = this.collapsed; 161 var storedData = this.application.localStorage.getItem(this.element.getAttribute("data-montage-id")), temp = this.collapsed;
162 if(storedData && this.element.getAttribute("data-montage-id") !== null) { 162 if(storedData && this.element.getAttribute("data-montage-id") !== null) {
@@ -172,7 +172,11 @@ exports.Splitter = Montage.create(Component, {
172 this.panel.addEventListener("webkitTransitionEnd", this, false); 172 this.panel.addEventListener("webkitTransitionEnd", this, false);
173 } 173 }
174 this.disabled = false; 174 this.disabled = false;
175 this.needsDraw = true; 175 if(onSwitchFromCodeDocument) {
176 this.draw(); // When switching from code document, draw immediately so stage size is correct
177 } else {
178 this.needsDraw = true;
179 }
176 } 180 }
177 } 181 }
178 } 182 }
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 2cbd9e2b..53a3b299 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -869,12 +869,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
869 this.checkable_lock.addEventListener("click",this.handleLockLayerClick.bind(this),false); 869 this.checkable_lock.addEventListener("click",this.handleLockLayerClick.bind(this),false);
870 this.checkable_visible.addEventListener("click",this.handleLayerVisibleClick.bind(this),false); 870 this.checkable_visible.addEventListener("click",this.handleLayerVisibleClick.bind(this),false);
871 871
872 // Bind some bindings
873 Object.defineBinding(this, "currentSelectedContainer", {
874 boundObject:this.application.ninja,
875 boundObjectPropertyPath:"currentSelectedContainer",
876 oneway:true
877 });
878 this.addPropertyChangeListener("currentDocument.model.domContainer", this); 872 this.addPropertyChangeListener("currentDocument.model.domContainer", this);
879 873
880 // Start the panel out in disabled mode by default 874 // Start the panel out in disabled mode by default
@@ -1034,17 +1028,15 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1034 }, 1028 },
1035 1029
1036 handleKeyframeShortcut:{ 1030 handleKeyframeShortcut:{
1037 value:function(){ 1031 value:function(action){
1038 //console.log(this.currentLayersSelected);
1039 //console.log(this.trackRepetition);
1040 var tempEv = {}; 1032 var tempEv = {};