From d5d4dcac78ebf8ba3163a8c7055d783b6397a435 Mon Sep 17 00:00:00 2001 From: John Mayhew Date: Tue, 3 Apr 2012 12:55:54 -0700 Subject: Namespaced the canvas runtime file and updated all dependencies --- assets/canvas-runtime.js | 186 ++++++++++++++++++++++------------------------- 1 file changed, 88 insertions(+), 98 deletions(-) (limited to 'assets') diff --git a/assets/canvas-runtime.js b/assets/canvas-runtime.js index b4563ea5..6e9d1121 100644 --- a/assets/canvas-runtime.js +++ b/assets/canvas-runtime.js @@ -4,11 +4,12 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. */ - +// namespace for the Ninja Canvas Runtime +var NinjaCvsRt = NinjaCvsRt || {}; /////////////////////////////////////////////////////////////////////// //Loading webGL/canvas data -function initWebGl (rootElement, directory) { +NinjaCvsRt.initWebGl = function (rootElement, directory) { var cvsDataMngr, ninjaWebGlData = JSON.parse((document.querySelectorAll(['script[data-ninja-webgl]'])[0].innerHTML.replace('(', '')).replace(')', '')); if (ninjaWebGlData && ninjaWebGlData.data) { for (var n=0; ninjaWebGlData.data[n]; n++) { @@ -16,7 +17,7 @@ function initWebGl (rootElement, directory) { } } //Creating data manager - cvsDataMngr = new CanvasDataManager(); + cvsDataMngr = new NinjaCvsRt.CanvasDataManager(); //Loading data to canvas(es) cvsDataMngr.loadGLData(rootElement, ninjaWebGlData.data, directory); }; @@ -25,7 +26,7 @@ function initWebGl (rootElement, directory) { // Class ShapeRuntime // Manages runtime shape display /////////////////////////////////////////////////////////////////////// -function CanvasDataManager() +NinjaCvsRt.CanvasDataManager = function () { this.loadGLData = function(root, valueArray, assetPath ) { @@ -54,32 +55,13 @@ function CanvasDataManager() var canvas = this.findCanvasWithID( id, root ); if (canvas) { - new GLRuntime( canvas, jObj, assetPath ); + new NinjaCvsRt.GLRuntime( canvas, jObj, assetPath ); } } } } }; - this.collectGLData = function( elt, dataArray ) - { - if (elt.elementModel && elt.elementModel.shapeModel && elt.elementModel.shapeModel.GLWorld) - { - var data = elt.elementModel.shapeModel.GLWorld.export( true ); - dataArray.push( data ); - } - - if (elt.children) - { - var nKids = elt.children.length; - for (var i=0; i