From 5a1965bf2ed9a54601ca16fd67555335c510ce08 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Thu, 26 Apr 2012 16:40:05 -0700 Subject: Update materials to the new texture model. Create local world for deleted source canvases --- js/mediators/element-mediator.js | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'js/mediators') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index 919aaec1..2a85aea8 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -12,7 +12,13 @@ var ElementController = require("js/controllers/elements/element-controller").El NJUtils = require("js/lib/NJUtils").NJUtils; exports.ElementMediator = Montage.create(Component, { - + + _NJUtils: { + get: function() { + if (!NJUtils) NJUtils = require("js/lib/NJUtils").NJUtils; + return NJUtils; + } + }, addDelegate: { enumerable: false, @@ -104,7 +110,7 @@ exports.ElementMediator = Montage.create(Component, { value: function(el, prop, valueMutator) { if(!el.elementModel) { console.log("Element has no Model -> One should have been created"); - NJUtils.makeElementModel(el, "Div", "block"); + this._NJUtils.makeElementModel(el, "Div", "block"); } if(valueMutator && typeof valueMutator === "function") { @@ -119,7 +125,7 @@ exports.ElementMediator = Montage.create(Component, { value: function(el, prop) { if(!el.elementModel) { console.log("Element has no Model -> One should have been created"); - NJUtils.makeElementModel(el, "Canvas", "block", true); + this._NJUtils.makeElementModel(el, "Canvas", "block", true); } return el.elementModel.controller["getShapeProperty"](el, prop); @@ -130,7 +136,7 @@ exports.ElementMediator = Montage.create(Component, { value: function(el, prop, value) { if(!el.elementModel) { console.log("Element has no Model -> One should have been created"); - NJUtils.makeElementModel(el, "Canvas", "block", true); + this._NJUtils.makeElementModel(el, "Canvas", "block", true); } return el.elementModel.controller["setShapeProperty"](el, prop, value); @@ -298,7 +304,7 @@ exports.ElementMediator = Montage.create(Component, { getColor: { value: function(el, isFill, borderSide) { if(!el.elementModel) { - NJUtils.makeModelFromElement(el); + this._NJUtils.makeModelFromElement(el); } return el.elementModel.controller["getColor"](el, isFill, borderSide); } @@ -375,7 +381,7 @@ exports.ElementMediator = Montage.create(Component, { getStroke: { value: function(el) { if(!el.elementModel) { - NJUtils.makeElementModel(el, "Div", "block"); + this._NJUtils.makeElementModel(el, "Div", "block"); } return el.elementModel.controller["getStroke"](el); } @@ -453,7 +459,7 @@ exports.ElementMediator = Montage.create(Component, { get3DProperty: { value: function(el, prop) { if(!el.elementModel) { - NJUtils.makeModelFromElement(el); + this._NJUtils.makeModelFromElement(el); } return el.elementModel.controller["get3DProperty"](el, prop); } @@ -462,7 +468,7 @@ exports.ElementMediator = Montage.create(Component, { get3DProperties: { value: function(el) { if(!el.elementModel) { - NJUtils.makeModelFromElement(el); + this._NJUtils.makeModelFromElement(el); } // var mat = this.getMatrix(el); // var dist = this.getPerspectiveDist(el); @@ -475,7 +481,7 @@ exports.ElementMediator = Montage.create(Component, { getMatrix: { value: function(el) { if(!el.elementModel) { - NJUtils.makeModelFromElement(el); + this._NJUtils.makeModelFromElement(el); } return el.elementModel.controller["getMatrix"](el); } @@ -484,7 +490,7 @@ exports.ElementMediator = Montage.create(Component, { getPerspectiveDist: { value: function(el) { if(!el.elementModel) { - NJUtils.makeModelFromElement(el); + this._NJUtils.makeModelFromElement(el); } return el.elementModel.controller["getPerspectiveDist"](el); } -- cgit v1.2.3 From 0e1a276f19ea70009c5a649e9667861d7c346a7e Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 6 Jun 2012 00:25:27 -0700 Subject: first iteration of adding serializable to ninja plus other changes to run the latest montage Signed-off-by: Valerio Virgillito --- js/mediators/keyboard-mediator.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'js/mediators') diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js index e2e8e937..e3f41b3f 100755 --- a/js/mediators/keyboard-mediator.js +++ b/js/mediators/keyboard-mediator.js @@ -56,6 +56,11 @@ var Keyboard = exports.Keyboard = { exports.KeyboardMediator = Montage.create(Component, { + appModel: { + value: null, + serializable: true + }, + deserializedFromTemplate: { value: function() { this.eventManager.addEventListener("appLoaded", this, false); -- cgit v1.2.3 From ba4e58f11d8028375365ae0ddd0d3f601c7f64ca Mon Sep 17 00:00:00 2001 From: hwc487 Date: Tue, 12 Jun 2012 16:58:25 -0700 Subject: Removed references to NJUtils --- js/mediators/element-mediator.js | 7 ------- 1 file changed, 7 deletions(-) (limited to 'js/mediators') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index 93a8dbce..cf93d8b7 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -12,13 +12,6 @@ var ElementController = require("js/controllers/elements/element-controller").El NJUtils = require("js/lib/NJUtils").NJUtils; exports.ElementMediator = Montage.create(Component, { - - _NJUtils: { - get: function() { - if (!NJUtils) NJUtils = require("js/lib/NJUtils").NJUtils; - return NJUtils; - } - }, addDelegate: { enumerable: false, -- cgit v1.2.3 From f78a6977159bd0310235feb82df18a6ed9df2d7a Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 13 Jun 2012 11:37:12 -0700 Subject: IKNinja-1715 - GIO: canvas tag is not saved after switching WebGL option On/Off in the PI for the shape object. We need to add the 'data-ninja'node' in replaceEelement as well. Signed-off-by: Nivesh Rajbhandari --- js/mediators/element-mediator.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js/mediators') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index 40e94cca..611cf214 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -84,6 +84,7 @@ exports.ElementMediator = Montage.create(Component, { value: function(newChild, oldChild, notify) { this.application.ninja.currentDocument.model.documentRoot.replaceChild(newChild, oldChild); + if (newChild.getAttribute) newChild.setAttribute('data-ninja-node', 'true'); var undoLabel = "replace element"; -- cgit v1.2.3