aboutsummaryrefslogtreecommitdiff
path: root/js/mediators
diff options
context:
space:
mode:
Diffstat (limited to 'js/mediators')
-rwxr-xr-xjs/mediators/element-mediator.js22
-rwxr-xr-xjs/mediators/keyboard-mediator.js9
2 files changed, 29 insertions, 2 deletions
diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js
index 95aec2a3..7dad7aca 100755
--- a/js/mediators/element-mediator.js
+++ b/js/mediators/element-mediator.js
@@ -101,7 +101,10 @@ exports.ElementMediator = Montage.create(NJComponent, {
101 { 101 {
102 el.elementModel.controller["set3DProperties"](el, [p3d], 0, true); 102 el.elementModel.controller["set3DProperties"](el, [p3d], 0, true);
103 } 103 }
104 if(!noEvent) NJevent("elementAdded", el); 104 if(!noEvent) {
105 this.application.ninja.documentController.activeDocument.markEdited();
106 NJevent("elementAdded", el);
107 }
105 } 108 }
106 }, 109 },
107 110
@@ -127,6 +130,7 @@ exports.ElementMediator = Montage.create(NJComponent, {
127 _removeElement: { 130 _removeElement: {
128 value: function(el, rules) { 131 value: function(el, rules) {
129 ElementController.removeElement(el, rules); 132 ElementController.removeElement(el, rules);
133 this.application.ninja.documentController.activeDocument.markEdited();
130 NJevent("elementDeleted", el); 134 NJevent("elementDeleted", el);
131 } 135 }
132 }, 136 },
@@ -185,6 +189,8 @@ exports.ElementMediator = Montage.create(NJComponent, {
185 NJUtils.makeElementModel(el, "Canvas", "block", true); 189 NJUtils.makeElementModel(el, "Canvas", "block", true);
186 } 190 }
187 191
192 this.application.ninja.documentController.activeDocument.markEdited();
193
188 return el.elementModel.controller["setShapeProperty"](el, prop, value); 194 return el.elementModel.controller["setShapeProperty"](el, prop, value);
189 } 195 }
190 }, 196 },
@@ -252,6 +258,8 @@ exports.ElementMediator = Montage.create(NJComponent, {
252 258
253 item.elementModel.controller["setAttribute"](item, att, value); 259 item.elementModel.controller["setAttribute"](item, att, value);
254 260
261 this.application.ninja.documentController.activeDocument.markEdited();
262
255 NJevent("attribute" + eventType, {type : "setAttribute", source: source, data: {"els": el, "prop": att, "value": value}, redraw: null}); 263 NJevent("attribute" + eventType, {type : "setAttribute", source: source, data: {"els": el, "prop": att, "value": value}, redraw: null});
256 } 264 }
257 }, 265 },
@@ -324,6 +332,8 @@ exports.ElementMediator = Montage.create(NJComponent, {
324 el.elementModel.controller["setProperty"](el, p, value[i]); 332 el.elementModel.controller["setProperty"](el, p, value[i]);
325 } 333 }
326 334
335 this.application.ninja.documentController.activeDocument.markEdited();
336
327 NJevent("element" + eventType, {type : "setProperty", source: source, data: {"els": els, "prop": p, "value": value}, redraw: null}); 337 NJevent("element" + eventType, {type : "setProperty", source: source, data: {"els": els, "prop": p, "value": value}, redraw: null});
328 } 338 }
329 }, 339 },
@@ -383,6 +393,8 @@ exports.ElementMediator = Montage.create(NJComponent, {
383 el.elementModel.controller["setProperties"](el, props, i); 393 el.elementModel.controller["setProperties"](el, props, i);
384 } 394 }
385 395
396 this.application.ninja.documentController.activeDocument.markEdited();
397
386 NJevent("element" + eventType, {type : "setProperties", source: source, data: {"els": els, "prop": props, "value": props}, redraw: null}); 398 NJevent("element" + eventType, {type : "setProperties", source: source, data: {"els": els, "prop": props, "value": props}, redraw: null});
387 } 399 }
388 }, 400 },
@@ -455,6 +467,8 @@ exports.ElementMediator = Montage.create(NJComponent, {
455 el.elementModel.controller["set3DProperties"](el, props, i, update3DModel); 467 el.elementModel.controller["set3DProperties"](el, props, i, update3DModel);
456 } 468 }
457 469
470 this.application.ninja.documentController.activeDocument.markEdited();
471
458 NJevent("element" + eventType, {type : "set3DProperties", source: source, data: {"els": els, "prop": "matrix", "value": props}, redraw: null}); 472 NJevent("element" + eventType, {type : "set3DProperties", source: source, data: {"els": els, "prop": "matrix", "value": props}, redraw: null});
459 } 473 }
460 }, 474 },
@@ -539,6 +553,8 @@ exports.ElementMediator = Montage.create(NJComponent, {
539 el.elementModel.controller["setColor"](el, value, isFill); 553 el.elementModel.controller["setColor"](el, value, isFill);
540 } 554 }
541 555
556 this.application.ninja.documentController.activeDocument.markEdited();
557
542 NJevent("element" + eventType, {type : "setColor", source: source, data: {"els": els, "prop": "color", "value": value, "isFill": isFill}, redraw: null}); 558 NJevent("element" + eventType, {type : "setColor", source: source, data: {"els": els, "prop": "color", "value": value, "isFill": isFill}, redraw: null});
543 } 559 }
544 }, 560 },
@@ -620,6 +636,8 @@ exports.ElementMediator = Montage.create(NJComponent, {
620 el.elementModel.controller["setStroke"](el, value); 636 el.elementModel.controller["setStroke"](el, value);
621 } 637 }
622 638
639 this.application.ninja.documentController.activeDocument.markEdited();
640
623 NJevent("element" + eventType, {type : "setStroke", source: source, data: {"els": els, "prop": "stroke", "value": value}, redraw: null}); 641 NJevent("element" + eventType, {type : "setStroke", source: source, data: {"els": els, "prop": "stroke", "value": value}, redraw: null});
624 } 642 }
625 }, 643 },
@@ -694,6 +712,8 @@ exports.ElementMediator = Montage.create(NJComponent, {
694 } 712 }
695 else 713 else
696 { 714 {
715 this.application.ninja.documentController.activeDocument.markEdited();
716
697 NJevent("elementChange", {type : "setMatrix", source: null, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null}); 717 NJevent("elementChange", {type : "setMatrix", source: null, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null});
698 } 718 }
699 } 719 }
diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js
index a1fdead3..e348a09b 100755
--- a/js/mediators/keyboard-mediator.js
+++ b/js/mediators/keyboard-mediator.js
@@ -85,7 +85,7 @@ exports.KeyboardMediator = Montage.create(Component, {
85 85
86 handleKeydown: { 86 handleKeydown: {
87 value: function(evt) { 87 value: function(evt) {
88 if(document.activeElement.nodeName !== "BODY") { 88 if((document.activeElement.nodeName !== "BODY") && (this.application.ninja.documentController.activeDocument.currentView === "design")) {
89 // Don't do anything if an input or other control is focused 89 // Don't do anything if an input or other control is focused
90 return; 90 return;
91 } 91 }
@@ -110,6 +110,13 @@ exports.KeyboardMediator = Montage.create(Component, {
110 return; 110 return;
111 } 111 }
112 112
113 // Check if cmd+s/ctrl+s for Save (Windows/Mac)
114 if ((evt.keyCode == Keyboard.S) && (evt.ctrlKey || evt.metaKey) && !evt.shiftKey) {
115 NJevent("executeSave");
116 evt.preventDefault();
117 return;
118 }
119
113 // Check if cmd+shift+z for Redo (Mac) 120 // Check if cmd+shift+z for Redo (Mac)
114 if ((evt.keyCode == Keyboard.Z) && evt.metaKey && evt.shiftKey) { 121 if ((evt.keyCode == Keyboard.Z) && evt.metaKey && evt.shiftKey) {
115 NJevent("executeRedo"); 122 NJevent("executeRedo");