From e065244ac75d1d0f25fd5c75cb58e714a13fe16b Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Wed, 14 Mar 2012 08:59:17 -0700 Subject: Squashed commit of the following: merge master into timeline Signed-off-by: Jonathan Duran --- js/lib/NJUtils.js | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'js/lib/NJUtils.js') diff --git a/js/lib/NJUtils.js b/js/lib/NJUtils.js index e16715a4..4f1082f9 100755 --- a/js/lib/NJUtils.js +++ b/js/lib/NJUtils.js @@ -116,7 +116,39 @@ exports.NJUtils = Object.create(Object.prototype, { ///// TODO: Selection and model should be based on the element type makeModelFromElement: { value: function(el) { - this.makeElementModel(el, "Div", "block", false); + var selection = "div", + controller = "block", + isShape = false; + switch(el.nodeName.toLowerCase()) + { + case "div": + break; + case "img": + selection = "image"; + controller = "image"; + break; + case "video": + selection = "video"; + controller = "video"; + break; + case "canvas": + isShape = el.getAttribute("data-RDGE-id"); + if(isShape) + { + // TODO - Need more info about the shape + selection = "canvas"; + controller = "shape"; + } + else + { + selection = "canvas"; + controller = "canvas"; + } + break; + case "shape": + break; + } + this.makeElementModel(el, selection, controller, isShape); } }, -- cgit v1.2.3