diff options
Diffstat (limited to 'js/mediators')
-rwxr-xr-x | js/mediators/element-mediator.js | 56 | ||||
-rwxr-xr-x | js/mediators/keyboard-mediator.js | 7 |
2 files changed, 33 insertions, 30 deletions
diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index 017ed20a..99d2f822 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js | |||
@@ -294,10 +294,10 @@ exports.ElementMediator = Montage.create(Component, { | |||
294 | @param stageRedraw: *OPTIONAL*: True. If set to false the stage will not redraw the selection/outline | 294 | @param stageRedraw: *OPTIONAL*: True. If set to false the stage will not redraw the selection/outline |
295 | */ | 295 | */ |
296 | setColor: { | 296 | setColor: { |
297 | value: function(els, value, isFill, eventType, source, currentValue) { | 297 | value: function(els, value, isFill, eventType, source, currentValue,borderSide) { |
298 | 298 | ||
299 | if(eventType === "Changing") { | 299 | if(eventType === "Changing") { |
300 | this._setColor(els, value, isFill, eventType, source); | 300 | this._setColor(els, value, isFill, eventType, source,borderSide); |
301 | } else { | 301 | } else { |
302 | // Calculate currentValue if not found for each element | 302 | // Calculate currentValue if not found for each element |
303 | if(!currentValue) { | 303 | if(!currentValue) { |
@@ -316,11 +316,12 @@ exports.ElementMediator = Montage.create(Component, { | |||
316 | _source: { value: "undo-redo"}, | 316 | _source: { value: "undo-redo"}, |
317 | description: { value: "Set Color"}, | 317 | description: { value: "Set Color"}, |
318 | receiver: { value: this}, | 318 | receiver: { value: this}, |
319 | _borderSide: { value: borderSide}, | ||
319 | 320 | ||
320 | execute: { | 321 | execute: { |
321 | value: function(senderObject) { | 322 | value: function(senderObject) { |
322 | if(senderObject) this._source = senderObject; | 323 | if(senderObject) this._source = senderObject; |
323 | this.receiver._setColor(this._els, this._value, this._isFill, this._eventType, this._source); | 324 | this.receiver._setColor(this._els, this._value, this._isFill, this._eventType, this._source,this._borderSide); |
324 | this._source = "undo-redo"; | 325 | this._source = "undo-redo"; |
325 | return ""; | 326 | return ""; |
326 | } | 327 | } |
@@ -342,12 +343,12 @@ exports.ElementMediator = Montage.create(Component, { | |||
342 | }, | 343 | }, |
343 | 344 | ||
344 | _setColor: { | 345 | _setColor: { |
345 | value: function(els, value, isFill, eventType, source) { | 346 | value: function(els, value, isFill, eventType, source,borderSide) { |
346 | for(var i=0, item; item = els[i]; i++) { | 347 | for(var i=0, item; item = els[i]; i++) { |
347 | item.elementModel.controller["setColor"](item, value, isFill); | 348 | item.elementModel.controller["setColor"](item, value, isFill,borderSide); |
348 | } | 349 | } |
349 | 350 | ||
350 | NJevent("element" + eventType, {type : "setColor", source: source, data: {"els": els, "prop": "color", "value": value, "isFill": isFill}, redraw: null}); | 351 | NJevent("element" + eventType, {type : "setColor", source: source, data: {"els": els, "prop": "color", "value": value, "isFill": isFill, "borderSide":borderSide}, redraw: null}); |
351 | } | 352 | } |
352 | }, | 353 | }, |
353 | 354 | ||
@@ -482,30 +483,25 @@ exports.ElementMediator = Montage.create(Component, { | |||
482 | }, | 483 | }, |
483 | 484 | ||
484 | reArrangeDOM:{ | 485 | reArrangeDOM:{ |
485 | value: function(layersDraggedArray, layerDroppedAfter) { | 486 | value: function(arrLayersDragged, dropTargetElement) { |
486 | var documentRoot,length; | 487 | var i = 0, |
487 | 488 | arrLayersDraggedLength = arrLayersDragged.length, | |
488 | documentRoot = this.application.ninja.currentDocument.model.documentRoot; | 489 | targetParentNode, |
489 | length = layersDraggedArray.length; | 490 | targetElement; |
490 | 491 | ||
491 | for(var i=0; documentRoot.children[i]; i++) { | 492 | if (arrLayersDraggedLength === 0) { |
492 | if(documentRoot.children[i] === layerDroppedAfter.layerData.elementsList[0]) { | 493 | // Nothing was dragged, so return. |
493 | if(length >0){ | 494 | return; |
494 | documentRoot.children[i].parentNode.insertBefore(layersDraggedArray[length-1].layerData.elementsList[0], documentRoot.children[i]); | 495 | } |
495 | } | 496 | |
496 | 497 | // Get the target parent node (this will be the parentNode of any of the dragging items) | |
497 | /* Will require for Multiple Drag n Drop */ | 498 | targetParentNode = arrLayersDragged[0].parentNode; |
498 | //length = length-1; | 499 | |
499 | //index = i; | 500 | |
500 | //if(length>0) { | 501 | // Loop through arrLayersDragged and insertBefore the drop target element |
501 | //while(layersDraggedArray[length]) { | 502 | for (i = 0; i < arrLayersDraggedLength; i++) { |
502 | //documentRoot.children[index].parentNode.insertBefore(layersDraggedArray[length-1].layerData.elementsList[0],documentRoot.children[k].nextSibling); | 503 | targetParentNode.insertBefore(arrLayersDragged[i], dropTargetElement); |
503 | //length--; | 504 | } |
504 | //index++; | ||
505 | //} | ||
506 | //} | ||
507 | } | ||
508 | } | ||
509 | } | 505 | } |
510 | } | 506 | } |
511 | }); \ No newline at end of file | 507 | }); \ No newline at end of file |
diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js index 196c8a4b..cce053bc 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 | F6:117, | ||
53 | PLUS:187, | 54 | PLUS:187, |
54 | MINUS:189 | 55 | MINUS:189 |
55 | }; | 56 | }; |
@@ -215,6 +216,12 @@ exports.KeyboardMediator = Montage.create(Component, { | |||
215 | return; | 216 | return; |
216 | } | 217 | } |
217 | 218 | ||
219 | // F6 keyboard shortcut to add a keyframe to the timeline | ||
220 | if (evt.keyCode == Keyboard.F6) { | ||
221 | this.application.ninja.timeline.handleKeyframeShortcut(); | ||
222 | return; | ||
223 | } | ||
224 | |||
218 | // Check if cmd+a/ctrl+a for Select All | 225 | // Check if cmd+a/ctrl+a for Select All |
219 | if((evt.keyCode == Keyboard.A) && (evt.ctrlKey || evt.metaKey)) { | 226 | if((evt.keyCode == Keyboard.A) && (evt.ctrlKey || evt.metaKey)) { |
220 | NJevent("selectAll"); | 227 | NJevent("selectAll"); |