diff --git a/build/j-visualizer.min.js b/build/j-visualizer.min.js index b560914..da9897c 100644 --- a/build/j-visualizer.min.js +++ b/build/j-visualizer.min.js @@ -1 +1 @@ -(function(){var a,b={}.hasOwnProperty;this.Visualizer=a=Ember.Object.extend({world:null,scenes:Ember.computed(function(){return{}}),modules:Ember.computed(function(){return Ember.Object.create()}).property(),associations:Ember.computed(function(){return Ember.Object.create()}).property(),timers:Ember.computed(function(){return{}}),init:function(b){return this.useWorld(b),this.set("color",a.Colorer.create({visualizer:this}))},useWorld:function(b){return this.set("world",a.World.create({worldObj:$(b),visualizer:this}))},injectWorld:function(){return this.get("world").injectDefaultWorld()},addModule:function(a,b,c){return this.set("modules."+b,a.create({visualizer:this,key:b})),null!=c&&this.set("modules."+b+".content",c),this.refresh()},refresh:function(){var a;return this.get("world.loaded")&&null!=(a=this.get("currentScene"))?a.reload():void 0}.observes("currentScene","world.worldObj","world.loaded","world.width","world.height"),useScenes:function(b){var c,d,e,f;for(null==b&&(b=[]),a.Utils.isArray(b)||("undefined"!=typeof console&&null!==console&&"function"==typeof console.log&&console.log("Object({})-type input for useScenes is deprecated - please pass an Array instead..."),b=b.visualizer_scenes),f=[],d=0,e=b.length;e>d;d++)c=b[d],c.visualizer=this,f.push(this.set("scenes."+c.identifier,a.Scene.create(c)));return f},setScene:function(a){return this.set("currentScene",this.get("scenes."+a))},destroy:function(){var a,c,d,e;d=this.get("modules"),e=[];for(c in d)b.call(d,c)&&(a=d[c],e.push("function"==typeof a.destroy?a.destroy():void 0));return e}})}).call(this),function(){this.Visualizer.Colorer=Ember.Object.extend({visualizer:null,init:function(){return this.get("_assignedUniq"),this.get("uniquePalette"),this._setUniqueProps()},freshColorPalette:function(){return this.get("_colorScheme").copy()},fixed:function(a){return null==a&&(a=""),null!=a&&(a=""+a.toLowerCase()).length?this.get("_fixedVals."+a)||this._rotating_color(a):this.get("_defaultVal")},uniquePalette:Ember.computed(function(){return{}}),_assignedUniq:Ember.computed(function(){return{}}),unique:function(a,b){return null==a&&(a=""),null==b&&(b="main"),this.get("_assignedUniq."+b+"."+a)},_setUniqueProps:function(){return this.unique.next=function(a){return function(b){return null==b&&(b="main"),a.unique._prepareSet(b),a.get("uniquePalette."+b+".0")}}(this),this.unique.assign=function(a){return function(b,c){var d;return null==c&&(c="main"),a.unique._prepareSet(c),null!=b&&null==a.unique(b,c)?(d=a.get("uniquePalette."+c).shift()||a.get("_defaultAssigned"),a.set("_assignedUniq."+c+"."+b,d)):void 0}}(this),this.unique.unassign=function(a){return function(b,c){var d;return null==c&&(c="main"),a.unique._prepareSet(c),null!=b&&(d=a.unique(b,c),null!=d&&d!==a.get("_defaultUnassigned"))?(d!==a.get("_defaultAssigned")&&a.get("uniquePalette."+c).push(d),delete a.get("_assignedUniq."+c)[b],a.get("uniquePalette."+c+".0")):void 0}}(this),this.unique.resetSet=function(a){return function(b){return a.get("_assignedUniq")[b]={},a.get("uniquePalette")[b]=a.freshColorPalette().shuffleVals()}}(this),this.unique._prepareSet=function(a){return function(b){return null==a.get("uniquePalette."+b)?a.unique.resetSet(b):void 0}}(this)},_defaultAssigned:"#5895B2",_defaultUnassigned:"#8da3b0",_colorScheme:["#3498DB","#9B59B6","#F2CA27","#34495E","#1ABC9C","#E74C3C","#95A5A6","#ECF0F1","#2ECC71","#5895B2"],_rotating_color_val:Ember.computed(function(){return{}}),_rotating_keys_used:0,_rotating_color:function(a){var b,c;return null!=a?((b=this.get("_rotating_color_val."+a))||(c=this.get("_colorScheme"),b=c[this._rotating_keys_used++%c.length],this.set("_rotating_color_val."+a,b)),b):void 0},_defaultVal:Ember.computed(function(){var a;return(null!=(a=window.colors)?a.defaultSingle:void 0)||this.get("_defaultAssigned")}),_fixedVals:{blog:"#28cfc5",board:"#FB913F",twitter:"#2AA9E0",facebook:"#4D69A2",google:"#DD4C39",youtube:"#E14D42",instagram:"#FFCB33",linkedin:"#1E87BD",male:"#29A0CE",unisex:"#d6dadb",female:"#FC4482",positive:"#74B81D",negative:"#E74C3C",neutral:"#A8CEE0",unknown:"#d6dadb"}})}.call(this),function(){var a={}.hasOwnProperty;this.Visualizer.Scene=Ember.Object.extend({visualizer:null,identifier:null,title:null,description:null,drawWait:100,widgets:Ember.computed(function(){return[]}),requestedModuleViews:function(){var a,b,c,d,e,f,g;for(b={},g=this.get("widgets"),d=0,e=g.length;e>d;d++)c=g[d],a=null!=b[f=c.module]?b[f]:b[f]={},a[c.view]=!0;return b}.property("widgets.@each"),clearUnusedViews:function(){var b,c,d,e,f,g;f=this.get("visualizer.modules"),g=[];for(c in f)a.call(f,c)&&(b=f[c],g.push(function(){var f,g;f=b.get("moduleViews"),g=[];for(e in f)a.call(f,e)&&(d=f[e],g.push(this.get("requestedModuleViews."+c+"."+e)?void 0:"function"==typeof d.clear?d.clear():void 0));return g}.call(this)));return g},runWidgets:function(a){var b,c,d,e,f;for(null==a&&(a=this.get("widgets")),f=[],d=0,e=a.length;e>d;d++)c=a[d],b=this.get("visualizer.modules."+c.module+".moduleViews."+c.view),f.push(null!=b?b.run(c.operation,c.params):void 0);return f},reload:function(){return Visualizer.Utils.waitForRepeatingEvents(function(a){return function(){return a.clearUnusedViews(),a.runWidgets()}}(this),this.get("drawWait"),"Scene Reload",this.get("visualizer.timers"))}})}.call(this),function(){var a,b;this.Visualizer.World=Ember.Object.extend({loaded:Ember.computed.gt("worldObj.length",0),$:function(a){return null!=a?this.get("worldObj").find(a):this.get("worldObj")},resize:function(){var a,b,c;return a=this.get("worldObj"),a.length?(b=this.get("worldObj").offset(),this.setProperties({width:a.innerWidth(),height:c=a.innerHeight(),top:b.top,left:b.left})):void 0}.observes("worldObj").on("init"),_bindGlobalEvents:function(){return $(window).on("resize",function(a){return function(){return a.resize()}}(this))}.on("init"),_bindWorldEvents:function(){var a;return(a=this.$()).length?a.off("click",".phasedButton").on("click",".phasedButton",b):void 0}.observes("worldObj").on("init"),injectDefaultWorld:function(){return this.$().empty().append($(a))},resizeSharedArea:function(){return this.$("#shared-area").css("height",""+this.get("height")+"px")}.observes("height")}),b=function(a){return $(this).hasClass("disabledItem")?(a.stopImmediatePropagation(),!1):Ember.run.next(this,function(){return $(this).addExpiringClass("disabledItem",2e3)})},a="
"}.call(this),function(){Array.prototype.removeInstancesOf=function(a){for(var b;;){if(-1===(b=this.indexOf(a)))break;this.splice(b,1)}return this},Array.prototype.shuffleVals=function(){var a,b,c,d,e,f;for(a=e=0,f=this.length;f>e;a=++e)b=this[a],c=Math.floor(Math.random()*(a+1)),d=b,this[a]=this[c],this[c]=d;return this}}.call(this),function(){var a={}.hasOwnProperty;Ember.Object.reopen({values:function(){var b,c,d;d=[];for(b in this)a.call(this,b)&&(c=this[b],d.push(c));return d}})}.call(this),function(){jQuery.fn.extend({addExpiringClass:function(a,b){return null==a&&(a="disabled"),null==b&&(b=1e3),this.addClass(a),setTimeout(function(b){return function(){return b.removeClass(a)}}(this),b)}})}.call(this),function(){String.prototype.truncateTo=function(a,b){var c;return null==b&&(b="…"),c=b.length,(isNaN(a)||c>=a)&&(a=b.length+1),this.length>a?this.substr(0,a-c)+b:this},String.prototype.advancedIndexOf=function(a,b){var c;return null==b&&(b={}),c=this,b.isCaseInsensitive&&(c=c.toLowerCase(),a=a.toLowerCase()),c.indexOf(a)},String.prototype.includes=function(a,b){return this.advancedIndexOf(a,{isCaseInsensitive:b})>=0},String.prototype.beginsWith=function(a,b){return 0===this.advancedIndexOf(a,{isCaseInsensitive:b})},String.prototype.capitalizeLetter=function(a){var b;return null==a&&(a=0),b=0===a?"":this.slice(0,a),b+this.charAt(a).toUpperCase()+this.slice(a+1)},String.prototype.titleize=function(){return this.toLowerCase().replace(/\b\w/g,function(a){return a.toUpperCase()})},String.prototype.removeInitialUnderscore=function(){return this.replace(/^_/,"")}}.call(this),function(){var a;this.Visualizer.Utils={existsWithValue:function(a){return"undefined"!=typeof a&&null!==a},waitForRepeatingEvents:function(){var a,b;return b={},a=function(a,c,d,e){return null==d&&(d="default timer"),null==e&&(e=b),e[d]&&clearTimeout(e[d]),e[d]=setTimeout(a,c)}}(),minVal:function(a,b){return b>=a?a:b},maxVal:function(a,b){return a>=b?a:b},boundedVal:function(a,b,c){return b>a?b:a>c?c:a},randBetween:function(a,b){return null==a&&(a=0),null==b&&(b=10),Math.random()*(b-a)+a},randIntBetween:function(a,b){return Math.floor(Visualizer.Utils.randBetween(a,b)||4)},isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},relativeSizeString:function(a,b){var c;return c=parseInt(a),"string"==typeof a&&a.indexOf("%")>=0?c/100*b:isFinite(c)?c:void 0},intersectionSafe:function(a,b){var c,d,e;for(c=0,d=0,e=[];cb[d]?d++:(e.push(c),c++,d++);return e},intersectionCount:function(a,b){var c,d,e;for(c=0,d=0,e=0;cb[d]?d++:(e++,c++,d++);return e},cloneArray:function(a){return"undefined"!=typeof console&&null!==console&&"function"==typeof console.log&&console.log("cloneArray function is deprecated, please use Array.copy()"),a.slice(0)}},window.waitForRepeatingEvents=function(){return"undefined"!=typeof console&&null!==console&&"function"==typeof console.log&&console.log("Global Namespace for waitForRepeatingEvents function is deprecated, please use Visualizer.Utils.waitForRepeatingEvents"),Visualizer.Utils.waitForRepeatingEvents.apply(window,arguments)},window.existsWithValue=function(){return"undefined"!=typeof console&&null!==console&&"function"==typeof console.log&&console.log("Global Namespace for existsWithValue function is deprecated, please use Visualizer.Utils.existsWithValue"),Visualizer.Utils.existsWithValue.apply(window,arguments)},Visualizer.Utils.updateKCodePosition=function(a,b){return 38===a?2>b?2>b&&(b+=1):b>2&&(b=1):(40!==a||2!==b&&3!==b)&&(37!==a||4!==b&&6!==b)&&(39!==a||5!==b&&7!==b)?66===a&&8===b?b+=1:b=65===a&&9===b?10:0:b+=1,b},a=function(a,b){return a>8&&(a=Math.floor(10*Math.random()+a-5)),b>8&&(b=Math.floor(10*Math.random()+b-5)),"http://placekitten.com/"+a+"/"+b}}.call(this),function(){this.Visualizer.Module=Ember.ArrayController.extend({visualizer:null,maxLength:100,content:Ember.computed(function(){return Ember.A()}).property(),dataset:Ember.computed.alias("arrangedContent"),moduleViews:Ember.computed(function(){return Ember.Object.create()}).property(),init:function(){return"function"==typeof this.setDefaultViews?this.setDefaultViews():void 0},forceLimit:function(a){var b;return null==a&&(a="timestamp"),b=this.get("dataset").sort(function(b,c){return c[a]-b[a]}),this.set("dataset",b.slice(0,this.get("maxLength")))},groupedBy:function(a){var b,c,d,e;return b=a.replace(".","__"),c="__groupedBy_"+b,null==(e=this.get(c))&&(d={},d[c]=function(){return this._groupedBy(a).sort(function(a,b){return b.length-a.length})}.property("dataset.@each."+a),this.reopen(d)),e||this.get(c)},_groupedBy:function(a){var b,c,d,e,f,g;for(b=Ember.Object.create(),g=this.get("dataset"),e=0,f=g.length;f>e;e++)c=g[e],d=Ember.get(c,a),(null!=b[d]?b[d]:b[d]=[]).push(c);return b.values()}})}.call(this),function(){this.Visualizer.ModuleView=Ember.Object.extend({module:null,containerSelector:null,previousSelectors:Ember.computed(function(){return[]}),visualizer:Ember.computed.alias("module.visualizer"),data:Ember.computed.alias("module.dataset"),arrangedContent:Ember.computed.alias("module.arrangedContent"),dimensionsDidChange:!0,init:function(a){return this.set("module",a)},clear:function(){},destroy:function(){return this.clear()},run:function(a,b){return null==b&&(b={}),b.container&&this.updateSelector(b.container),this._presetContainerAttrs(b),"function"==typeof this[a]?this[a](b):void 0},updateSelector:function(a){var b;return a!==(b=this.get("containerSelector"))?(this.clear(),this.get("previousSelectors").push(b),this.set("containerSelector",a)):void 0},$container:function(a){var b;return b=a?" "+a:"",this.get("visualizer.world").$(""+this.get("containerSelector")+b)},hardReset:function(){return this.set("dimensionsDidChange",!0),this.run("clear")}.observes("data"),widgetParamedOutlineCSS:function(a){var b,c,d,e,f;for(null==a&&(a={}),b={},f=["width","height","left","top"],d=0,e=f.length;e>d;d++)c=f[d],null!=a[c]&&(b[c]=""+this.get(c)+"px");return b},width:function(a,b){return this._updateDimension(a,b)}.property(),height:function(a,b){return this._updateDimension(a,b)}.property(),_updateDimension:function(a,b){var c;return null!=b&&(b=Math.floor(b),b!==(c=this.get(a))&&this.set("dimensionsDidChange",!0)),b},_presetContainerAttrs:function(a){var b;return null==a&&(a={}),b=this.$container(),null==a.width&&this.set("width",b.width()),null==a.height?this.set("height",b.height()):void 0}})}.call(this),function(){Visualizer.ModuleView.ResizableMixin=Ember.Mixin.create({run:function(a,b){return null==b&&(b={}),this._updateSize(b),this._super(a,b)},_updateSize:function(a){var b,c,d,e,f;for(null==a&&(a={}),this.get("visualizer.world").resize(),e=[{key:"width"},{key:"height"},{key:"left",req:"width"},{key:"top",req:"height"}],f=[],c=0,d=e.length;d>c;c++)b=e[c],f.push(this._tryUpdateValue(b.key,a[b.key],a,b.req));return f},_tryUpdateValue:function(a,b,c,d){var e,f;return null==c&&(c={}),null==d&&(d=a),null!=b&&(null!=c.padding&&(f=Visualizer.Utils.relativeSizeString(c.padding,this.get("visualizer.world."+d))),f=null!=f?f:15,e=Math.floor(Visualizer.Utils.relativeSizeString(b,this.get("visualizer.world."+d))-f),isFinite(e)&&this.get(a)!==e)?(this.set(a,e),!0):!1}})}.call(this); \ No newline at end of file +(function(){var a,b={}.hasOwnProperty;this.Visualizer=a=Ember.Object.extend({world:null,scenes:Ember.computed(function(){return{}}),modules:Ember.computed(function(){return Ember.Object.create()}).property(),associations:Ember.computed(function(){return Ember.Object.create()}).property(),timers:Ember.computed(function(){return{}}),init:function(b){return this.useWorld(b),this.set("color",a.Colorer.create({visualizer:this}))},useWorld:function(b){return this.set("world",a.World.create({worldObj:$(b),visualizer:this}))},addModule:function(a,b,c){var d;return d=a.create({visualizer:this,key:b}),this.set("modules."+b,d),null!=c&&this.set("modules."+b+".content",c),d.requestRedraw()},refresh:function(){var a;return this.get("world.loaded")&&null!=(a=this.get("currentScene"))?a.reload():void 0}.observes("currentScene","world.worldObj","world.loaded","world.width","world.height"),useScenes:function(b){var c,d,e,f;for(null==b&&(b=[]),a.Utils.isArray(b)||("undefined"!=typeof console&&null!==console&&"function"==typeof console.log&&console.log("Object({})-type input for useScenes is deprecated - please pass an Array instead..."),b=b.visualizer_scenes),f=[],d=0,e=b.length;e>d;d++)c=b[d],c.visualizer=this,f.push(this.set("scenes."+c.identifier,a.Scene.create(c)));return f},setScene:function(a){return this.set("currentScene",this.get("scenes."+a))},destroy:function(){var a,c,d,e;d=this.get("modules"),e=[];for(c in d)b.call(d,c)&&(a=d[c],e.push("function"==typeof a.destroy?a.destroy():void 0));return e}})}).call(this),function(){this.Visualizer.Colorer=Ember.Object.extend({visualizer:null,init:function(){return this.get("_assignedUniq"),this.get("uniquePalette"),this._setUniqueProps()},freshColorPalette:function(){return this.get("_colorScheme").copy()},fixed:function(a){return null==a&&(a=""),null!=a&&(a=""+a.toLowerCase()).length?this.get("_fixedVals."+a)||this._rotating_color(a):this.get("_defaultVal")},uniquePalette:Ember.computed(function(){return{}}),_assignedUniq:Ember.computed(function(){return{}}),unique:function(a,b){return null==a&&(a=""),null==b&&(b="main"),this.get("_assignedUniq."+b+"."+a)},_setUniqueProps:function(){return this.unique.next=function(a){return function(b){return null==b&&(b="main"),a.unique._prepareSet(b),a.get("uniquePalette."+b+".0")}}(this),this.unique.assign=function(a){return function(b,c){var d;return null==c&&(c="main"),a.unique._prepareSet(c),null!=b&&null==a.unique(b,c)?(d=a.get("uniquePalette."+c).shift()||a.get("_defaultAssigned"),a.set("_assignedUniq."+c+"."+b,d)):void 0}}(this),this.unique.unassign=function(a){return function(b,c){var d;return null==c&&(c="main"),a.unique._prepareSet(c),null!=b&&(d=a.unique(b,c),null!=d&&d!==a.get("_defaultUnassigned"))?(d!==a.get("_defaultAssigned")&&a.get("uniquePalette."+c).push(d),delete a.get("_assignedUniq."+c)[b],a.get("uniquePalette."+c+".0")):void 0}}(this),this.unique.resetSet=function(a){return function(b){return a.get("_assignedUniq")[b]={},a.get("uniquePalette")[b]=a.freshColorPalette().shuffleVals()}}(this),this.unique._prepareSet=function(a){return function(b){return null==a.get("uniquePalette."+b)?a.unique.resetSet(b):void 0}}(this)},_defaultAssigned:"#5895B2",_defaultUnassigned:"#8da3b0",_colorScheme:["#3498DB","#9B59B6","#F2CA27","#34495E","#1ABC9C","#E74C3C","#95A5A6","#ECF0F1","#2ECC71","#5895B2"],_rotating_color_val:Ember.computed(function(){return{}}),_rotating_keys_used:0,_rotating_color:function(a){var b,c;return null!=a?((b=this.get("_rotating_color_val."+a))||(c=this.get("_colorScheme"),b=c[this._rotating_keys_used++%c.length],this.set("_rotating_color_val."+a,b)),b):void 0},_defaultVal:Ember.computed(function(){var a;return(null!=(a=window.colors)?a.defaultSingle:void 0)||this.get("_defaultAssigned")}),_fixedVals:{blog:"#28cfc5",board:"#FB913F",twitter:"#2AA9E0",facebook:"#4D69A2",google:"#DD4C39",youtube:"#E14D42",instagram:"#FFCB33",linkedin:"#1E87BD",male:"#29A0CE",unisex:"#d6dadb",female:"#FC4482",positive:"#74B81D",negative:"#E74C3C",neutral:"#A8CEE0",unknown:"#d6dadb"}})}.call(this),function(){var a={}.hasOwnProperty;this.Visualizer.Scene=Ember.Object.extend({visualizer:null,identifier:null,title:null,description:null,drawWait:100,fullRefreshWait:20,widgets:Ember.computed(function(){return[]}),requestedModuleViews:function(){var a,b,c,d,e,f,g;for(b={},g=this.get("widgets"),d=0,e=g.length;e>d;d++)c=g[d],a=null!=b[f=c.module]?b[f]:b[f]={},a[c.view]=!0;return b}.property("widgets.@each"),clearUnusedViews:function(){var b,c,d,e,f,g;f=this.get("visualizer.modules");for(c in f)if(a.call(f,c)){b=f[c],g=b.get("moduleViews");for(e in g)a.call(g,e)&&(d=g[e],this.get("requestedModuleViews."+c+"."+e)||"function"==typeof d.clear&&d.clear())}return this},runWidgets:function(a){var b,c,d;for(null==a&&(a=this.get("widgets")),c=0,d=a.length;d>c;c++)b=a[c],this._runWidget(b);return this},_runWidget:function(a){var b;return null==a&&(a={}),b="visualizer.modules."+a.module+".moduleViews."+a.view,Visualizer.Utils.waitForRepeatingEvents(function(c){return function(){var d;return null!=(d=c.get(b))?d.run(a.operation,a.params):void 0}}(this),this.get("drawWait"),"Scene Redraw for "+b,this.get("visualizer.timers"))},reload:function(){return Visualizer.Utils.waitForRepeatingEvents(function(a){return function(){return a.clearUnusedViews(),a.runWidgets()}}(this),this.get("fullRefreshWait"),"Full Scene Reload",this.get("visualizer.timers"))}})}.call(this),function(){var a;this.Visualizer.World=Ember.Object.extend({loaded:Ember.computed.gt("worldObj.length",0),$:function(a){return null!=a?this.get("worldObj").find(a):this.get("worldObj")},resize:function(){var a,b,c;return a=this.get("worldObj"),a.length?(b=this.get("worldObj").offset(),this.setProperties({width:a.innerWidth(),height:c=a.innerHeight(),top:b.top,left:b.left})):void 0}.observes("worldObj").on("init"),_bindGlobalEvents:function(){return $(window).on("resize",function(a){return function(){return a.resize()}}(this))}.on("init"),_bindWorldEvents:function(){var b;return(b=this.$()).length?b.off("click",".phasedButton").on("click",".phasedButton",a):void 0}.observes("worldObj").on("init")}),a=function(a){return $(this).hasClass("disabledItem")?(a.stopImmediatePropagation(),!1):Ember.run.next(this,function(){return $(this).addExpiringClass("disabledItem",2e3)})}}.call(this),function(){Array.prototype.removeInstancesOf=function(a){for(var b;;){if(-1===(b=this.indexOf(a)))break;this.splice(b,1)}return this},Array.prototype.shuffleVals=function(){var a,b,c,d,e,f;for(a=e=0,f=this.length;f>e;a=++e)b=this[a],c=Math.floor(Math.random()*(a+1)),d=b,this[a]=this[c],this[c]=d;return this}}.call(this),function(){var a={}.hasOwnProperty;Ember.Object.reopen({values:function(){var b,c,d;d=[];for(b in this)a.call(this,b)&&(c=this[b],d.push(c));return d}})}.call(this),function(){jQuery.fn.extend({addExpiringClass:function(a,b){return null==a&&(a="disabled"),null==b&&(b=1e3),this.addClass(a),setTimeout(function(b){return function(){return b.removeClass(a)}}(this),b)}})}.call(this),function(){String.prototype.truncateTo=function(a,b){var c;return null==b&&(b="…"),c=b.length,(isNaN(a)||c>=a)&&(a=b.length+1),this.length>a?this.substr(0,a-c)+b:this},String.prototype.advancedIndexOf=function(a,b){var c;return null==b&&(b={}),c=this,b.isCaseInsensitive&&(c=c.toLowerCase(),a=a.toLowerCase()),c.indexOf(a)},String.prototype.includes=function(a,b){return this.advancedIndexOf(a,{isCaseInsensitive:b})>=0},String.prototype.beginsWith=function(a,b){return 0===this.advancedIndexOf(a,{isCaseInsensitive:b})},String.prototype.capitalizeLetter=function(a){var b;return null==a&&(a=0),b=0===a?"":this.slice(0,a),b+this.charAt(a).toUpperCase()+this.slice(a+1)},String.prototype.titleize=function(){return this.toLowerCase().replace(/\b\w/g,function(a){return a.toUpperCase()})},String.prototype.removeInitialUnderscore=function(){return this.replace(/^_/,"")}}.call(this),function(){var a;this.Visualizer.Utils={existsWithValue:function(a){return"undefined"!=typeof a&&null!==a},waitForRepeatingEvents:function(){var a,b;return b={},a=function(a,c,d,e){var f;return null==d&&(d="default timer"),null==e&&(e=b),f=e[d],f&&clearTimeout(f),e[d]=setTimeout(a,c)}}(),minVal:function(a,b){return b>=a?a:b},maxVal:function(a,b){return a>=b?a:b},boundedVal:function(a,b,c){return b>a?b:a>c?c:a},randBetween:function(a,b){return null==a&&(a=0),null==b&&(b=10),Math.random()*(b-a)+a},randIntBetween:function(a,b){return Math.floor(Visualizer.Utils.randBetween(a,b)||4)},isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},relativeSizeString:function(a,b){var c;return c=parseInt(a),"string"==typeof a&&a.indexOf("%")>=0?c/100*b:isFinite(c)?c:void 0},intersectionSafe:function(a,b){var c,d,e;for(c=0,d=0,e=[];cb[d]?d++:(e.push(c),c++,d++);return e},intersectionCount:function(a,b){var c,d,e;for(c=0,d=0,e=0;cb[d]?d++:(e++,c++,d++);return e},cloneArray:function(a){return"undefined"!=typeof console&&null!==console&&"function"==typeof console.log&&console.log("cloneArray function is deprecated, please use Array.copy()"),a.slice(0)}},Visualizer.Utils.updateKCodePosition=function(a,b){return 38===a?2>b?2>b&&(b+=1):b>2&&(b=1):(40!==a||2!==b&&3!==b)&&(37!==a||4!==b&&6!==b)&&(39!==a||5!==b&&7!==b)?66===a&&8===b?b+=1:b=65===a&&9===b?10:0:b+=1,b},a=function(a,b){return a>8&&(a=Math.floor(10*Math.random()+a-5)),b>8&&(b=Math.floor(10*Math.random()+b-5)),"http://placekitten.com/"+a+"/"+b}}.call(this),function(){this.Visualizer.Module=Ember.ArrayController.extend({visualizer:null,maxLength:100,content:Ember.computed(function(){return Ember.A()}).property(),dataset:Ember.computed.alias("arrangedContent"),moduleViews:Ember.computed(function(){return Ember.Object.create()}).property(),init:function(){return"function"==typeof this.setDefaultViews?this.setDefaultViews():void 0},requestRedraw:function(){var a,b,c;return b=this.get("visualizer.currentScene"),a=this.get("key"),null!=b&&null!=a?b.runWidgets(null!=(c=b.get("widgets"))?c.filterBy("module",a):void 0):void 0},forceLimit:function(a){var b;return null==a&&(a="timestamp"),b=this.get("dataset").sort(function(b,c){return c[a]-b[a]}),this.set("dataset",b.slice(0,this.get("maxLength")))},groupedBy:function(a){var b,c,d,e;return b=a.replace(".","__"),c="__groupedBy_"+b,null==(e=this.get(c))&&(d={},d[c]=function(){return this._groupedBy(a).sort(function(a,b){return b.length-a.length})}.property("dataset.@each."+a),this.reopen(d)),e||this.get(c)},_groupedBy:function(a){var b,c,d,e,f,g;for(b=Ember.Object.create(),g=this.get("dataset"),e=0,f=g.length;f>e;e++)c=g[e],d=Ember.get(c,a),(null!=b[d]?b[d]:b[d]=[]).push(c);return b.values()}})}.call(this),function(){this.Visualizer.ModuleView=Ember.Object.extend({module:null,containerSelector:null,previousSelectors:Ember.computed(function(){return[]}),visualizer:Ember.computed.alias("module.visualizer"),data:Ember.computed.alias("module.dataset"),arrangedContent:Ember.computed.alias("module.arrangedContent"),dimensionsDidChange:!0,init:function(a){return this.set("module",a)},clear:function(){},destroy:function(){return this.clear()},run:function(a,b){return null==b&&(b={}),b.container&&this.updateSelector(b.container),this._presetContainerAttrs(b),"function"==typeof this[a]?this[a](b):void 0},updateSelector:function(a){var b;return a!==(b=this.get("containerSelector"))?(this.clear(),this.get("previousSelectors").push(b),this.set("containerSelector",a)):void 0},$container:function(a){var b;return b=a?" "+a:"",this.get("visualizer.world").$(""+this.get("containerSelector")+b)},hardReset:function(){return this.set("dimensionsDidChange",!0),this.get("module").requestRedraw()}.observes("data"),widgetParamedOutlineCSS:function(a){var b,c,d,e,f;for(null==a&&(a={}),b={},f=["width","height","left","top"],d=0,e=f.length;e>d;d++)c=f[d],null!=a[c]&&(b[c]=""+this.get(c)+"px");return b},width:function(a,b){return this._updateDimension(a,b)}.property(),height:function(a,b){return this._updateDimension(a,b)}.property(),_updateDimension:function(a,b){var c;return null!=b&&(b=Math.floor(b),b!==(c=this.get(a))&&this.set("dimensionsDidChange",!0)),b},_presetContainerAttrs:function(a){var b;return null==a&&(a={}),null!=a.width&&null!=a.height||(b=this.$container(),null==a.width&&this.set("width",b.width()),null!=a.height)?void 0:this.set("height",b.height())}})}.call(this),function(){Visualizer.ModuleView.ResizableMixin=Ember.Mixin.create({run:function(a,b){return null==b&&(b={}),this._updateSize(b),this._super(a,b)},_updateSize:function(a){var b,c,d,e,f;for(null==a&&(a={}),this.get("visualizer.world").resize(),e=[{key:"width"},{key:"height"},{key:"left",req:"width"},{key:"top",req:"height"}],f=[],c=0,d=e.length;d>c;c++)b=e[c],f.push(this._tryUpdateValue(b.key,a[b.key],a,b.req));return f},_tryUpdateValue:function(a,b,c,d){var e,f;return null==c&&(c={}),null==d&&(d=a),null!=b&&(null!=c.padding&&(f=Visualizer.Utils.relativeSizeString(c.padding,this.get("visualizer.world."+d))),f=null!=f?f:15,e=Math.floor(Visualizer.Utils.relativeSizeString(b,this.get("visualizer.world."+d))-f),isFinite(e)&&this.get(a)!==e)?(this.set(a,e),!0):!1}})}.call(this); \ No newline at end of file diff --git a/build/js/j-visualizer.js b/build/js/j-visualizer.js index fae1369..6c7c170 100644 --- a/build/js/j-visualizer.js +++ b/build/js/j-visualizer.js @@ -110,14 +110,6 @@ })); }, - /** - * Alias for Visualizer.World method: injectDefaultWorld - * @deprecated Use (visualizer).get('world').injectDefaultWorld() - */ - injectWorld: function() { - return this.get('world').injectDefaultWorld(); - }, - /** * addModule creates a Visualizer.Module object specified by the moduleClass parameter, * using a provided key (to allow differentiation and access). If (optional) content @@ -132,14 +124,16 @@ * @return {void} */ addModule: function(moduleClass, moduleKey, content) { - this.set("modules." + moduleKey, moduleClass.create({ + var module; + module = moduleClass.create({ visualizer: this, key: moduleKey - })); + }); + this.set("modules." + moduleKey, module); if (content != null) { this.set("modules." + moduleKey + ".content", content); } - return this.refresh(); + return module.requestRedraw(); }, /** @@ -617,8 +611,8 @@ description: null, /** - * drawWait is the debounce time waited before updating the scene. - * If a scene's reload is requested many times in rapid succession it will wait + * drawWait is the debounce time waited before running a single widget's update. + * If a widget's reload is requested many times in rapid succession it will wait * until drawWait milliseconds after the last call before executing the reload. * * @property drawWait @@ -628,6 +622,17 @@ */ drawWait: 100, + /** + * fullRefreshWait is an additional debounce time waited before + * totally updating the scene. This adds some + * + * @property fullRefreshWait + * @type Integer (milliseconds) + * @default 20 + * @required + */ + fullRefreshWait: 20, + /** * widgets references a collection of "widget" Objects, each of which * should reference a Module, a ModuleView, an operation to call upon the ModuleView, @@ -670,32 +675,26 @@ * In essence it ensures that any Views that are not currently in use are cleansed. * * @method clearUnusedViews - * @return {void} + * @chainable */ clearUnusedViews: function() { - var module, moduleName, view, viewName, _ref, _results; + var module, moduleName, view, viewName, _ref, _ref1; _ref = this.get("visualizer.modules"); - _results = []; for (moduleName in _ref) { if (!__hasProp.call(_ref, moduleName)) continue; module = _ref[moduleName]; - _results.push((function() { - var _ref1, _results1; - _ref1 = module.get('moduleViews'); - _results1 = []; - for (viewName in _ref1) { - if (!__hasProp.call(_ref1, viewName)) continue; - view = _ref1[viewName]; - if (!this.get("requestedModuleViews." + moduleName + "." + viewName)) { - _results1.push(typeof view.clear === "function" ? view.clear() : void 0); - } else { - _results1.push(void 0); + _ref1 = module.get('moduleViews'); + for (viewName in _ref1) { + if (!__hasProp.call(_ref1, viewName)) continue; + view = _ref1[viewName]; + if (!this.get("requestedModuleViews." + moduleName + "." + viewName)) { + if (typeof view.clear === "function") { + view.clear(); } } - return _results1; - }).call(this)); + } } - return _results; + return this; }, /** @@ -706,20 +705,41 @@ * another ModuleView, a set of icons, to group themselves by common-words. * * @method runWidgets - * @return {void} + * @chainable */ runWidgets: function(widgets) { - var moduleView, widget, _i, _len, _results; + var widget, _i, _len; if (widgets == null) { widgets = this.get('widgets'); } - _results = []; for (_i = 0, _len = widgets.length; _i < _len; _i++) { widget = widgets[_i]; - moduleView = this.get("visualizer.modules." + widget.module + ".moduleViews." + widget.view); - _results.push(moduleView != null ? moduleView.run(widget.operation, widget.params) : void 0); + this._runWidget(widget); } - return _results; + return this; + }, + + /** + * _runWidget runs the current scene's operation for a single widget. + * Waits for repeating events to prevent multiple refreshes on the + * same dimensions/parameters. + * + * @method _runWidget + * @return {void} + * @private + */ + _runWidget: function(widget) { + var viewIdentifier; + if (widget == null) { + widget = {}; + } + viewIdentifier = "visualizer.modules." + widget.module + ".moduleViews." + widget.view; + return Visualizer.Utils.waitForRepeatingEvents(((function(_this) { + return function() { + var _ref; + return (_ref = _this.get(viewIdentifier)) != null ? _ref.run(widget.operation, widget.params) : void 0; + }; + })(this)), this.get("drawWait"), "Scene Redraw for " + viewIdentifier, this.get('visualizer.timers')); }, /** @@ -738,7 +758,7 @@ _this.clearUnusedViews(); return _this.runWidgets(); }; - })(this)), this.get("drawWait"), "Scene Reload", this.get('visualizer.timers')); + })(this)), this.get('fullRefreshWait'), "Full Scene Reload", this.get('visualizer.timers')); } }); @@ -755,7 +775,7 @@ */ (function() { - var defaultWorldTemplate, _handlePhasedButtonClick; + var _handlePhasedButtonClick; this.Visualizer.World = Ember.Object.extend({ @@ -845,33 +865,7 @@ if (($world = this.$()).length) { return $world.off("click", ".phasedButton").on("click", ".phasedButton", _handlePhasedButtonClick); } - }).observes('worldObj').on('init'), - - /** - * injectDefaultWorld clears out the Visualizer World's contents, injects the basic - * visualizer skeleton - * - * @deprecated @todo Deprecate this. ModuleViews should take care of this on a per-App basis... - * - * @method injectDefaultWorld - * @return {void} - */ - injectDefaultWorld: function() { - return this.$().empty().append($(defaultWorldTemplate)); - }, - - /** - * resizeSharedArea updates the height of the "shared area" DOM element - * within the Visualizer World. - * - * @deprecated @todo: remove this - this should be the work of ModuleViews... - * - * @method resizeSharedArea - * @return {void} - */ - resizeSharedArea: (function() { - return this.$("#shared-area").css('height', "" + (this.get('height')) + "px"); - }).observes('height') + }).observes('worldObj').on('init') }); @@ -896,8 +890,6 @@ }); }; - defaultWorldTemplate = "
"; - }).call(this); @@ -1203,14 +1195,16 @@ var func, _timers; _timers = {}; return func = function(callback, timeout, timerName, timerSet) { + var storedTimer; if (timerName == null) { timerName = "default timer"; } if (timerSet == null) { timerSet = _timers; } - if (timerSet[timerName]) { - clearTimeout(timerSet[timerName]); + storedTimer = timerSet[timerName]; + if (storedTimer) { + clearTimeout(storedTimer); } return timerSet[timerName] = setTimeout(callback, timeout); }; @@ -1414,29 +1408,6 @@ }; - /* - * Previously Globally defined functions... - */ - - window.waitForRepeatingEvents = function() { - if (typeof console !== "undefined" && console !== null) { - if (typeof console.log === "function") { - console.log("Global Namespace for waitForRepeatingEvents function is deprecated, please use Visualizer.Utils.waitForRepeatingEvents"); - } - } - return Visualizer.Utils.waitForRepeatingEvents.apply(window, arguments); - }; - - window.existsWithValue = function() { - if (typeof console !== "undefined" && console !== null) { - if (typeof console.log === "function") { - console.log("Global Namespace for existsWithValue function is deprecated, please use Visualizer.Utils.existsWithValue"); - } - } - return Visualizer.Utils.existsWithValue.apply(window, arguments); - }; - - /* * FUN! */ @@ -1581,6 +1552,22 @@ return typeof this.setDefaultViews === "function" ? this.setDefaultViews() : void 0; }, + /** + * requestRedraw sends a request to the current scene + * to redraw the widgets relevant to this module (and no others). + * + * @method requestRedraw + * @return {void} + */ + requestRedraw: function() { + var key, scene, _ref; + scene = this.get('visualizer.currentScene'); + key = this.get('key'); + if ((scene != null) && (key != null)) { + return scene.runWidgets((_ref = scene.get('widgets')) != null ? _ref.filterBy('module', key) : void 0); + } + }, + /** * forceLimit sorts the current data by a provided key, and selects only the * first maxLength (property) items for this Module's dataset, ensuring that @@ -1883,7 +1870,7 @@ */ hardReset: (function() { this.set('dimensionsDidChange', true); - return this.run('clear'); + return this.get('module').requestRedraw(); }).observes('data'), /** @@ -1991,12 +1978,14 @@ if (params == null) { params = {}; } - container = this.$container(); - if (params.width == null) { - this.set('width', container.width()); - } - if (params.height == null) { - return this.set('height', container.height()); + if (!((params.width != null) && (params.height != null))) { + container = this.$container(); + if (params.width == null) { + this.set('width', container.width()); + } + if (params.height == null) { + return this.set('height', container.height()); + } } } }); diff --git a/documentation/classes/NativeClass.Array.html b/documentation/classes/NativeClass.Array.html index 77f6ca3..d7ad952 100644 --- a/documentation/classes/NativeClass.Array.html +++ b/documentation/classes/NativeClass.Array.html @@ -228,7 +228,7 @@

removeInstancesOf

- build/js/j-visualizer.js:904 + build/js/j-visualizer.js:896

@@ -325,7 +325,7 @@

shuffleVals

- build/js/j-visualizer.js:928 + build/js/j-visualizer.js:920

@@ -400,7 +400,7 @@

values

- build/js/j-visualizer.js:958 + build/js/j-visualizer.js:950

diff --git a/documentation/classes/NativeClass.String.html b/documentation/classes/NativeClass.String.html index b498654..9fed922 100644 --- a/documentation/classes/NativeClass.String.html +++ b/documentation/classes/NativeClass.String.html @@ -262,7 +262,7 @@

advancedIndexOf

- build/js/j-visualizer.js:1042 + build/js/j-visualizer.js:1034

@@ -394,7 +394,7 @@

beginsWith

- build/js/j-visualizer.js:1089 + build/js/j-visualizer.js:1081

@@ -520,7 +520,7 @@

capitalizeLetter

- build/js/j-visualizer.js:1109 + build/js/j-visualizer.js:1101

@@ -636,7 +636,7 @@

includes

- build/js/j-visualizer.js:1069 + build/js/j-visualizer.js:1061

@@ -752,7 +752,7 @@

removeInitialUnderscore

- build/js/j-visualizer.js:1147 + build/js/j-visualizer.js:1139

@@ -825,7 +825,7 @@

titleize

- build/js/j-visualizer.js:1131 + build/js/j-visualizer.js:1123

@@ -914,7 +914,7 @@

truncateTo

- build/js/j-visualizer.js:1013 + build/js/j-visualizer.js:1005

diff --git a/documentation/classes/Visualizer.Colorer.html b/documentation/classes/Visualizer.Colorer.html index 82a9653..1128780 100644 --- a/documentation/classes/Visualizer.Colorer.html +++ b/documentation/classes/Visualizer.Colorer.html @@ -114,7 +114,7 @@

Visualizer.Colorer Class

@@ -346,7 +346,7 @@

_rotating_color

- build/js/j-visualizer.js:508 + build/js/j-visualizer.js:502

@@ -448,7 +448,7 @@

_setUniqueProps

- build/js/j-visualizer.js:354 + build/js/j-visualizer.js:348

@@ -539,7 +539,7 @@

fixed

- build/js/j-visualizer.js:279 + build/js/j-visualizer.js:273

@@ -639,7 +639,7 @@

freshColorPalette

- build/js/j-visualizer.js:267 + build/js/j-visualizer.js:261

@@ -729,7 +729,7 @@

unique

- build/js/j-visualizer.js:328 + build/js/j-visualizer.js:322

@@ -857,7 +857,7 @@

unique._prepareSet

- build/js/j-visualizer.js:461 + build/js/j-visualizer.js:455

@@ -968,7 +968,7 @@

unique.assign

- build/js/j-visualizer.js:395 + build/js/j-visualizer.js:389

@@ -1090,7 +1090,7 @@

unique.next

- build/js/j-visualizer.js:377 + build/js/j-visualizer.js:371

@@ -1199,7 +1199,7 @@

unique.resetSet

- build/js/j-visualizer.js:446 + build/js/j-visualizer.js:440

@@ -1311,7 +1311,7 @@

unique.unassign

- build/js/j-visualizer.js:417 + build/js/j-visualizer.js:411

@@ -1419,7 +1419,7 @@

_colorScheme

- build/js/j-visualizer.js:496 + build/js/j-visualizer.js:490

@@ -1464,7 +1464,7 @@

_defaultAssigned

- build/js/j-visualizer.js:477 + build/js/j-visualizer.js:471

@@ -1511,7 +1511,7 @@

_defaultUnassigned

- build/js/j-visualizer.js:487 + build/js/j-visualizer.js:481

@@ -1557,7 +1557,7 @@

_fixedVals

- build/js/j-visualizer.js:534 + build/js/j-visualizer.js:528

@@ -1603,7 +1603,7 @@

uniquePalette

- build/js/j-visualizer.js:301 + build/js/j-visualizer.js:295

@@ -1650,7 +1650,7 @@

uniquePalette

- build/js/j-visualizer.js:314 + build/js/j-visualizer.js:308

@@ -1698,7 +1698,7 @@

visualizer

- build/js/j-visualizer.js:246 + build/js/j-visualizer.js:240

diff --git a/documentation/classes/Visualizer.Module.html b/documentation/classes/Visualizer.Module.html index 7c38bec..f6013e2 100644 --- a/documentation/classes/Visualizer.Module.html +++ b/documentation/classes/Visualizer.Module.html @@ -114,7 +114,7 @@

Visualizer.Module Class

@@ -180,6 +180,13 @@

Methods

+ + +
  • + requestRedraw + + +
  • @@ -287,7 +294,7 @@

    _groupedBy

    - build/js/j-visualizer.js:1638 + build/js/j-visualizer.js:1625

    @@ -398,7 +405,7 @@

    forceLimit

    - build/js/j-visualizer.js:1584 + build/js/j-visualizer.js:1571

    @@ -506,7 +513,7 @@

    groupedBy

    - build/js/j-visualizer.js:1606 + build/js/j-visualizer.js:1593

    @@ -571,6 +578,78 @@

    Returns:

    + + + +
    +

    requestRedraw

    + + + () + + + + + Void + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + build/js/j-visualizer.js:1555 + +

    + + + + + +
    + +
    +

    requestRedraw sends a request to the current scene +to redraw the widgets relevant to this module (and no others).

    + +
    + + + + +
    +

    Returns:

    + +
    + + + Void: + + +
    +
    + + +
    @@ -605,7 +684,7 @@

    content

    - build/js/j-visualizer.js:1520 + build/js/j-visualizer.js:1491

    @@ -656,7 +735,7 @@

    dataset

    - build/js/j-visualizer.js:1538 + build/js/j-visualizer.js:1509

    @@ -705,7 +784,7 @@

    maxLength

    - build/js/j-visualizer.js:1508 + build/js/j-visualizer.js:1479

    @@ -753,7 +832,7 @@

    moduleViews

    - build/js/j-visualizer.js:1553 + build/js/j-visualizer.js:1524

    @@ -801,7 +880,7 @@

    visualizer

    - build/js/j-visualizer.js:1499 + build/js/j-visualizer.js:1470

    diff --git a/documentation/classes/Visualizer.ModuleView.ResizableMixin.html b/documentation/classes/Visualizer.ModuleView.ResizableMixin.html index eb8a342..b0df820 100644 --- a/documentation/classes/Visualizer.ModuleView.ResizableMixin.html +++ b/documentation/classes/Visualizer.ModuleView.ResizableMixin.html @@ -114,7 +114,7 @@

    Visualizer.ModuleView.ResizableMixin Class

    @@ -261,7 +261,7 @@

    _tryUpdateValue

    - build/js/j-visualizer.js:2079 + build/js/j-visualizer.js:2068

    @@ -427,7 +427,7 @@

    _updateSize

    - build/js/j-visualizer.js:2042 + build/js/j-visualizer.js:2031

    @@ -541,7 +541,7 @@

    run

    - build/js/j-visualizer.js:2023 + build/js/j-visualizer.js:2012

    diff --git a/documentation/classes/Visualizer.ModuleView.html b/documentation/classes/Visualizer.ModuleView.html index 265396e..1bc35ef 100644 --- a/documentation/classes/Visualizer.ModuleView.html +++ b/documentation/classes/Visualizer.ModuleView.html @@ -114,7 +114,7 @@

    Visualizer.ModuleView Class

    @@ -356,7 +356,7 @@

    $container

    - build/js/j-visualizer.js:1858 + build/js/j-visualizer.js:1845

    @@ -465,7 +465,7 @@

    _presetContainerAttrs

    - build/js/j-visualizer.js:1976 + build/js/j-visualizer.js:1963

    @@ -584,7 +584,7 @@

    _updateDimension

    - build/js/j-visualizer.js:1947 + build/js/j-visualizer.js:1934

    @@ -705,7 +705,7 @@

    clear

    - build/js/j-visualizer.js:1780 + build/js/j-visualizer.js:1767

    @@ -784,7 +784,7 @@

    destroy

    - build/js/j-visualizer.js:1799 + build/js/j-visualizer.js:1786

    @@ -859,7 +859,7 @@

    hardReset

    - build/js/j-visualizer.js:1875 + build/js/j-visualizer.js:1862

    @@ -950,7 +950,7 @@

    height

    - build/js/j-visualizer.js:1933 + build/js/j-visualizer.js:1920

    @@ -1081,7 +1081,7 @@

    run

    - build/js/j-visualizer.js:1815 + build/js/j-visualizer.js:1802

    @@ -1208,7 +1208,7 @@

    updateSelector

    - build/js/j-visualizer.js:1840 + build/js/j-visualizer.js:1827

    @@ -1315,7 +1315,7 @@

    widgetParamedOutlineCSS

    - build/js/j-visualizer.js:1889 + build/js/j-visualizer.js:1876

    @@ -1436,7 +1436,7 @@

    width

    - build/js/j-visualizer.js:1919 + build/js/j-visualizer.js:1906

    @@ -1546,7 +1546,7 @@

    arrangedContent

    - build/js/j-visualizer.js:1739 + build/js/j-visualizer.js:1726

    @@ -1595,7 +1595,7 @@

    containerSelector

    - build/js/j-visualizer.js:1690 + build/js/j-visualizer.js:1677

    @@ -1647,7 +1647,7 @@

    data

    - build/js/j-visualizer.js:1730 + build/js/j-visualizer.js:1717

    @@ -1692,7 +1692,7 @@

    dimensionsDidChange

    - build/js/j-visualizer.js:1753 + build/js/j-visualizer.js:1740

    @@ -1741,7 +1741,7 @@

    module

    - build/js/j-visualizer.js:1681 + build/js/j-visualizer.js:1668

    @@ -1786,7 +1786,7 @@

    previousSelectors

    - build/js/j-visualizer.js:1708 + build/js/j-visualizer.js:1695

    @@ -1833,7 +1833,7 @@

    visualizer

    - build/js/j-visualizer.js:1721 + build/js/j-visualizer.js:1708

    diff --git a/documentation/classes/Visualizer.Scene.html b/documentation/classes/Visualizer.Scene.html index cae21ad..2a065b3 100644 --- a/documentation/classes/Visualizer.Scene.html +++ b/documentation/classes/Visualizer.Scene.html @@ -114,7 +114,7 @@

    Visualizer.Scene Class

    @@ -159,6 +159,13 @@

    Methods

    @@ -287,7 +269,7 @@

    $

    - build/js/j-visualizer.js:773 + build/js/j-visualizer.js:793

    @@ -387,7 +369,7 @@

    _bindGlobalEvents

    - build/js/j-visualizer.js:813 + build/js/j-visualizer.js:833

    @@ -463,7 +445,7 @@

    _bindWorldEvents

    - build/js/j-visualizer.js:832 + build/js/j-visualizer.js:852

    @@ -539,7 +521,7 @@

    _handlePhasedButtonClick

    - build/js/j-visualizer.js:878 + build/js/j-visualizer.js:872

    @@ -560,82 +542,6 @@

    _handlePhasedButtonClick

    -
    -

    Returns:

    - -
    - - - Void: - - -
    -
    - - - - - - -
    -

    injectDefaultWorld

    - - - () - - - - - Void - - - - - deprecated - - - - - - - - - - - - -
    - - - -

    - - Defined in - - - - - build/js/j-visualizer.js:850 - -

    - - - -

    Deprecated: @todo Deprecate this. ModuleViews should take care of this on a per-App basis...

    - - - -
    - -
    -

    injectDefaultWorld clears out the Visualizer World's contents, injects the basic -visualizer skeleton

    - -
    - - - -

    Returns:

    @@ -689,7 +595,7 @@

    resize

    - build/js/j-visualizer.js:790 + build/js/j-visualizer.js:810

    @@ -709,82 +615,6 @@

    resize

    -
    -

    Returns:

    - -
    - - - Void: - - -
    -
    - - - -
    - - -
    -

    resizeSharedArea

    - - - () - - - - - Void - - - - - deprecated - - - - - - - - - - - - -
    - - - -

    - - Defined in - - - - - build/js/j-visualizer.js:863 - -

    - - - -

    Deprecated: @todo: remove this - this should be the work of ModuleViews...

    - - - -
    - -
    -

    resizeSharedArea updates the height of the "shared area" DOM element -within the Visualizer World.

    - -
    - - - -

    Returns:

    @@ -833,7 +663,7 @@

    loaded

    - build/js/j-visualizer.js:762 + build/js/j-visualizer.js:782

    diff --git a/documentation/classes/Visualizer.html b/documentation/classes/Visualizer.html index 3335b72..5dc3dc2 100644 --- a/documentation/classes/Visualizer.html +++ b/documentation/classes/Visualizer.html @@ -318,7 +318,7 @@

    addModule

    - build/js/j-visualizer.js:121 + build/js/j-visualizer.js:113

    @@ -449,7 +449,7 @@

    destroy

    - build/js/j-visualizer.js:210 + build/js/j-visualizer.js:204

    @@ -520,7 +520,7 @@

    refresh

    - build/js/j-visualizer.js:145 + build/js/j-visualizer.js:139

    @@ -607,7 +607,7 @@

    setScene

    - build/js/j-visualizer.js:198 + build/js/j-visualizer.js:192

    @@ -713,7 +713,7 @@

    useScenes

    - build/js/j-visualizer.js:167 + build/js/j-visualizer.js:161

    diff --git a/documentation/classes/jQuery.fn.html b/documentation/classes/jQuery.fn.html index ed43ab2..11bc854 100644 --- a/documentation/classes/jQuery.fn.html +++ b/documentation/classes/jQuery.fn.html @@ -220,7 +220,7 @@

    addExpiringClass

    - build/js/j-visualizer.js:980 + build/js/j-visualizer.js:972

    diff --git a/documentation/data.json b/documentation/data.json index 442a828..6d580c6 100644 --- a/documentation/data.json +++ b/documentation/data.json @@ -59,7 +59,7 @@ "extension_for": [], "namespace": "Visualizer", "file": "build/js/j-visualizer.js", - "line": 232, + "line": 226, "description": "Visualizer Colorer\nAn Object that manages the many colors of a visualization.", "todo": [ "refactor this file", @@ -78,7 +78,7 @@ "extension_for": [], "namespace": "Visualizer", "file": "build/js/j-visualizer.js", - "line": 564, + "line": 558, "description": "Visualizer Scene\nRepresents the Object used to manage data (Modules), and the way the data's viewed.\n\nThe visualization of data is a combined effort of all components contained in this project,\naccessed through this Object.", "extends": "Ember.Object" }, @@ -92,7 +92,7 @@ "extension_for": [], "namespace": "Visualizer", "file": "build/js/j-visualizer.js", - "line": 748, + "line": 768, "description": "Visualizer World\nRepresents an Object used to manage an overview viewport for visualizations.", "extends": "Ember.Object" }, @@ -136,7 +136,7 @@ "extension_for": [], "namespace": "Visualizer", "file": "build/js/j-visualizer.js", - "line": 1163, + "line": 1155, "description": "Visualizer Utils\nA collection of common utility functions used in the Visualizer." }, "Visualizer.Module": { @@ -149,7 +149,7 @@ "extension_for": [], "namespace": "Visualizer", "file": "build/js/j-visualizer.js", - "line": 1482, + "line": 1453, "description": "Visualizer Module\nA Visualizer Module is a collection of data used for Visualization.\nIt keeps access slightly standardized and offers several helpers to\nsimplify data management.\n\nEach Module also has a collection of relevant ModuleViews - Objects that\ndefine and take care of how a given Module's data can be displayed.", "extends": "Ember.ArrayController" }, @@ -163,7 +163,7 @@ "extension_for": [], "namespace": "Visualizer", "file": "build/js/j-visualizer.js", - "line": 1666, + "line": 1653, "description": "Visualizer ModuleView\nModule Views encapsulate the functionality for drawing,\ncoloring, and handling events on visualizations of the data\nprovided by a Module. These are the \"visual\" side of\ndata visualizations.", "extends": "Ember.Object" }, @@ -179,7 +179,7 @@ ], "namespace": "Visualizer.ModuleView", "file": "build/js/j-visualizer.js", - "line": 2007, + "line": 1996, "description": "ResizableMixin\nA helper mixin for ModuleViews which can have their size set manually.\nThis simplifies specifying size, padding, and position of a ModuleView\nviewport container, and allows values to be set either relatively\n(as a percentage of the Visualizer's World), or explicitly (e.g. \"50px\" or 50)", "extends": "Ember.Mixin" } @@ -264,14 +264,6 @@ { "file": "build/js/j-visualizer.js", "line": 113, - "description": "Alias for Visualizer.World method: injectDefaultWorld", - "deprecated": true, - "deprecationMessage": "Use (visualizer).get('world').injectDefaultWorld()", - "class": "Visualizer" - }, - { - "file": "build/js/j-visualizer.js", - "line": 121, "description": "addModule creates a Visualizer.Module object specified by the moduleClass parameter,\nusing a provided key (to allow differentiation and access). If (optional) content\nparameter is provided, it will be set as the module's content.\n\nAfter the module's creation, the Visualizer object is refreshed.", "itemtype": "method", "name": "addModule", @@ -301,7 +293,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 145, + "line": 139, "description": "refresh sends a request to the current scene to update the visualization\nbased on all current dimensions.\n\nThe scene will not be drawn unless the Visualizer's World is loaded (has a viewport).\n\nrefresh observes the world's state, and the current scene - it should automatically\nbe triggered when any of these things change to ensure an up-to-date Visualization.\n\nNote: because Ember Observers currently only watch Array collections (@each), not Object-maps,\nThis will (sadly) not currently watch 'modules.@each.dataset'...", "itemtype": "method", "name": "refresh", @@ -313,7 +305,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 167, + "line": 161, "description": "useScenes updates the Visualizer's scenes collection with the inputScenes parameter.\nFor each item in inputScenes , a Visualizer.Scene object is created, with a\nreference to this instance of Visualizer as its visualizer parameter.", "itemtype": "method", "name": "useScenes", @@ -332,7 +324,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 198, + "line": 192, "description": "setScene updates the Visualizer's currentScene property to reference the\nscene relevant to the method's _identifier parameter.", "itemtype": "method", "name": "setScene", @@ -351,7 +343,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 210, + "line": 204, "description": "destroy cleans up the Visualizer (asking each Module to remove its Views, etc.)", "itemtype": "method", "name": "destroy", @@ -363,7 +355,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 246, + "line": 240, "description": "visualizer is a reference to the parent Visualizer instance.", "itemtype": "property", "name": "visualizer", @@ -374,7 +366,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 255, + "line": 249, "description": "init is called upon creation of a Visualizer Colorer Object.\nIt is responsible for the initial processing and setup of the Object.", "is_constructor": 1, "class": "Visualizer.Colorer", @@ -382,7 +374,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 267, + "line": 261, "description": "freshColorPalette creates a new copy of\nthe main color scheme and returns it.", "itemtype": "method", "name": "freshColorPalette", @@ -395,7 +387,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 279, + "line": 273, "description": "fixed accepts a keyword, and attempts to use the keyword\nto find a relevant color (e.g. \"positive\" may be \"green\").\n\nIf a valid keyword is passed and a relevant color isn't found,\na color is assigned from the rotating set.", "itemtype": "method", "name": "fixed", @@ -415,7 +407,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 301, + "line": 295, "description": "uniquePalette is a collection of sets of remaining\ncolors. Often it will only have a main set, but some\napplications may have more complex coloring needs.", "itemtype": "property", "name": "uniquePalette", @@ -426,7 +418,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 314, + "line": 308, "description": "_assignedUniq is a collection of sets of used colors\n(accessed by key).\nOften it will only have a main set, but some\napplications may have more complex coloring needs.", "itemtype": "property", "name": "uniquePalette", @@ -437,7 +429,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 328, + "line": 322, "description": "unique is a function used to get a unique color for a\ngiven key within a given set (set defaults to \"main\").\n\nThis function has helper properties to handle assigning\nand unassigning colors, determining what the next color\nwill be, and so on.", "todo": [ "consider refactoring / making an Object instead of Function\n(Sorry for the currently complex code)" @@ -467,7 +459,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 354, + "line": 348, "description": "_setUniqueProps sets up the helper sub-functions on the `unique` function.\n\nThis is complex, but allows the following syntax style:\n\n```javascript\n colorer.unique(\"Dylan\") => undefined\n colorer.unique.next() => \"green\"\n\n colorer.unique.assign(\"Dylan\") => undefined\n colorer.unique(\"Dylan\") => \"green\"\n colorer.unique.next() => \"purple\"\n\n colorer.unique.unassign(\"Dylan\") => undefined\n colorer.unique(\"Dylan\") => undefined\n```", "itemtype": "method", "name": "_setUniqueProps", @@ -482,7 +474,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 377, + "line": 371, "description": "unique.next returns the next available color which can be\nassigned to a key.", "itemtype": "method", "name": "unique.next", @@ -504,7 +496,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 395, + "line": 389, "description": "unique.assign attempts to assign a color to a key within a color set.", "itemtype": "method", "name": "unique.assign", @@ -531,7 +523,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 417, + "line": 411, "description": "unique.unassign attempts to unassign a color to a key within a color set.\nThe color is returned to the palette so that it may be reused later.", "itemtype": "method", "name": "unique.unassign", @@ -558,7 +550,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 446, + "line": 440, "description": "unique.resetSet removes colors from all keys within the given set,\nand also replenishes the palette.", "itemtype": "method", "name": "unique.resetSet", @@ -578,7 +570,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 461, + "line": 455, "description": "unique._prepareSet creates and prepares a color set if it doesn't yet exist.", "itemtype": "method", "name": "unique._prepareSet", @@ -598,7 +590,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 477, + "line": 471, "description": "_defaultAssigned is the default color to use for highlighting an item\n(when no other colors in the scheme apply - such as when you\nwish to have unique colors per-key but have no more colors available)", "itemtype": "property", "name": "_defaultAssigned", @@ -608,7 +600,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 487, + "line": 481, "description": "_defaultUnassigned is the default color to use for\nnon-highlighted, but still colored, items.", "itemtype": "property", "name": "_defaultUnassigned", @@ -618,7 +610,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 496, + "line": 490, "description": "_colorScheme is a collection of colors used in the visualization.", "itemtype": "property", "name": "_colorScheme", @@ -628,7 +620,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 508, + "line": 502, "description": "_rotating_color returns an assigned color for a given key\nif available, otherwise assigns a color from the _colorScheme\n(unlike unique(), if all colors are used up, it\nstarts from the first color again.)", "itemtype": "method", "name": "_rotating_color", @@ -648,7 +640,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 534, + "line": 528, "description": "_fixedVals is a collection of key => color pairs for\ncommonly used keys", "itemtype": "property", "name": "_fixedVals", @@ -659,7 +651,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 581, + "line": 575, "description": "visualizer is a reference to the parent Visualizer instance.", "itemtype": "property", "name": "visualizer", @@ -670,7 +662,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 590, + "line": 584, "description": "identifier is a string identifier uniquie to this instance of a Scene", "itemtype": "property", "name": "identifier", @@ -681,7 +673,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 599, + "line": 593, "description": "title is simply a title for the scene, which some\nVisualizer applications may find useful for guiding users.", "itemtype": "property", "name": "title", @@ -692,7 +684,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 609, + "line": 603, "description": "description is simply a description of the scene, which some\nVisualizer applications may find useful for describing a scene to users.", "itemtype": "property", "name": "description", @@ -703,8 +695,8 @@ }, { "file": "build/js/j-visualizer.js", - "line": 619, - "description": "drawWait is the debounce time waited before updating the scene.\nIf a scene's reload is requested many times in rapid succession it will wait\nuntil drawWait milliseconds after the last call before executing the reload.", + "line": 613, + "description": "drawWait is the debounce time waited before running a single widget's update.\nIf a widget's reload is requested many times in rapid succession it will wait\nuntil drawWait milliseconds after the last call before executing the reload.", "itemtype": "property", "name": "drawWait", "type": "Integer (milliseconds)", @@ -715,7 +707,19 @@ }, { "file": "build/js/j-visualizer.js", - "line": 631, + "line": 625, + "description": "fullRefreshWait is an additional debounce time waited before\ntotally updating the scene. This adds some", + "itemtype": "property", + "name": "fullRefreshWait", + "type": "Integer (milliseconds)", + "default": "20", + "required": 1, + "class": "Visualizer.Scene", + "namespace": "Visualizer" + }, + { + "file": "build/js/j-visualizer.js", + "line": 636, "description": "widgets references a collection of \"widget\" Objects, each of which\nshould reference a Module, a ModuleView, an operation to call upon the ModuleView,\nand any additional parameters required (specifications for the ModuleView to follow).", "itemtype": "property", "name": "widgets", @@ -726,7 +730,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 644, + "line": 649, "description": "requestedModuleViews is a computed property that returns\na dictionary of Modules -> ModuleViews , used to determine which views will be\nused by the scene. This is particularly useful when changing scenes to determine\nwhich Views need to be cleared out, and which will be used in the next scene.\n\nUsed as a searchable dictionary: `requestedModuleViews[moduleA][moduleViewA] => true`", "itemtype": "property", "name": "requestedModuleViews", @@ -736,33 +740,42 @@ }, { "file": "build/js/j-visualizer.js", - "line": 667, + "line": 672, "description": "clearUnusedViews sends a \"clear\" request to each ModuleView used by the current\ninstance of Visualizer, which isn't used in any of this scene's widgets.\nIn essence it ensures that any Views that are not currently in use are cleansed.", "itemtype": "method", "name": "clearUnusedViews", - "return": { - "description": "", - "type": "Void" - }, + "chainable": 1, "class": "Visualizer.Scene", "namespace": "Visualizer" }, { "file": "build/js/j-visualizer.js", - "line": 701, + "line": 700, "description": "runWidgets iterated this scene's widgets, and requests that the ModuleView specified\nfor each widget executes the operation specified for each widget.\n\nFor example, it may tell one ModuleView, a word cloud, to draw itself, and\nanother ModuleView, a set of icons, to group themselves by common-words.", "itemtype": "method", "name": "runWidgets", + "chainable": 1, + "class": "Visualizer.Scene", + "namespace": "Visualizer" + }, + { + "file": "build/js/j-visualizer.js", + "line": 722, + "description": "_runWidget runs the current scene's operation for a single widget.\nWaits for repeating events to prevent multiple refreshes on the\nsame dimensions/parameters.", + "itemtype": "method", + "name": "_runWidget", "return": { "description": "", "type": "Void" }, + "access": "private", + "tagname": "", "class": "Visualizer.Scene", "namespace": "Visualizer" }, { "file": "build/js/j-visualizer.js", - "line": 725, + "line": 745, "description": "reload initiates the process of updating the visualization by cleaning out old Views\nand updating all current widgets.\n\nPrevents rapid-exectuion by delaying each request by an amount of time specified\n by property drawWait, and afterward only using the most recent request (as a debounce).", "itemtype": "method", "name": "reload", @@ -775,7 +788,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 762, + "line": 782, "description": "loaded is a boolean variable indicating whether or the world is\nprepared to hold a visualization.\n\nCurrently it simply check's whether the world JQuery object exists", "itemtype": "property", "name": "loaded", @@ -785,7 +798,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 773, + "line": 793, "description": "$ is a method which returns the world's JQuery Object, worldObj.\nIf a parameter is passed, $ will attempt to find that parameter\nwithing the structure of the worldObj.", "itemtype": "method", "name": "$", @@ -805,7 +818,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 790, + "line": 810, "description": "resize recalculates the width, height, top, and left properties of the\nworldObj DOM Element\n\nThis method is automatically called when a World is created.", "itemtype": "method", "name": "resize", @@ -818,7 +831,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 813, + "line": 833, "description": "_bindGlobalEvents binds this World's resize event to the window's resize,\nsuch that every time the window's size changes this World attempts to\nupdate its properties to reflect the new window.\n\nPrivate, since this method is automatically called when a World is created.", "itemtype": "method", "name": "_bindGlobalEvents", @@ -833,7 +846,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 832, + "line": 852, "description": "_bindWorldEvents binds and generic event listeners that\noccur within the World's domain\n\nPrivate, since this method is automatically called when a World is created\nas well as when the worldObj changes to reference a new area.", "itemtype": "method", "name": "_bindWorldEvents", @@ -848,37 +861,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 850, - "description": "injectDefaultWorld clears out the Visualizer World's contents, injects the basic\nvisualizer skeleton", - "deprecated": true, - "deprecationMessage": "@todo Deprecate this. ModuleViews should take care of this on a per-App basis...", - "itemtype": "method", - "name": "injectDefaultWorld", - "return": { - "description": "", - "type": "Void" - }, - "class": "Visualizer.World", - "namespace": "Visualizer" - }, - { - "file": "build/js/j-visualizer.js", - "line": 863, - "description": "resizeSharedArea updates the height of the \"shared area\" DOM element\nwithin the Visualizer World.", - "deprecated": true, - "deprecationMessage": "@todo: remove this - this should be the work of ModuleViews...", - "itemtype": "method", - "name": "resizeSharedArea", - "return": { - "description": "", - "type": "Void" - }, - "class": "Visualizer.World", - "namespace": "Visualizer" - }, - { - "file": "build/js/j-visualizer.js", - "line": 878, + "line": 872, "description": "_handlePhasedButtonClick is called when an element with class phasedButton\nis clicked. Adds a class 'disabledItem' to the element for 2 seconds;\nif the element is clicked again before the class 'disabledItem' class expires,\nthe click will be ignored.", "itemtype": "method", "name": "_handlePhasedButtonClick", @@ -893,7 +876,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 904, + "line": 896, "description": "removeInstancesOf removes traces of a provided value from an Array", "itemtype": "method", "name": "removeInstancesOf", @@ -912,7 +895,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 928, + "line": 920, "description": "shuffleVals - Fisher-Yates algorithm for shuffling arrays\nin-place. (Essentially goes through each slot in array and\nswitches its value with one from a random slot...)", "itemtype": "method", "name": "shuffleVals", @@ -925,7 +908,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 958, + "line": 950, "description": "values takes an Object and returns its values\n(similar to `.keys()`)", "itemtype": "method", "name": "values", @@ -938,7 +921,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 980, + "line": 972, "description": "addExpiringClass adds a temporary class to a JQuery object.\nThe class has an expiry, after which it is removed.", "itemtype": "method", "name": "addExpiringClass", @@ -967,7 +950,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1013, + "line": 1005, "description": "truncateTo ensures a string is no longer than a given size limit.\n(In the case that it is longer, a suffix can be given for truncation)", "itemtype": "method", "name": "truncateTo", @@ -994,7 +977,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1042, + "line": 1034, "description": "advancedIndexOf searches the object String for a parameter\nsubstring, allows additional options (such as case-insensitivity).", "itemtype": "method", "name": "advancedIndexOf", @@ -1020,7 +1003,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1069, + "line": 1061, "description": "includes searches the object String for a parameter\nsubstring, returns boolean, accepts optional parameter\nto specify whether the search should be case-insensitive.", "itemtype": "method", "name": "includes", @@ -1047,7 +1030,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1089, + "line": 1081, "description": "beginsWith searches the start of the object String for a parameter\nsubstring, returns boolean, accepts optional parameter\nto specify whether the search should be case-insensitive.", "itemtype": "method", "name": "beginsWith", @@ -1074,7 +1057,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1109, + "line": 1101, "description": "capitalizeLetter is a String capitalize function adapted from\nhttp://stackoverflow.com/a/3291856/624590 .\nCapitalizes the letter at position n of the object String.", "itemtype": "method", "name": "capitalizeLetter", @@ -1096,7 +1079,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1131, + "line": 1123, "description": "titleize creates a title-formatted copy of a String", "itemtype": "method", "name": "titleize", @@ -1109,7 +1092,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1147, + "line": 1139, "description": "removeInitialUnderscore removes the first leading underscore from a String", "itemtype": "method", "name": "removeInitialUnderscore", @@ -1122,7 +1105,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1176, + "line": 1168, "description": "existsWithValue checks if a values isn't null/undefined", "itemtype": "method", "name": "existsWithValue", @@ -1142,7 +1125,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1187, + "line": 1179, "description": "waitForRepeatingEvents is a debounce-like function for preventing\nmultiple execution. It should be called with a function and an\namount of time to wait. It can also be provided a timer name so as\nto namespace the blocked items. It can also be called with an Object\ntimer set to allow different objects to not prevent the execution of\nfunctions in others.", "itemtype": "method", "name": "waitForRepeatingEvents", @@ -1177,7 +1160,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1219, + "line": 1213, "description": "minVal takes two parameters, returns the smaller", "itemtype": "method", "name": "minVal", @@ -1202,7 +1185,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1235, + "line": 1229, "description": "maxVal takes two parameters, returns the larger", "itemtype": "method", "name": "maxVal", @@ -1227,7 +1210,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1251, + "line": 1245, "description": "boundedVal takes three parameters: an item, the lower bound,\nand the upper bound. If the item is between the bounds,\nthe item is returned, otherwise the failed bound is returned.", "itemtype": "method", "name": "boundedVal", @@ -1257,7 +1240,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1272, + "line": 1266, "description": "randBetween provides a random number between two values.", "itemtype": "method", "name": "randBetween", @@ -1286,7 +1269,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1290, + "line": 1284, "description": "randIntBetween provides a random (rounded) Integer between two values.", "itemtype": "method", "name": "randIntBetween", @@ -1311,7 +1294,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1302, + "line": 1296, "description": "isArray returns a flag of whether the parameter is of type Array", "itemtype": "method", "name": "isArray", @@ -1331,7 +1314,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1313, + "line": 1307, "description": "relativeSizeString parses an input size for either an explicit\nvalue, or a value in relationship to some parent value.\nE.g. \"50%\" of 900 = 450, \"50\" = 50, \"50px\" = 50", "itemtype": "method", "name": "relativeSizeString", @@ -1356,7 +1339,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1333, + "line": 1327, "description": "intersectionSafe is simple intersection code, iterates along two\nsorted arrays incrementing the index of the smaller value\n(if values are equal, it is part of intersection, and so store position and iterate both).\nReturns array of indices of intersecting values with respect to the first array passed.\n\nintersectionSafe is modified from code found on StackOverflow at:\nhttp://stackoverflow.com/a/1885660/624590", "itemtype": "method", "name": "intersectionSafe", @@ -1381,7 +1364,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1366, + "line": 1360, "description": "intersectionCount is a modified form of intersectionSafe that simply\nincrements a counter instead of building an intersection Array.\n(Faster because increments rather than pushing values to array,\nalso more memory efficient; JSPerf suggests 100% performance increase\n- beneficial for large datasets...)", "itemtype": "method", "name": "intersectionCount", @@ -1406,7 +1389,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1397, + "line": 1391, "description": "cloneArray creates a copy of an Array.", "deprecated": true, "deprecationMessage": "use Array.copy instead.", @@ -1428,7 +1411,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1499, + "line": 1470, "description": "visualizer is a reference to the parent Visualizer instance.", "itemtype": "property", "name": "visualizer", @@ -1439,7 +1422,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1508, + "line": 1479, "description": "maxLength is an integer size of how much data should be displayed.\nSometimes a project will collect more data than is practical to display\nto the user (either because it will be confusing, or otherwise too slow);\nthis property represents that limit.", "itemtype": "property", "name": "maxLength", @@ -1450,7 +1433,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1520, + "line": 1491, "description": "content is the full set of data (in Array , Ember.Array) form that is\navailable to this Module.\n\nNote: this attribute should only be accessed from the\ndata-management side of your app; it's where you dump data, and it's\nwhat you generally access for front-end filtering. This Module's\nModuleViews should not access the content, however - they should access\nthe dataset (which is a subset of content).", "itemtype": "property", "name": "content", @@ -1461,7 +1444,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1538, + "line": 1509, "description": "dataset is the subset of content used for current visualization.\nIt can potentially be the exact same data as content, in full,\nbut it can also be a limited/truncated version (often using the\nmaxLength property). It may also filtered down by properties, etc.\n\nModuleViews should only look here for their Module data.", "itemtype": "property", "name": "dataset", @@ -1472,7 +1455,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1553, + "line": 1524, "description": "moduleViews an object dictionary/map of Visualizer ModuleView objects,\neach of which must be relevant to this particular Module's data structuring.\n\nFor example, if this Module is a set of words with frequencies, a WordCloud\nmay be an applicable ModuleView.", "itemtype": "property", "name": "moduleViews", @@ -1483,7 +1466,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1568, + "line": 1539, "description": "init is called upon creation of a Visualizer Module Object.\nIt is responsible for the initial processing and setup of the Object.\n\nAny preprocessing that is required to make the Module valid should be\ndone, at latest, on init.\n\nIf the Module defines a setDefaultViews function (to prepopulate its\nModuleViews), that function will be called automatically.", "is_constructor": 1, "class": "Visualizer.Module", @@ -1491,7 +1474,20 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1584, + "line": 1555, + "description": "requestRedraw sends a request to the current scene\nto redraw the widgets relevant to this module (and no others).", + "itemtype": "method", + "name": "requestRedraw", + "return": { + "description": "", + "type": "Void" + }, + "class": "Visualizer.Module", + "namespace": "Visualizer" + }, + { + "file": "build/js/j-visualizer.js", + "line": 1571, "description": "forceLimit sorts the current data by a provided key, and selects only the\nfirst maxLength (property) items for this Module's dataset, ensuring that\nthe limit to the viewed-data's size is enforced.", "todo": [ "consider implementing a n-item max-heap data structure instead of sorting" @@ -1516,7 +1512,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1606, + "line": 1593, "description": "groupedBy creates a cached property on the Module to retrieve its data\nin the form of a two-dimensional Array, where the sub arrays contain\nthis Module's dataset split into sets that share a common (passed) property.\n\nThe outside Array is sorted by length, so the largest groups are at the start.\n\nSince the result is cached, it will only be recomputed when the dataset changes,\nkeeping this efficient. The first time you use groupBy for any given property\nafter the data changes (or is created) runs O(nlogn), but each subsequent access\nis simply O(1) as it simply grabs the previous data. Say what??? :P", "itemtype": "method", "name": "groupedBy", @@ -1536,7 +1532,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1638, + "line": 1625, "description": "_groupedBy groups the Module's dataset by a given property, returning\nan unsorted, two-dimensional array.\n\nThis method should not be called explicitly, instead developers should\ngo through the `groupedBy` method (no leading underscore), which\ncaches the groups (making redraws far more efficient)", "itemtype": "method", "name": "_groupedBy", @@ -1556,7 +1552,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1681, + "line": 1668, "description": "module is a reference to the parent Module for this ModuleView instance.", "itemtype": "property", "name": "module", @@ -1567,7 +1563,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1690, + "line": 1677, "description": "containerSelector is a string CSS selector used for finding\nthis ModuleView's window in a Visualization.\n\nOften unique, but occasionally multiple ModuleViews will be\nwritten to share a container.\n\nOften this property will be specified in a widget's parameters,\notherwise child classes to ModuleView should specify defaults.\nIf a widget does specify a `container` param, it will be set and used\nrunning any operation.", "itemtype": "property", "name": "containerSelector", @@ -1578,7 +1574,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1708, + "line": 1695, "description": "previousSelectors is a list history of selectors that were\npreviously set as this instance of a ModuleView's containerSelector.\n\nThis may be useful for navigation, or for cleaning up after a visualization.", "itemtype": "property", "name": "previousSelectors", @@ -1588,7 +1584,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1721, + "line": 1708, "description": "visualizer is a reference to the parent Visualizer instance.", "itemtype": "property", "name": "visualizer", @@ -1599,7 +1595,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1730, + "line": 1717, "description": "data is a reference to the visible data for visualization.", "itemtype": "property", "name": "data", @@ -1610,7 +1606,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1739, + "line": 1726, "description": "arrangedContent is a reference to all Module data (sorted/arranged).\nThis property should only seldom be accessed because it includes\ndata which is deemed irrelevant by the Module (filtered, etc.)\n\nIt may, however, be useful if a View decides to animate old data away\nupon filtering / limiting its viewable data.", "itemtype": "property", "name": "arrangedContent", @@ -1621,7 +1617,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1753, + "line": 1740, "description": "dimensionsDidChange is a flag used by ModuleViews to decide how much\nprocessing is required when they run an operation.\n\nIf all dimensions, including visible data, width, and height, are\nunchanged, often times the old Visualization can simply be shown.\n\nSet to true by default, so that ModuleViews can have a proper first-draw.", "itemtype": "property", "name": "dimensionsDidChange", @@ -1631,7 +1627,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1767, + "line": 1754, "description": "init is called upon creation of a Visualizer ModuleView Object.\nIt is responsible for the initial processing and setup of the Object.\n\nAny preprocessing that is required to make the Module valid should be\ndone, at latest, on init. By default it sets the parent Module reference.", "is_constructor": 1, "class": "Visualizer.ModuleView", @@ -1639,7 +1635,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1780, + "line": 1767, "description": "clear cleanses/hides the current ModuleView from the visualization.\n\nThis method is often called when a widget representing the ModuleView\nleaves a visualization (either being removed from a scene,\nor not being part of a new scene.)\n\nEach ModuleView should implement/override this, and should\nprovide (at least) the following functionality:\n - hide the container/elements (to prevent overlap/event-disruption),\n - unset isDrawn so that next time we know to fully redraw, etc.\n\nOptionally, it should also empty the DOM Node/SVG to save memory", "itemtype": "method", "name": "clear", @@ -1652,7 +1648,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1799, + "line": 1786, "description": "destroy totally removes the current ModuleView from the visualization.\nThis should entirely empty and remove any DOM-or-SVG Elements from the\ndocument.\n\nThis method is rarely called unless the Visualizer is being removed entirely.\n\nEach ModuleView should implement/override this function.", "itemtype": "method", "name": "destroy", @@ -1665,7 +1661,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1815, + "line": 1802, "description": "run is used used to execute a widget's operation on a ModuleView.\nMany times additional parameters are passed, these assist in updating a\nModuleView by providing the widget's specifications (container, width,\nany data limitations, etc.)\n\nIf params includes a `container` key, its value will be used to define\nthis particular ModuleView's container viewport.", "itemtype": "method", "name": "run", @@ -1691,7 +1687,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1840, + "line": 1827, "description": "updateSelector takes a new containerSelector parameter, and uses it to\nchange this ModuleView's viewport. It also updates the `previousSelectors`\nhistory to contain the selector that was used before this method was called.", "itemtype": "method", "name": "updateSelector", @@ -1711,7 +1707,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1858, + "line": 1845, "description": "$container is a method which returns the ModuleView's container/viewport\nJQuery Object.\n\nIf a parameter is passed, $container will attempt to find that parameter\nwithing the structure of its container object.", "itemtype": "method", "name": "$container", @@ -1732,7 +1728,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1875, + "line": 1862, "description": "hardReset clears out the ModuleView and tells it that dimensionsDidChange,\nso the next redraw/execution is a fresh one (fully recalculated).\n\nThis is automatically called when the ModuleView's data changes.", "itemtype": "method", "name": "hardReset", @@ -1745,7 +1741,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1889, + "line": 1876, "description": "widgetParamedOutlineCSS provides an Object where keys/values map to CSS attributes\nrelevant to the container ONLY for manually specified dimensions/positions.\n\nThe point of this method is to provide access to data that can be used to set the\nstyle of the DOM element containing this ModuleView to the manually-set specifications.\n\nIf a developer opts to simply use a container's size/position, this will return an\nempty object.", "itemtype": "method", "name": "widgetParamedOutlineCSS", @@ -1766,7 +1762,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1919, + "line": 1906, "description": "width getter/setter. Uses _updateDimension to coerce the set value\nto an expected format (as well as to determine whether a dimension changed).", "itemtype": "method", "name": "width", @@ -1793,7 +1789,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1933, + "line": 1920, "description": "height getter/setter. Uses _updateDimension to coerce the set value\nto an expected format (as well as to determine whether a dimension changed).", "itemtype": "method", "name": "height", @@ -1820,7 +1816,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1947, + "line": 1934, "description": "_updateDimension is used when setting width or height.\nIt accepts a key (which should be set to \"width\" or \"height\"),\nand a value.\n\nThe value is rounded down to the nearest integer to keep the DOM clean,\nand to keep determining changes simple.\n\nIf the value isn't the same as this ModuleView's previous value for the\nsame key property, dimensionsDidChange flag will be set true so that the\nModuleView knows to perform its next operation with full calculations.", "itemtype": "method", "name": "_updateDimension", @@ -1847,7 +1843,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 1976, + "line": 1963, "description": "_presetContainerAttrs is used when running an operation to ensure that\nrequired attributes based on the viewport (such as available width/height)\nfor visualization are set.\n\nIf width or height are manually specified, this will not update that attribute -\nin these cases, the ModuleView should know how to handle explicit dimensions.\nThe \"resizable mixin\" can help with this (more details in _resizable_mixin file)", "itemtype": "method", "name": "_presetContainerAttrs", @@ -1868,7 +1864,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 2023, + "line": 2012, "description": "run hijacks the ModuleView's run method to first attempt to update\nthe viewport's size based on the parameter specifications.\nAfter attempting to update the size/position of the viewport,\nthe ModuleView's run function is allowed to proceed.", "itemtype": "method", "name": "run", @@ -1894,7 +1890,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 2042, + "line": 2031, "description": "_updateSize scans the widget-sent params for manually-set\nsize/position values, uses these to set up the ModuleView's\nrelevant attributes.", "itemtype": "method", "name": "_updateSize", @@ -1917,7 +1913,7 @@ }, { "file": "build/js/j-visualizer.js", - "line": 2079, + "line": 2068, "description": "_tryUpdateValue given a sizing/position-defining key and value,\nthis method attempts to parse the value and, if it's a relative\npercentage or String, coerce it to an integer.\n\nAllows values to be explicit (e.g. 50, or \"50px\"), or relative\nto the Visualizer's World (e.g. \"50%\"). Parameter relativeReq is\nused to specify which of the World's parameters should be used to\ndetermine a relative size (e.g. \"left\" uses the World's \"width\").\n\nparams may also specify an amount of padding.", "itemtype": "method", "name": "_tryUpdateValue", @@ -1961,21 +1957,17 @@ "message": "Missing item type\ninit is called upon creation of a Visualizer Object.\nIt is responsible for the initial processing and setup of the Object.", "line": " build/js/j-visualizer.js:83" }, - { - "message": "Missing item type\nAlias for Visualizer.World method: injectDefaultWorld", - "line": " build/js/j-visualizer.js:113" - }, { "message": "Missing item type\ninit is called upon creation of a Visualizer Colorer Object.\nIt is responsible for the initial processing and setup of the Object.", - "line": " build/js/j-visualizer.js:255" + "line": " build/js/j-visualizer.js:249" }, { "message": "Missing item type\ninit is called upon creation of a Visualizer Module Object.\nIt is responsible for the initial processing and setup of the Object.\n\nAny preprocessing that is required to make the Module valid should be\ndone, at latest, on init.\n\nIf the Module defines a setDefaultViews function (to prepopulate its\nModuleViews), that function will be called automatically.", - "line": " build/js/j-visualizer.js:1568" + "line": " build/js/j-visualizer.js:1539" }, { "message": "Missing item type\ninit is called upon creation of a Visualizer ModuleView Object.\nIt is responsible for the initial processing and setup of the Object.\n\nAny preprocessing that is required to make the Module valid should be\ndone, at latest, on init. By default it sets the parent Module reference.", - "line": " build/js/j-visualizer.js:1767" + "line": " build/js/j-visualizer.js:1754" } ] } \ No newline at end of file diff --git a/documentation/files/build_js_j-visualizer.js.html b/documentation/files/build_js_j-visualizer.js.html index 4b8bb24..77ddca8 100644 --- a/documentation/files/build_js_j-visualizer.js.html +++ b/documentation/files/build_js_j-visualizer.js.html @@ -218,14 +218,6 @@

    File: build/js/j-visualizer.js

    })); }, - /** - * Alias for Visualizer.World method: injectDefaultWorld - * @deprecated Use (visualizer).get('world').injectDefaultWorld() - */ - injectWorld: function() { - return this.get('world').injectDefaultWorld(); - }, - /** * addModule creates a Visualizer.Module object specified by the moduleClass parameter, * using a provided key (to allow differentiation and access). If (optional) content @@ -240,14 +232,16 @@

    File: build/js/j-visualizer.js

    * @return {void} */ addModule: function(moduleClass, moduleKey, content) { - this.set("modules." + moduleKey, moduleClass.create({ + var module; + module = moduleClass.create({ visualizer: this, key: moduleKey - })); + }); + this.set("modules." + moduleKey, module); if (content != null) { this.set("modules." + moduleKey + ".content", content); } - return this.refresh(); + return module.requestRedraw(); }, /** @@ -725,8 +719,8 @@

    File: build/js/j-visualizer.js

    description: null, /** - * drawWait is the debounce time waited before updating the scene. - * If a scene's reload is requested many times in rapid succession it will wait + * drawWait is the debounce time waited before running a single widget's update. + * If a widget's reload is requested many times in rapid succession it will wait * until drawWait milliseconds after the last call before executing the reload. * * @property drawWait @@ -736,6 +730,17 @@

    File: build/js/j-visualizer.js

    */ drawWait: 100, + /** + * fullRefreshWait is an additional debounce time waited before + * totally updating the scene. This adds some + * + * @property fullRefreshWait + * @type Integer (milliseconds) + * @default 20 + * @required + */ + fullRefreshWait: 20, + /** * widgets references a collection of "widget" Objects, each of which * should reference a Module, a ModuleView, an operation to call upon the ModuleView, @@ -778,32 +783,26 @@

    File: build/js/j-visualizer.js

    * In essence it ensures that any Views that are not currently in use are cleansed. * * @method clearUnusedViews - * @return {void} + * @chainable */ clearUnusedViews: function() { - var module, moduleName, view, viewName, _ref, _results; + var module, moduleName, view, viewName, _ref, _ref1; _ref = this.get("visualizer.modules"); - _results = []; for (moduleName in _ref) { if (!__hasProp.call(_ref, moduleName)) continue; module = _ref[moduleName]; - _results.push((function() { - var _ref1, _results1; - _ref1 = module.get('moduleViews'); - _results1 = []; - for (viewName in _ref1) { - if (!__hasProp.call(_ref1, viewName)) continue; - view = _ref1[viewName]; - if (!this.get("requestedModuleViews." + moduleName + "." + viewName)) { - _results1.push(typeof view.clear === "function" ? view.clear() : void 0); - } else { - _results1.push(void 0); + _ref1 = module.get('moduleViews'); + for (viewName in _ref1) { + if (!__hasProp.call(_ref1, viewName)) continue; + view = _ref1[viewName]; + if (!this.get("requestedModuleViews." + moduleName + "." + viewName)) { + if (typeof view.clear === "function") { + view.clear(); } } - return _results1; - }).call(this)); + } } - return _results; + return this; }, /** @@ -814,20 +813,41 @@

    File: build/js/j-visualizer.js

    * another ModuleView, a set of icons, to group themselves by common-words. * * @method runWidgets - * @return {void} + * @chainable */ runWidgets: function(widgets) { - var moduleView, widget, _i, _len, _results; + var widget, _i, _len; if (widgets == null) { widgets = this.get('widgets'); } - _results = []; for (_i = 0, _len = widgets.length; _i < _len; _i++) { widget = widgets[_i]; - moduleView = this.get("visualizer.modules." + widget.module + ".moduleViews." + widget.view); - _results.push(moduleView != null ? moduleView.run(widget.operation, widget.params) : void 0); + this._runWidget(widget); } - return _results; + return this; + }, + + /** + * _runWidget runs the current scene's operation for a single widget. + * Waits for repeating events to prevent multiple refreshes on the + * same dimensions/parameters. + * + * @method _runWidget + * @return {void} + * @private + */ + _runWidget: function(widget) { + var viewIdentifier; + if (widget == null) { + widget = {}; + } + viewIdentifier = "visualizer.modules." + widget.module + ".moduleViews." + widget.view; + return Visualizer.Utils.waitForRepeatingEvents(((function(_this) { + return function() { + var _ref; + return (_ref = _this.get(viewIdentifier)) != null ? _ref.run(widget.operation, widget.params) : void 0; + }; + })(this)), this.get("drawWait"), "Scene Redraw for " + viewIdentifier, this.get('visualizer.timers')); }, /** @@ -846,7 +866,7 @@

    File: build/js/j-visualizer.js

    _this.clearUnusedViews(); return _this.runWidgets(); }; - })(this)), this.get("drawWait"), "Scene Reload", this.get('visualizer.timers')); + })(this)), this.get('fullRefreshWait'), "Full Scene Reload", this.get('visualizer.timers')); } }); @@ -863,7 +883,7 @@

    File: build/js/j-visualizer.js

    */ (function() { - var defaultWorldTemplate, _handlePhasedButtonClick; + var _handlePhasedButtonClick; this.Visualizer.World = Ember.Object.extend({ @@ -953,33 +973,7 @@

    File: build/js/j-visualizer.js

    if (($world = this.$()).length) { return $world.off("click", ".phasedButton").on("click", ".phasedButton", _handlePhasedButtonClick); } - }).observes('worldObj').on('init'), - - /** - * injectDefaultWorld clears out the Visualizer World's contents, injects the basic - * visualizer skeleton - * - * @deprecated @todo Deprecate this. ModuleViews should take care of this on a per-App basis... - * - * @method injectDefaultWorld - * @return {void} - */ - injectDefaultWorld: function() { - return this.$().empty().append($(defaultWorldTemplate)); - }, - - /** - * resizeSharedArea updates the height of the "shared area" DOM element - * within the Visualizer World. - * - * @deprecated @todo: remove this - this should be the work of ModuleViews... - * - * @method resizeSharedArea - * @return {void} - */ - resizeSharedArea: (function() { - return this.$("#shared-area").css('height', "" + (this.get('height')) + "px"); - }).observes('height') + }).observes('worldObj').on('init') }); @@ -1004,8 +998,6 @@

    File: build/js/j-visualizer.js

    }); }; - defaultWorldTemplate = "<div id='static-area' class='static-area'> <div id='visualizer-loading-indicator'> </div> </div> <div id='shared-area'> </div>"; - }).call(this); @@ -1311,14 +1303,16 @@

    File: build/js/j-visualizer.js

    var func, _timers; _timers = {}; return func = function(callback, timeout, timerName, timerSet) { + var storedTimer; if (timerName == null) { timerName = "default timer"; } if (timerSet == null) { timerSet = _timers; } - if (timerSet[timerName]) { - clearTimeout(timerSet[timerName]); + storedTimer = timerSet[timerName]; + if (storedTimer) { + clearTimeout(storedTimer); } return timerSet[timerName] = setTimeout(callback, timeout); }; @@ -1522,29 +1516,6 @@

    File: build/js/j-visualizer.js

    }; - /* - * Previously Globally defined functions... - */ - - window.waitForRepeatingEvents = function() { - if (typeof console !== "undefined" && console !== null) { - if (typeof console.log === "function") { - console.log("Global Namespace for waitForRepeatingEvents function is deprecated, please use Visualizer.Utils.waitForRepeatingEvents"); - } - } - return Visualizer.Utils.waitForRepeatingEvents.apply(window, arguments); - }; - - window.existsWithValue = function() { - if (typeof console !== "undefined" && console !== null) { - if (typeof console.log === "function") { - console.log("Global Namespace for existsWithValue function is deprecated, please use Visualizer.Utils.existsWithValue"); - } - } - return Visualizer.Utils.existsWithValue.apply(window, arguments); - }; - - /* * FUN! */ @@ -1689,6 +1660,22 @@

    File: build/js/j-visualizer.js

    return typeof this.setDefaultViews === "function" ? this.setDefaultViews() : void 0; }, + /** + * requestRedraw sends a request to the current scene + * to redraw the widgets relevant to this module (and no others). + * + * @method requestRedraw + * @return {void} + */ + requestRedraw: function() { + var key, scene, _ref; + scene = this.get('visualizer.currentScene'); + key = this.get('key'); + if ((scene != null) && (key != null)) { + return scene.runWidgets((_ref = scene.get('widgets')) != null ? _ref.filterBy('module', key) : void 0); + } + }, + /** * forceLimit sorts the current data by a provided key, and selects only the * first maxLength (property) items for this Module's dataset, ensuring that @@ -1991,7 +1978,7 @@

    File: build/js/j-visualizer.js

    */ hardReset: (function() { this.set('dimensionsDidChange', true); - return this.run('clear'); + return this.get('module').requestRedraw(); }).observes('data'), /** @@ -2099,12 +2086,14 @@

    File: build/js/j-visualizer.js

    if (params == null) { params = {}; } - container = this.$container(); - if (params.width == null) { - this.set('width', container.width()); - } - if (params.height == null) { - return this.set('height', container.height()); + if (!((params.width != null) && (params.height != null))) { + container = this.$container(); + if (params.width == null) { + this.set('width', container.width()); + } + if (params.height == null) { + return this.set('height', container.height()); + } } } }); diff --git a/spec/bower.json b/spec/bower.json index 1ea1f4c..25193c1 100644 --- a/spec/bower.json +++ b/spec/bower.json @@ -1,5 +1,5 @@ { - "name": "j-visualizer", + "name": "j-visualizer-spec", "dependencies": { "ember-runtime": "http://builds.emberjs.com.s3.amazonaws.com/beta/daily/20130909/ember-runtime.js", "jquery": "> 2.0", diff --git a/spec/fixtures/vis_fixtures.js b/spec/fixtures/vis_fixtures.js index a98dda1..a31902b 100644 --- a/spec/fixtures/vis_fixtures.js +++ b/spec/fixtures/vis_fixtures.js @@ -28,6 +28,7 @@ visSpecFixtures.specModule = Visualizer.Module.extend({ visSpecFixtures.specScenes = [ { identifier: "1", + fullRefreshWait: 10, widgets: [{ module: "0", view: "specView", @@ -43,6 +44,7 @@ visSpecFixtures.specScenes = [ { identifier: "2", drawWait: 10, + fullRefreshWait: 10, widgets: [{ module: "1", view: "specView", diff --git a/spec/module_views/module_views_spec.js b/spec/module_views/module_views_spec.js index beb90df..27f1ae0 100644 --- a/spec/module_views/module_views_spec.js +++ b/spec/module_views/module_views_spec.js @@ -99,7 +99,6 @@ test('dimensionsDidChange , hardReset', function() { ok(!_testModuleView.get('testCleared'), "Clear function not yet triggered."); _testModuleView.hardReset(); equal(_testModuleView.get('dimensionsDidChange'), true, "hardReset caused dimensionsDidChange to flip to true"); - ok(_testModuleView.get('testCleared'), "hardReset triggered clear function."); }); @@ -202,4 +201,4 @@ test('run (WITH explicit size dimensions)', function() { var cssAttrs = _testModuleView.widgetParamedOutlineCSS(testParams); equal(cssAttrs.width, _testModuleView.get('width')+"px", "widgetParamedOutlineCSS has width with 'px' suffix"); equal(cssAttrs.height, _testModuleView.get('height')+"px", "widgetParamedOutlineCSS has height with 'px' suffix"); -}); \ No newline at end of file +}); diff --git a/spec/modules/modules_spec.js b/spec/modules/modules_spec.js index 1752a3f..8d8479b 100644 --- a/spec/modules/modules_spec.js +++ b/spec/modules/modules_spec.js @@ -99,4 +99,24 @@ test('groupedBy', function() { var thirdGroupedReduced = thirdGroupedFetch[0].reduce(reduceFunc, ''); ok(['13', '31'].indexOf(thirdGroupedReduced) > -1, "Since none of the first group's types \ really changed, the groups are the same."); -}); \ No newline at end of file +}); + +// requestRedraw +asyncTest('requestRedraw', 2, function() { + var _specWait = (_vis.get('currentScene.drawWait') + _vis.get('currentScene.fullRefreshWait')) + 50; + var redrawModule = _vis.get('modules.0'); + var ignoredModule = _vis.get('modules.2'); + var _viewVal = 'moduleViews.specView.val'; + + Ember.run.later(this, function () { + var prevRedrawModuleVal = redrawModule.get(_viewVal); + var prevIgnoredModuleVal = ignoredModule.get(_viewVal); + + redrawModule.requestRedraw(); + Ember.run.later(this, function () { + equal(redrawModule.get(_viewVal), prevRedrawModuleVal+1, "The test module view value has been incremented"); + equal(ignoredModule.get(_viewVal), prevIgnoredModuleVal, "The unrelated module's view value is unchanged."); + start(); + }, _specWait); + }, _specWait); +}); diff --git a/spec/vis_scene/vis_scene_spec.js b/spec/vis_scene/vis_scene_spec.js index 8156ea5..64a13fa 100644 --- a/spec/vis_scene/vis_scene_spec.js +++ b/spec/vis_scene/vis_scene_spec.js @@ -8,7 +8,7 @@ module("Visualizer.Scene Unit Test", { _vis = getSpecVisualizer(); _defaultScene = _vis.get('currentScene'); _specDrawWait = 30; - _specWait = (_specDrawWait*1.1); + _specWait = (_specDrawWait + _defaultScene.get('fullRefreshWait'))*1.1; }, /** @@ -45,34 +45,41 @@ test('requestedModuleViews', function() { }); + // drawWait -asyncTest('drawWait', 3, function() { +// default value: +test('drawWait default', function() { var _defaultWaitTime = 100; - - var initialValue = _vis.get('modules.0.moduleViews.specView.val'); equal(_defaultScene.get('drawWait'), _defaultWaitTime, "default drawWait time is 100"); +}); - // Let's tone down the drawWait value to make the tests run more quickly... - _defaultScene.set('drawWait', _specDrawWait) +// drawWait is used: +asyncTest('drawWait is used', 2, function() { + Ember.run.later(this, function () { // Allow the initial run (when adding the module) to occur first... - _defaultScene.reload(); - _defaultScene.reload(); // Repeated call! - _defaultScene.reload(); // Repeated call! - _defaultScene.reload(); // Repeated call! + var initialValue = _vis.get('modules.0.moduleViews.specView.val'); + // Let's tone down the drawWait value to make the tests run more quickly... + _defaultScene.set('drawWait', _specDrawWait) - Ember.run.later(this, function () { - var newValue = _vis.get('modules.0.moduleViews.specView.val'); - equal(newValue, initialValue+1, "Although reload was called four times in succession, \ - only one triggered because drawWait time hadn't passed"); + _defaultScene.reload(); + _defaultScene.reload(); // Repeated call! + _defaultScene.reload(); // Repeated call! + _defaultScene.reload(); // Repeated call! - _defaultScene.reload(); // Try reloading again again... Ember.run.later(this, function () { - var finalValue = _vis.get('modules.0.moduleViews.specView.val'); - equal(finalValue, newValue+1, "However, it can be reloaded again after the drawWait time passes."); + var newValue = _vis.get('modules.0.moduleViews.specView.val'); + equal(newValue, initialValue+1, "Although reload was called four times in succession, \ + only one triggered because drawWait time hadn't passed"); - start(); - }, _specWait); + _defaultScene.reload(); // Try reloading again again... + Ember.run.later(this, function () { + var finalValue = _vis.get('modules.0.moduleViews.specView.val'); + equal(finalValue, newValue+1, "However, it can be reloaded again after the drawWait time passes."); + start(); + }, _specWait); + + }, _specWait); }, _specWait); }); @@ -83,33 +90,35 @@ asyncTest('drawWait', 3, function() { // Any widget that gets cleared (leaves a scene) results in a value of 0. */ asyncTest('reload (runWidgets and clear)', 6, function() { - var getViewValues = function(){ - return { - 0: _vis.get('modules.0.moduleViews.specView.val'), - 1: _vis.get('modules.1.moduleViews.specView.val'), - 2: _vis.get('modules.2.moduleViews.specView.val'), + Ember.run.later(this, function () { // Allow the initial run (when adding the module) to occur first... + var getViewValues = function(){ + return { + 0: _vis.get('modules.0.moduleViews.specView.val'), + 1: _vis.get('modules.1.moduleViews.specView.val'), + 2: _vis.get('modules.2.moduleViews.specView.val'), + }; }; - }; - var initialValues = getViewValues(); - // Let's tone down the drawWait value to make the tests run more quickly... - _defaultScene.set('drawWait', _specDrawWait) - _defaultScene.reload(); - Ember.run.later(this, function () { - var newValues = getViewValues(); - equal(newValues[0], initialValues[0]+1, "View 0 incremented"); - equal(newValues[2], initialValues[2]+2, "View 2 increased by 2 (using the params)"); // Tests that params work, too! - equal(newValues[1], 0, "View 1 value was cleared!"); - - // Switch scenes, wait for the automatic reload: - _vis.setScene('2'); + var initialValues = getViewValues(); + // Let's tone down the drawWait value to make the tests run more quickly... + _defaultScene.set('drawWait', _specDrawWait) + _defaultScene.reload(); Ember.run.later(this, function () { - var finalValues = getViewValues(); - equal(finalValues[1], newValues[1]+1, "View 1 value was incremented"); - equal(finalValues[0], 0, "View 0 was cleared!"); - equal(finalValues[2], 0, "View 2 was cleared!"); + var newValues = getViewValues(); + equal(newValues[0], initialValues[0]+1, "View 0 incremented"); + equal(newValues[2], initialValues[2]+2, "View 2 increased by 2 (using the params)"); // Tests that params work, too! + equal(newValues[1], 0, "View 1 value was cleared!"); + + // Switch scenes, wait for the automatic reload: + _vis.setScene('2'); + Ember.run.later(this, function () { + var finalValues = getViewValues(); + equal(finalValues[1], newValues[1]+1, "View 1 value was incremented"); + equal(finalValues[0], 0, "View 0 was cleared!"); + equal(finalValues[2], 0, "View 2 was cleared!"); + + start(); + }, _specWait); - start(); }, _specWait); - }, _specWait); }); diff --git a/src/j_visualizer.js.coffee b/src/j_visualizer.js.coffee index 21f515d..6d6435f 100644 --- a/src/j_visualizer.js.coffee +++ b/src/j_visualizer.js.coffee @@ -91,12 +91,6 @@ worldObj: $ world visualizer: this - ###* - # Alias for Visualizer.World method: injectDefaultWorld - # @deprecated Use (visualizer).get('world').injectDefaultWorld() - ### - injectWorld: () -> @get('world').injectDefaultWorld() - ###* # addModule creates a Visualizer.Module object specified by the moduleClass parameter, # using a provided key (to allow differentiation and access). If (optional) content @@ -111,9 +105,10 @@ # @return {void} ### addModule: (moduleClass, moduleKey, content) -> - @set("modules.#{moduleKey}", moduleClass.create({visualizer: this, key: moduleKey})) + module = moduleClass.create({visualizer: this, key: moduleKey}) + @set("modules.#{moduleKey}", module) @set("modules.#{moduleKey}.content", content) if content? - @refresh() + module.requestRedraw() ###* # refresh sends a request to the current scene to update the visualization diff --git a/src/module_views/_module_view.js.coffee b/src/module_views/_module_view.js.coffee index 92e68b6..dc488c2 100644 --- a/src/module_views/_module_view.js.coffee +++ b/src/module_views/_module_view.js.coffee @@ -202,7 +202,7 @@ ### hardReset: (()-> @set('dimensionsDidChange', true) # Because the data itself is sort of a dimension, too... - @run('clear') + @get('module').requestRedraw() ).observes('data') ###* @@ -292,6 +292,7 @@ # @return {void} ### _presetContainerAttrs: (params={}) -> - container = @$container() - (@set 'width', container.width()) unless params.width? - (@set 'height', container.height()) unless params.height? + unless params.width? and params.height? + container = @$container() + (@set 'width', container.width()) unless params.width? + (@set 'height', container.height()) unless params.height? diff --git a/src/modules/_visualizer_module.js.coffee b/src/modules/_visualizer_module.js.coffee index 3a69017..e3e57f5 100644 --- a/src/modules/_visualizer_module.js.coffee +++ b/src/modules/_visualizer_module.js.coffee @@ -92,6 +92,19 @@ init: -> @setDefaultViews?() + ###* + # requestRedraw sends a request to the current scene + # to redraw the widgets relevant to this module (and no others). + # + # @method requestRedraw + # @return {void} + ### + requestRedraw: ()-> + scene = @get('visualizer.currentScene') + key = @get('key') + if scene? and key? + scene.runWidgets scene.get('widgets')?.filterBy('module', key) + ###* # forceLimit sorts the current data by a provided key, and selects only the # first maxLength (property) items for this Module's dataset, ensuring that diff --git a/src/utils/vis_utils.js.coffee b/src/utils/vis_utils.js.coffee index 9a493e5..deb4883 100644 --- a/src/utils/vis_utils.js.coffee +++ b/src/utils/vis_utils.js.coffee @@ -34,7 +34,8 @@ waitForRepeatingEvents: (()-> #Tested _timers = {} return func = (callback, timeout, timerName = "default timer", timerSet = _timers) -> - clearTimeout(timerSet[timerName]) if timerSet[timerName] + storedTimer = timerSet[timerName] + clearTimeout(storedTimer) if storedTimer timerSet[timerName] = setTimeout(callback, timeout) )() @@ -196,24 +197,6 @@ console?.log? "cloneArray function is deprecated, please use Array.copy()" inputArray.slice 0 -### -# Previously Globally defined functions... -### - -# This seems to be failing for the window[func] approach :( -# for func in ['existsWithValue'] -# window[func] = -> -# console?.log? "Global Namespace for #{func} function is deprecated, please use Visualizer.Utils.#{func}" -# Visualizer.Utils[func].apply window, arguments - -window.waitForRepeatingEvents = () -> - console?.log? "Global Namespace for waitForRepeatingEvents function is deprecated, please use Visualizer.Utils.waitForRepeatingEvents" - Visualizer.Utils.waitForRepeatingEvents.apply window, arguments - -window.existsWithValue = () -> - console?.log? "Global Namespace for existsWithValue function is deprecated, please use Visualizer.Utils.existsWithValue" - Visualizer.Utils.existsWithValue.apply window, arguments - ### # FUN! ### diff --git a/src/vis_scene.js.coffee b/src/vis_scene.js.coffee index fe8d6b4..df3646f 100644 --- a/src/vis_scene.js.coffee +++ b/src/vis_scene.js.coffee @@ -49,8 +49,8 @@ description: null ###* - # drawWait is the debounce time waited before updating the scene. - # If a scene's reload is requested many times in rapid succession it will wait + # drawWait is the debounce time waited before running a single widget's update. + # If a widget's reload is requested many times in rapid succession it will wait # until drawWait milliseconds after the last call before executing the reload. # # @property drawWait @@ -60,6 +60,17 @@ ### drawWait: 100 + ###* + # fullRefreshWait is an additional debounce time waited before + # totally updating the scene. This adds some + # + # @property fullRefreshWait + # @type Integer (milliseconds) + # @default 20 + # @required + ### + fullRefreshWait: 20 + ###* # widgets references a collection of "widget" Objects, each of which # should reference a Module, a ModuleView, an operation to call upon the ModuleView, @@ -96,12 +107,13 @@ # In essence it ensures that any Views that are not currently in use are cleansed. # # @method clearUnusedViews - # @return {void} + # @chainable ### clearUnusedViews: -> for own moduleName, module of @get("visualizer.modules") for own viewName, view of module.get('moduleViews') view.clear?() unless @get("requestedModuleViews.#{moduleName}.#{viewName}") + @ ###* # runWidgets iterated this scene's widgets, and requests that the ModuleView specified @@ -111,12 +123,26 @@ # another ModuleView, a set of icons, to group themselves by common-words. # # @method runWidgets - # @return {void} + # @chainable ### runWidgets: (widgets = @get('widgets')) -> - for widget in widgets - moduleView = @get("visualizer.modules.#{widget.module}.moduleViews.#{widget.view}") - moduleView?.run(widget.operation, widget.params) + @_runWidget(widget) for widget in widgets + @ + + ###* + # _runWidget runs the current scene's operation for a single widget. + # Waits for repeating events to prevent multiple refreshes on the + # same dimensions/parameters. + # + # @method _runWidget + # @return {void} + # @private + ### + _runWidget: (widget={})-> + viewIdentifier = "visualizer.modules.#{widget.module}.moduleViews.#{widget.view}" + Visualizer.Utils.waitForRepeatingEvents (=> + @get(viewIdentifier)?.run(widget.operation, widget.params) + ), @get("drawWait"), "Scene Redraw for #{viewIdentifier}", @get('visualizer.timers') ###* # reload initiates the process of updating the visualization by cleaning out old Views @@ -132,4 +158,4 @@ Visualizer.Utils.waitForRepeatingEvents (=> @clearUnusedViews() @runWidgets() - ), @get("drawWait"), "Scene Reload", @get('visualizer.timers') + ), @get('fullRefreshWait'), "Full Scene Reload", @get('visualizer.timers') diff --git a/src/vis_world.js.coffee b/src/vis_world.js.coffee index b73d504..2b2fc1b 100644 --- a/src/vis_world.js.coffee +++ b/src/vis_world.js.coffee @@ -81,32 +81,6 @@ $world.off("click", ".phasedButton").on("click", ".phasedButton", _handlePhasedButtonClick) ).observes('worldObj').on('init') - ###* - # injectDefaultWorld clears out the Visualizer World's contents, injects the basic - # visualizer skeleton - # - # @deprecated @todo Deprecate this. ModuleViews should take care of this on a per-App basis... - # - # @method injectDefaultWorld - # @return {void} - ### - injectDefaultWorld: ()-> - @$().empty().append $(defaultWorldTemplate) - - ###* - # resizeSharedArea updates the height of the "shared area" DOM element - # within the Visualizer World. - # - # @deprecated @todo: remove this - this should be the work of ModuleViews... - # - # @method resizeSharedArea - # @return {void} - ### - resizeSharedArea: ( ()-> - @$("#shared-area").css('height', "#{@get('height')}px") - ).observes('height') - - ###* # _handlePhasedButtonClick is called when an element with class phasedButton # is clicked. Adds a class 'disabledItem' to the element for 2 seconds; @@ -123,13 +97,3 @@ _handlePhasedButtonClick = (e) -> return false Ember.run.next @, -> $(this).addExpiringClass "disabledItem", 2000 - -# Private: -# TODO: Emberize, make this a real template/view. -# Alternatively: REMOVE, allow each moduleView to ensure it's own parts exist -defaultWorldTemplate = " -
    -
    -
    -
    -"