From 6fe6f720dad7d6a3641b3fb2a36b89e62f82a357 Mon Sep 17 00:00:00 2001 From: vieron Date: Wed, 18 Jul 2012 19:08:36 +0200 Subject: [PATCH] documentation typos --- dist/jquery.gridster.js | 21 +- dist/jquery.gridster.min.js | 2 +- docs/classes/Gridster.html | 487 ++++++++++++------------- docs/data.json | 91 +++-- docs/files/src_jquery.gridster.js.html | 21 +- src/jquery.gridster.js | 21 +- 6 files changed, 298 insertions(+), 345 deletions(-) diff --git a/dist/jquery.gridster.js b/dist/jquery.gridster.js index 7f0b89e2e..35e25602d 100644 --- a/dist/jquery.gridster.js +++ b/dist/jquery.gridster.js @@ -509,7 +509,7 @@ /** * Creates the grid coords object representing the widget a add it to the mapped array of positions * - * @method serialize_changed + * @method register_widget * @return {Array} Returns the instance of the Gridster class. */ fn.register_widget = function($el) { @@ -1034,22 +1034,15 @@ }; - fn.is_placeholder_in_col = function(col, row) { - return $.inArray(col, this.cells_occupied_by_placeholder.cols) >= 0; - }; - - /** - * Determines if the placeholder is currently over the row and col given. + * Determines if the placeholder is currently over the column given. * - * @method is_placeholder_in + * @method is_placeholder_in_col * @param {Number} col The column to check. - * @param {Number} row The row to check. * @return {Boolean} Returns true or false. */ - fn.is_placeholder_in = function(col, row) { - var c = this.cells_occupied_by_placeholder || []; - return $.inArray(col, c.cols) >= 0 && $.inArray(row, c.rows) >= 0; + fn.is_placeholder_in_col = function(col) { + return $.inArray(col, this.cells_occupied_by_placeholder.cols) >= 0; }; @@ -1877,7 +1870,7 @@ * Iterate over the cells occupied by a widget executing a function for * each one. * - * @method for_each_column_occupied + * @method for_each_cell_occupied * @param {Object} el_grid_data The grid coords object that represents the * widget. * @param {Function} callback The function to execute on each column @@ -2103,7 +2096,7 @@ /** * Injects the given CSS as string to the head of the document. * - * @method generate_stylesheet + * @method add_style_tag * @param {String} css The styles to apply. * @return {Object} Returns the instance of the Gridster class. */ diff --git a/dist/jquery.gridster.min.js b/dist/jquery.gridster.min.js index cca6f9a70..4f40a35b8 100644 --- a/dist/jquery.gridster.min.js +++ b/dist/jquery.gridster.min.js @@ -1,4 +1,4 @@ /*! gridster.js - v0.1.0 - 2012-07-18 * https://github.com/ducksboard/gridster.js * Copyright (c) 2012 ducksboard; Licensed MIT, GPL */ -(function(a,b,c,d){function e(b){return b[0]&&a.isPlainObject(b[0])?this.data=b[0]:this.el=b,this.isCoords=!0,this.coords={},this.init(),this}var f=e.prototype;f.init=function(){this.set(),this.original_coords=this.get()},f.set=function(a){var b=this.el;b&&(this.data=b.offset(),this.data.width||(this.data.width=b.width()),this.data.height||(this.data.height=b.height()));var c=this.data;return this.coords.x1=c.left,this.coords.y1=c.top,this.coords.x2=c.left+c.width,this.coords.y2=c.top+c.height,this.coords.cx=c.left+c.width/2,this.coords.cy=c.top+c.height/2,this.coords.width=c.width,this.coords.height=c.height,this.coords.el=b||!1,this},f.update=function(b){if(!b&&!this.el)return this;if(b){var c=a.extend(this.data,b);this.data=c}return this.set(!0),this},f.get=function(){return this.coords},a.fn.coords=function(){if(this.data("coords"))return this.data("coords");var a=new e(this,arguments[0]);return this.data("coords",a),a}})(jQuery,window,document),function(a,b,c,d){function f(b,c,d){this.options=a.extend(e,d),this.$element=b,this.last_colliders=[],this.last_colliders_coords=[],typeof c=="string"||c instanceof jQuery?this.$colliders=a(c,this.options.colliders_context).not(this.$element):this.colliders=a(c),this.init()}var e={colliders_context:c.body,on_overlap:function(a){},on_overlap_start:function(a){},on_overlap_stop:function(a){}},g=f.prototype;g.init=function(){this.find_collisions()},g.overlaps=function(a,b){var c=!1,d=!1;if(b.x1>=a.x1&&b.x1<=a.x2||b.x2>=a.x1&&b.x2<=a.x2||a.x1>=b.x1&&a.x2<=b.x2)c=!0;if(b.y1>=a.y1&&b.y1<=a.y2||b.y2>=a.y1&&b.y2<=a.y2||a.y1>=b.y1&&a.y2<=b.y2)d=!0;return c&&d},g.detect_overlapping_region=function(a,b){var c="",d="";return a.y1>b.cy&&a.y1b.y1&&a.y2b.cx&&a.x1b.x1&&a.x2 li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,min_rows:10,autogenerate_stylesheet:!0,serialize_params:function(a,b){return{col:b.col,row:b.row}},collision:{on_overlap:function(a){}},draggable:{}},f=function(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,c||a.apply(e,f)};c&&!d&&a.apply(e,f),clearTimeout(d),d=setTimeout(g,b)}},g=function(a,b){var c,d,e,g,h,i,j=f(function(){h=g=!1},b,!0);return function(){c=this,d=arguments;var f=function(){e=null,h&&a.apply(c,d),j()};return e||(e=setTimeout(f,b)),g?h=!0:i=a.apply(c,d),j(),g=!0,i}},i=h.prototype;i.init=function(){this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.$wrapper.addClass("ready"),this.draggable()},i.add_widget=function(b,c,d){var e=a(b).attr({"data-col":this.highest_occupied_cell.col,"data-row":this.highest_occupied_cell.row+1,"data-sizex":c||1,"data-sizey":d||1}).addClass("gs_w").appendTo(this.$el).hide();this.$widgets=this.$widgets.add(e),this.register_widget(e),this.$widgets.draggable("destroy"),this.draggable(),this.set_dom_grid_height(),e.fadeIn()},i.remove_widget=function(b){var c=b instanceof jQuery?b:a(b),d=c.coords().grid;this.$widgets=this.$widgets.not(c);var e=this.widgets_below(c);this.remove_from_gridmap(d),c.fadeOut(a.proxy(function(){c.remove(),e.each(a.proxy(function(b,c){this.move_widget_up(a(c),d.size_y)},this))},this))},i.serialize=function(b){b||(b=this.$widgets);var c=[];return b.each(a.proxy(function(b,d){c.push(this.options.serialize_params(a(d),a(d).coords().grid))},this)),c},i.serialize_changed=function(){return this.serialize(this.$changed)},i.register_widget=function(a){var b={col:parseInt(a.attr("data-col"),10),row:parseInt(a.attr("data-row"),10),size_x:parseInt(a.attr("data-sizex"),10),size_y:parseInt(a.attr("data-sizey"),10),el:a};return a.data("coords",a.coords()),a.data("coords").grid=b,this.add_to_gridmap(b,a),this.widgets.push(a),this},i.update_widget_position=function(a,b){return this.for_each_cell_occupied(a,function(a,c){if(!this.gridmap[a])return this;this.gridmap[a][c]=b}),this},i.remove_from_gridmap=function(a){return this.update_widget_position(a,!1)},i.add_to_gridmap=function(b,c){this.update_widget_position(b,c||b.el);if(b.el){var d=this.widgets_below(b.el);d.each(a.proxy(function(b,c){this.move_widget_up(a(c))},this))}},i.draggable=function(){var b=this,c=a.extend(!0,{},this.options.draggable,{start:function(c,d){b.$player=a(this),b.on_start_drag.call(b,c,d)},stop:function(a,c){b.on_stop_drag.call(b,c)},drag:g(function(a,c){b.on_drag.call(b,a,c)},100,!0)});return this.$widgets.draggable(c),this},i.on_start_drag=function(b,c){this.$player.addClass("player"),this.$wrapper.addClass("dragging"),this.player_grid_data=this.$player.coords().grid,this.placeholder_grid_data=a.extend({},this.player_grid_data),this.$el.css("height",this.$el.height()+this.player_grid_data.size_y*this.min_widget_height);var d=this.faux_grid,e=this.$player.data("coords").coords;this.cells_occupied_by_player=this.get_cells_occupied(this.player_grid_data),this.cells_occupied_by_placeholder=this.get_cells_occupied(this.placeholder_grid_data),this.last_cols=[],this.last_rows=[],this.drag_api=this.$player.collision(d,this.options.collision),this.$preview_holder=a("
  • ",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:e.width,height:e.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,b,c)},i.on_drag=function(a,b){this.colliders_data=this.drag_api.get_closest_colliders(),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.options.draggable.drag&&this.options.draggable.drag.call(this,a,b)},i.on_stop_drag=function(a,b){this.colliders_data=this.drag_api.get_closest_colliders(),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}).removeClass("player"),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.$player=null,this.$preview_holder.remove(),this.set_dom_grid_height(),this.options.draggable.stop&&this.options.draggable.stop.call(this,a,b)},i.on_overlapped_column_change=function(b,c){if(!this.colliders_data.length)return;var d=this.get_targeted_columns(this.colliders_data[0].el.data.col),e=this.last_cols.length,f=d.length,g;for(g=0;gb.row?1:-1}),a},i.sort_by_row_desc=function(a){return a=a.sort(function(a,b){return a.row+a.size_y=0&&a.inArray(c,d.rows)>=0},i.is_placeholder_in=function(b,c){var d=this.cells_occupied_by_placeholder||[];return this.is_placeholder_in_col(b)&&a.inArray(c,d.rows)>=0},i.is_placeholder_in_col=function(b,c){return a.inArray(b,this.cells_occupied_by_placeholder.cols)>=0},i.is_placeholder_in=function(b,c){var d=this.cells_occupied_by_placeholder||[];return a.inArray(b,d.cols)>=0&&a.inArray(c,d.rows)>=0},i.is_empty=function(a,b){return typeof this.gridmap[a]!="undefined"&&typeof this.gridmap[a][b]!="undefined"&&this.gridmap[a][b]===!1?!0:!1},i.is_occupied=function(a,b){return this.gridmap[a]?this.gridmap[a][b]?!0:!1:!1},i.is_widget=function(a,b){var c=this.gridmap[a];return c?(c=c[b],c?c:!1):!1},i.is_widget_under_player=function(a,b){return this.is_widget(a,b)?this.is_player_in(a,b):!1},i.get_widgets_under_player=function(){var b=this.cells_occupied_by_player,c=a([]);return a.each(b.cols,a.proxy(function(d,e){a.each(b.rows,a.proxy(function(a,b){this.is_widget(e,b)&&(c=c.add(this.gridmap[e][b]))},this))},this)),c},i.set_placeholder=function(b,c){var d=a.extend({},this.placeholder_grid_data),e=this.widgets_below({col:d.col,row:d.row,size_y:d.size_y,size_x:d.size_x}),f=this.placeholder_grid_data.row0)if(this.is_empty(a,h)||this.is_player(a,h)||this.is_widget(a,h)&&g[h].is(f))d[a].push(h),e=h0){if(this.is_occupied(a,g)&&!this.is_player(a,g))break;!this.is_player(a,g)&&!this.is_placeholder_in(a,g)&&d[a].push(g),g=b?a[d[0]]:!1},i.get_widgets_overlapped=function(){var b,c=a([]),d=[],e=this.cells_occupied_by_player.rows.slice(0);return e.reverse(),a.each(this.cells_occupied_by_player.cols,a.proxy(function(b,f){a.each(e,a.proxy(function(b,e){if(!this.gridmap[f])return!0;var g=this.gridmap[f][e];this.is_occupied(f,e)&&!this.is_player(g)&&a.inArray(g,d)===-1&&(c=c.add(g),d.push(g))},this))},this)),c},i.on_start_overlapping_column=function(a){this.set_player(a,!1)},i.on_start_overlapping_row=function(a){this.set_player(!1,a)},i.on_stop_overlapping_column=function(a){this.set_player();var b=this;this.for_each_widget_below(a,this.cells_occupied_by_player.rows[0],function(a,c){b.move_widget_up(this,b.player_grid_data.size_y)})},i.on_stop_overlapping_row=function(a){this.set_player();var b=this,c=this.cells_occupied_by_player.cols;for(var d=0,e=c.length;d0&&this.move_widget_down(d,f)},this)),h.row=i,this.update_widget_position(h,b),b.attr("data-row",h.row),this.$changed=this.$changed.add(b),f.push(b)}},i.can_go_up_to_row=function(b,c,d){var e=this.gridmap,f=!0,g=[],h=b.row,i;this.for_each_column_occupied(b,function(a){var b=e[a];g[a]=[],i=h;while(i--)if(this.is_empty(a,i)&&!this.is_placeholder_in(a,i))g[a].push(i);else break;if(!g[a].length)return f=!1,!0});if(!f)return!1;i=d;for(i=1;i0?c:0},i.widgets_below=function(b){var c=a.isPlainObject(b)?b:b.coords().grid,d=this,e=this.gridmap,f=c.row+c.size_y-1,g=a([]);return this.for_each_column_occupied(c,function(b){d.for_each_widget_below(b,f,function(b,c){if(!d.is_player(this)&&a.inArray(this,g)===-1)return g=g.add(this),!0})}),this.sort_by_row_asc(g)},i.set_cells_player_occupies=function(a,b){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=a,this.placeholder_grid_data.row=b,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},i.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},i.can_go_up=function(a){var b=a.coords().grid,c=b.row,d=c-1,e=this.gridmap,f=[],g=!0;return c===1?!1:(this.for_each_column_occupied(b,function(a){if(this.is_occupied(a,d)||this.is_player(a,d)||this.is_placeholder_in(a,d))return g=!1,!0}),g)},i.can_move_to=function(a,b,c){var d=this.gridmap,e=a.el,f={size_y:a.size_y,size_x:a.size_x,col:b,row:c},g=this.get_cells_occupied(a),h=!0;return this.for_each_cell_occupied(f,function(a,b){var c=this.is_widget(a,b);c&&!c.is(e)&&(h=!1)}),h},i.get_targeted_columns=function(a){var b=(a||this.player_grid_data.col)+(this.player_grid_data.size_x-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},i.get_targeted_rows=function(a){var b=(a||this.player_grid_data.row)+(this.player_grid_data.size_y-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},i.get_cells_occupied=function(a){var b={cols:[],rows:[]},c;arguments[1]instanceof jQuery&&(a=arguments[1].coords().grid);for(c=0;c0&&this.is_widget(d,m)&&a.inArray(g[d][m],l)===-1){h=f.call(g[d][m],d,m),l.push(g[d][m]);if(h)break}},"for_each/below":function(){for(m=e+1,i=g[d].length;m=1;e--)for(a=b[e].length-1;a>=1;a--)if(this.is_widget(e,a)){c.push(a),d[a]=e;break}var f=Math.max.apply(null,c);return this.highest_occupied_cell={col:d[f],row:f},this.highest_occupied_cell},i.set_dom_grid_height=function(){var a=this.get_highest_occupied_cell().row;return this.$el.css("height",a*this.min_widget_height),this},i.generate_stylesheet=function(a,b){var c="",d=10,e=6,f=6,g,h;for(g=b+d;g>=0;g--)c+='[data-col="'+(g+1)+'"] { left: '+g*this.min_widget_width+"px;} ";for(g=a+d;g>=0;g--)c+='[data-row="'+(g+1)+'"] { top: '+g*this.min_widget_height+"px;} ";for(var i=1;i0;d--){this.gridmap[d]=[];for(e=b;e>0;e--){var f=a({left:this.baseX+(d-1)*this.min_widget_width,top:this.baseY+(e-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:d,row:e,original_col:d,original_row:e}).coords();this.gridmap[d][e]=!1,this.faux_grid.push(f)}}return this},i.get_widgets_from_DOM=function(){return this.$widgets.each(a.proxy(function(b,c){this.register_widget(a(c))},this)),this},i.generate_grid_and_stylesheet=function(){var c,d=this.$wrapper.width(),e=this.$wrapper.height(),f=Math.floor(d/this.min_widget_width)+this.options.extra_cols,g=Math.floor(e/this.min_widget_height)+this.options.extra_rows,h=this.$widgets.map(function(){return a(this).attr("data-col")}),i=this.$widgets.map(function(){return a(this).attr("data-row")}),j=Math.max.apply(null,h),k=Math.max.apply(null,i);return f=Math.max(j,f,this.options.min_cols),g=Math.max(k,g,this.options.min_rows),c=f*(this.options.widget_base_dimensions[0]+this.options.widget_margins[0]*2),this.support_grid_width=this.wrapper_width,this.support_grid_height=g*this.min_widget_height,this.baseX=(a(b).width()-this.support_grid_width)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(g,f),this.generate_faux_grid(g,f)},a.fn.gridster=function(b){return this.each(function(){a(this).data("gridster")||a(this).data("gridster",new h(this,b))})}}(jQuery,window,document); \ No newline at end of file +(function(a,b,c,d){function e(b){return b[0]&&a.isPlainObject(b[0])?this.data=b[0]:this.el=b,this.isCoords=!0,this.coords={},this.init(),this}var f=e.prototype;f.init=function(){this.set(),this.original_coords=this.get()},f.set=function(a){var b=this.el;b&&(this.data=b.offset(),this.data.width||(this.data.width=b.width()),this.data.height||(this.data.height=b.height()));var c=this.data;return this.coords.x1=c.left,this.coords.y1=c.top,this.coords.x2=c.left+c.width,this.coords.y2=c.top+c.height,this.coords.cx=c.left+c.width/2,this.coords.cy=c.top+c.height/2,this.coords.width=c.width,this.coords.height=c.height,this.coords.el=b||!1,this},f.update=function(b){if(!b&&!this.el)return this;if(b){var c=a.extend(this.data,b);this.data=c}return this.set(!0),this},f.get=function(){return this.coords},a.fn.coords=function(){if(this.data("coords"))return this.data("coords");var a=new e(this,arguments[0]);return this.data("coords",a),a}})(jQuery,window,document),function(a,b,c,d){function f(b,c,d){this.options=a.extend(e,d),this.$element=b,this.last_colliders=[],this.last_colliders_coords=[],typeof c=="string"||c instanceof jQuery?this.$colliders=a(c,this.options.colliders_context).not(this.$element):this.colliders=a(c),this.init()}var e={colliders_context:c.body,on_overlap:function(a){},on_overlap_start:function(a){},on_overlap_stop:function(a){}},g=f.prototype;g.init=function(){this.find_collisions()},g.overlaps=function(a,b){var c=!1,d=!1;if(b.x1>=a.x1&&b.x1<=a.x2||b.x2>=a.x1&&b.x2<=a.x2||a.x1>=b.x1&&a.x2<=b.x2)c=!0;if(b.y1>=a.y1&&b.y1<=a.y2||b.y2>=a.y1&&b.y2<=a.y2||a.y1>=b.y1&&a.y2<=b.y2)d=!0;return c&&d},g.detect_overlapping_region=function(a,b){var c="",d="";return a.y1>b.cy&&a.y1b.y1&&a.y2b.cx&&a.x1b.x1&&a.x2 li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,min_rows:10,autogenerate_stylesheet:!0,serialize_params:function(a,b){return{col:b.col,row:b.row}},collision:{on_overlap:function(a){}},draggable:{}},f=function(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,c||a.apply(e,f)};c&&!d&&a.apply(e,f),clearTimeout(d),d=setTimeout(g,b)}},g=function(a,b){var c,d,e,g,h,i,j=f(function(){h=g=!1},b,!0);return function(){c=this,d=arguments;var f=function(){e=null,h&&a.apply(c,d),j()};return e||(e=setTimeout(f,b)),g?h=!0:i=a.apply(c,d),j(),g=!0,i}},i=h.prototype;i.init=function(){this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.$wrapper.addClass("ready"),this.draggable()},i.add_widget=function(b,c,d){var e=a(b).attr({"data-col":this.highest_occupied_cell.col,"data-row":this.highest_occupied_cell.row+1,"data-sizex":c||1,"data-sizey":d||1}).addClass("gs_w").appendTo(this.$el).hide();this.$widgets=this.$widgets.add(e),this.register_widget(e),this.$widgets.draggable("destroy"),this.draggable(),this.set_dom_grid_height(),e.fadeIn()},i.remove_widget=function(b){var c=b instanceof jQuery?b:a(b),d=c.coords().grid;this.$widgets=this.$widgets.not(c);var e=this.widgets_below(c);this.remove_from_gridmap(d),c.fadeOut(a.proxy(function(){c.remove(),e.each(a.proxy(function(b,c){this.move_widget_up(a(c),d.size_y)},this))},this))},i.serialize=function(b){b||(b=this.$widgets);var c=[];return b.each(a.proxy(function(b,d){c.push(this.options.serialize_params(a(d),a(d).coords().grid))},this)),c},i.serialize_changed=function(){return this.serialize(this.$changed)},i.register_widget=function(a){var b={col:parseInt(a.attr("data-col"),10),row:parseInt(a.attr("data-row"),10),size_x:parseInt(a.attr("data-sizex"),10),size_y:parseInt(a.attr("data-sizey"),10),el:a};return a.data("coords",a.coords()),a.data("coords").grid=b,this.add_to_gridmap(b,a),this.widgets.push(a),this},i.update_widget_position=function(a,b){return this.for_each_cell_occupied(a,function(a,c){if(!this.gridmap[a])return this;this.gridmap[a][c]=b}),this},i.remove_from_gridmap=function(a){return this.update_widget_position(a,!1)},i.add_to_gridmap=function(b,c){this.update_widget_position(b,c||b.el);if(b.el){var d=this.widgets_below(b.el);d.each(a.proxy(function(b,c){this.move_widget_up(a(c))},this))}},i.draggable=function(){var b=this,c=a.extend(!0,{},this.options.draggable,{start:function(c,d){b.$player=a(this),b.on_start_drag.call(b,c,d)},stop:function(a,c){b.on_stop_drag.call(b,c)},drag:g(function(a,c){b.on_drag.call(b,a,c)},100,!0)});return this.$widgets.draggable(c),this},i.on_start_drag=function(b,c){this.$player.addClass("player"),this.$wrapper.addClass("dragging"),this.player_grid_data=this.$player.coords().grid,this.placeholder_grid_data=a.extend({},this.player_grid_data),this.$el.css("height",this.$el.height()+this.player_grid_data.size_y*this.min_widget_height);var d=this.faux_grid,e=this.$player.data("coords").coords;this.cells_occupied_by_player=this.get_cells_occupied(this.player_grid_data),this.cells_occupied_by_placeholder=this.get_cells_occupied(this.placeholder_grid_data),this.last_cols=[],this.last_rows=[],this.drag_api=this.$player.collision(d,this.options.collision),this.$preview_holder=a("
  • ",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:e.width,height:e.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,b,c)},i.on_drag=function(a,b){this.colliders_data=this.drag_api.get_closest_colliders(),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.options.draggable.drag&&this.options.draggable.drag.call(this,a,b)},i.on_stop_drag=function(a,b){this.colliders_data=this.drag_api.get_closest_colliders(),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}).removeClass("player"),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.$player=null,this.$preview_holder.remove(),this.set_dom_grid_height(),this.options.draggable.stop&&this.options.draggable.stop.call(this,a,b)},i.on_overlapped_column_change=function(b,c){if(!this.colliders_data.length)return;var d=this.get_targeted_columns(this.colliders_data[0].el.data.col),e=this.last_cols.length,f=d.length,g;for(g=0;gb.row?1:-1}),a},i.sort_by_row_desc=function(a){return a=a.sort(function(a,b){return a.row+a.size_y=0&&a.inArray(c,d.rows)>=0},i.is_placeholder_in=function(b,c){var d=this.cells_occupied_by_placeholder||[];return this.is_placeholder_in_col(b)&&a.inArray(c,d.rows)>=0},i.is_placeholder_in_col=function(b){return a.inArray(b,this.cells_occupied_by_placeholder.cols)>=0},i.is_empty=function(a,b){return typeof this.gridmap[a]!="undefined"&&typeof this.gridmap[a][b]!="undefined"&&this.gridmap[a][b]===!1?!0:!1},i.is_occupied=function(a,b){return this.gridmap[a]?this.gridmap[a][b]?!0:!1:!1},i.is_widget=function(a,b){var c=this.gridmap[a];return c?(c=c[b],c?c:!1):!1},i.is_widget_under_player=function(a,b){return this.is_widget(a,b)?this.is_player_in(a,b):!1},i.get_widgets_under_player=function(){var b=this.cells_occupied_by_player,c=a([]);return a.each(b.cols,a.proxy(function(d,e){a.each(b.rows,a.proxy(function(a,b){this.is_widget(e,b)&&(c=c.add(this.gridmap[e][b]))},this))},this)),c},i.set_placeholder=function(b,c){var d=a.extend({},this.placeholder_grid_data),e=this.widgets_below({col:d.col,row:d.row,size_y:d.size_y,size_x:d.size_x}),f=this.placeholder_grid_data.row0)if(this.is_empty(a,h)||this.is_player(a,h)||this.is_widget(a,h)&&g[h].is(f))d[a].push(h),e=h0){if(this.is_occupied(a,g)&&!this.is_player(a,g))break;!this.is_player(a,g)&&!this.is_placeholder_in(a,g)&&d[a].push(g),g=b?a[d[0]]:!1},i.get_widgets_overlapped=function(){var b,c=a([]),d=[],e=this.cells_occupied_by_player.rows.slice(0);return e.reverse(),a.each(this.cells_occupied_by_player.cols,a.proxy(function(b,f){a.each(e,a.proxy(function(b,e){if(!this.gridmap[f])return!0;var g=this.gridmap[f][e];this.is_occupied(f,e)&&!this.is_player(g)&&a.inArray(g,d)===-1&&(c=c.add(g),d.push(g))},this))},this)),c},i.on_start_overlapping_column=function(a){this.set_player(a,!1)},i.on_start_overlapping_row=function(a){this.set_player(!1,a)},i.on_stop_overlapping_column=function(a){this.set_player();var b=this;this.for_each_widget_below(a,this.cells_occupied_by_player.rows[0],function(a,c){b.move_widget_up(this,b.player_grid_data.size_y)})},i.on_stop_overlapping_row=function(a){this.set_player();var b=this,c=this.cells_occupied_by_player.cols;for(var d=0,e=c.length;d0&&this.move_widget_down(d,f)},this)),h.row=i,this.update_widget_position(h,b),b.attr("data-row",h.row),this.$changed=this.$changed.add(b),f.push(b)}},i.can_go_up_to_row=function(b,c,d){var e=this.gridmap,f=!0,g=[],h=b.row,i;this.for_each_column_occupied(b,function(a){var b=e[a];g[a]=[],i=h;while(i--)if(this.is_empty(a,i)&&!this.is_placeholder_in(a,i))g[a].push(i);else break;if(!g[a].length)return f=!1,!0});if(!f)return!1;i=d;for(i=1;i0?c:0},i.widgets_below=function(b){var c=a.isPlainObject(b)?b:b.coords().grid,d=this,e=this.gridmap,f=c.row+c.size_y-1,g=a([]);return this.for_each_column_occupied(c,function(b){d.for_each_widget_below(b,f,function(b,c){if(!d.is_player(this)&&a.inArray(this,g)===-1)return g=g.add(this),!0})}),this.sort_by_row_asc(g)},i.set_cells_player_occupies=function(a,b){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=a,this.placeholder_grid_data.row=b,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},i.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},i.can_go_up=function(a){var b=a.coords().grid,c=b.row,d=c-1,e=this.gridmap,f=[],g=!0;return c===1?!1:(this.for_each_column_occupied(b,function(a){if(this.is_occupied(a,d)||this.is_player(a,d)||this.is_placeholder_in(a,d))return g=!1,!0}),g)},i.can_move_to=function(a,b,c){var d=this.gridmap,e=a.el,f={size_y:a.size_y,size_x:a.size_x,col:b,row:c},g=this.get_cells_occupied(a),h=!0;return this.for_each_cell_occupied(f,function(a,b){var c=this.is_widget(a,b);c&&!c.is(e)&&(h=!1)}),h},i.get_targeted_columns=function(a){var b=(a||this.player_grid_data.col)+(this.player_grid_data.size_x-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},i.get_targeted_rows=function(a){var b=(a||this.player_grid_data.row)+(this.player_grid_data.size_y-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},i.get_cells_occupied=function(a){var b={cols:[],rows:[]},c;arguments[1]instanceof jQuery&&(a=arguments[1].coords().grid);for(c=0;c0&&this.is_widget(d,m)&&a.inArray(g[d][m],l)===-1){h=f.call(g[d][m],d,m),l.push(g[d][m]);if(h)break}},"for_each/below":function(){for(m=e+1,i=g[d].length;m=1;e--)for(a=b[e].length-1;a>=1;a--)if(this.is_widget(e,a)){c.push(a),d[a]=e;break}var f=Math.max.apply(null,c);return this.highest_occupied_cell={col:d[f],row:f},this.highest_occupied_cell},i.set_dom_grid_height=function(){var a=this.get_highest_occupied_cell().row;return this.$el.css("height",a*this.min_widget_height),this},i.generate_stylesheet=function(a,b){var c="",d=10,e=6,f=6,g,h;for(g=b+d;g>=0;g--)c+='[data-col="'+(g+1)+'"] { left: '+g*this.min_widget_width+"px;} ";for(g=a+d;g>=0;g--)c+='[data-row="'+(g+1)+'"] { top: '+g*this.min_widget_height+"px;} ";for(var i=1;i0;d--){this.gridmap[d]=[];for(e=b;e>0;e--){var f=a({left:this.baseX+(d-1)*this.min_widget_width,top:this.baseY+(e-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:d,row:e,original_col:d,original_row:e}).coords();this.gridmap[d][e]=!1,this.faux_grid.push(f)}}return this},i.get_widgets_from_DOM=function(){return this.$widgets.each(a.proxy(function(b,c){this.register_widget(a(c))},this)),this},i.generate_grid_and_stylesheet=function(){var c,d=this.$wrapper.width(),e=this.$wrapper.height(),f=Math.floor(d/this.min_widget_width)+this.options.extra_cols,g=Math.floor(e/this.min_widget_height)+this.options.extra_rows,h=this.$widgets.map(function(){return a(this).attr("data-col")}),i=this.$widgets.map(function(){return a(this).attr("data-row")}),j=Math.max.apply(null,h),k=Math.max.apply(null,i);return f=Math.max(j,f,this.options.min_cols),g=Math.max(k,g,this.options.min_rows),c=f*(this.options.widget_base_dimensions[0]+this.options.widget_margins[0]*2),this.support_grid_width=this.wrapper_width,this.support_grid_height=g*this.min_widget_height,this.baseX=(a(b).width()-this.support_grid_width)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(g,f),this.generate_faux_grid(g,f)},a.fn.gridster=function(b){return this.each(function(){a(this).data("gridster")||a(this).data("gridster",new h(this,b))})}}(jQuery,window,document); \ No newline at end of file diff --git a/docs/classes/Gridster.html b/docs/classes/Gridster.html index 78212e2f1..3080b167b 100644 --- a/docs/classes/Gridster.html +++ b/docs/classes/Gridster.html @@ -436,6 +436,13 @@ ) @@ -4077,7 +4071,7 @@ theupperrowsarray. Iteration starts from row specified insrc/jquery.gridster.js:764 + src/jquery.gridster.js:759

    @@ -4088,7 +4082,7 @@ theupperrowsarray. Iteration starts from row specified in
    -

    Determines if the placeholder is currently over the row and col given.

    +

    Determines if the placeholder is currently over the column given.

    @@ -4112,21 +4106,6 @@ theupperrowsarray. Iteration starts from row specified in -
  • - - row - Number - - - - -
    -

    The row to check.

    -
    - - -
  • - @@ -4456,7 +4435,7 @@ and col given.

    - src/jquery.gridster.js:817 + src/jquery.gridster.js:810

    @@ -4582,7 +4561,7 @@ else returns the jQuery HTMLElement - src/jquery.gridster.js:842 + src/jquery.gridster.js:835

    @@ -4855,7 +4834,7 @@ params and if this is under the widget that is being dragged.

    - src/jquery.gridster.js:1283 + src/jquery.gridster.js:1276

    @@ -4974,7 +4953,7 @@ params and if this is under the widget that is being dragged.

    - src/jquery.gridster.js:1194 + src/jquery.gridster.js:1187

    @@ -5086,7 +5065,7 @@ if they can.

    - src/jquery.gridster.js:1237 + src/jquery.gridster.js:1230

    @@ -5680,7 +5659,7 @@ overlapped or stops being overlapped.

    - src/jquery.gridster.js:1132 + src/jquery.gridster.js:1125

    @@ -5784,7 +5763,7 @@ overlapped or stops being overlapped.

    - src/jquery.gridster.js:1144 + src/jquery.gridster.js:1137

    @@ -5997,7 +5976,7 @@ overlapped or stops being overlapped.

    - src/jquery.gridster.js:1156 + src/jquery.gridster.js:1149

    @@ -6101,7 +6080,7 @@ overlapped or stops being overlapped.

    - src/jquery.gridster.js:1174 + src/jquery.gridster.js:1167

    @@ -6156,6 +6135,77 @@ overlapped or stops being overlapped.

    + + + +
    +

    register_widget

    + + + () + + + + + Array + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:231 + +

    + + + + + +
    + +
    +

    Creates the grid coords object representing the widget a add it to the mapped array of positions

    +
    + + + + +
    +

    Returns:

    + +
    + + + Array: + + Returns the instance of the Gridster class. + +
    +
    + + +
    @@ -6501,77 +6551,6 @@ overlapped or stops being overlapped.

    -
    - - - -

    - - Defined in - - - - - src/jquery.gridster.js:231 - -

    - - - - - -
    - -
    -

    Creates the grid coords object representing the widget a add it to the mapped array of positions

    -
    - - - - -
    -

    Returns:

    - -
    - - - Array: - - Returns the instance of the Gridster class. - -
    -
    - - - - - - -
    -

    serialize_changed

    - - - () - - - - - Array - - - - - - - - - - - - - - -
    @@ -6671,7 +6650,7 @@ overlapped or stops being overlapped.

    - src/jquery.gridster.js:1446 + src/jquery.gridster.js:1439

    @@ -6780,7 +6759,7 @@ overlapped or stops being overlapped.

    - src/jquery.gridster.js:1768 + src/jquery.gridster.js:1761

    @@ -6867,7 +6846,7 @@ overlapped or stops being overlapped.

    - src/jquery.gridster.js:881 + src/jquery.gridster.js:874

    @@ -7452,7 +7431,7 @@ the grid coords object passed in the grid_data param.

    - src/jquery.gridster.js:1417 + src/jquery.gridster.js:1410

    diff --git a/docs/data.json b/docs/data.json index 6bcd647a7..34457ba77 100644 --- a/docs/data.json +++ b/docs/data.json @@ -298,7 +298,7 @@ "line": 231, "description": "Creates the grid coords object representing the widget a add it to the mapped array of positions", "itemtype": "method", - "name": "serialize_changed", + "name": "register_widget", "return": { "description": "Returns the instance of the Gridster class.", "type": "Array" @@ -677,20 +677,15 @@ }, { "file": "src/jquery.gridster.js", - "line": 764, - "description": "Determines if the placeholder is currently over the row and col given.", + "line": 759, + "description": "Determines if the placeholder is currently over the column given.", "itemtype": "method", - "name": "is_placeholder_in", + "name": "is_placeholder_in_col", "params": [ { "name": "col", "description": "The column to check.", "type": "Number" - }, - { - "name": "row", - "description": "The row to check.", - "type": "Number" } ], "return": { @@ -701,7 +696,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 778, + "line": 771, "description": "Determines if the cell represented by col and row params is empty.", "itemtype": "method", "name": "is_empty", @@ -725,7 +720,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 797, + "line": 790, "description": "Determines if the cell represented by col and row params is occupied.", "itemtype": "method", "name": "is_occupied", @@ -749,7 +744,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 817, + "line": 810, "description": "Determines if there is a widget in the cell represented by col/row params.", "itemtype": "method", "name": "is_widget", @@ -773,7 +768,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 842, + "line": 835, "description": "Determines if there is a widget in the cell represented by col/row\nparams and if this is under the widget that is being dragged.", "itemtype": "method", "name": "is_widget_under_player", @@ -797,7 +792,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 859, + "line": 852, "description": "Get widgets overlapping with the player.", "itemtype": "method", "name": "get_widgets_under_player", @@ -809,7 +804,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 881, + "line": 874, "description": "Put placeholder at the row and column specified.", "itemtype": "method", "name": "set_placeholder", @@ -833,7 +828,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 922, + "line": 915, "description": "Determines whether the player can move to a position above.", "itemtype": "method", "name": "can_go_player_up", @@ -852,7 +847,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 970, + "line": 963, "description": "Determines whether a widget can move to a position above.", "itemtype": "method", "name": "can_go_widget_up", @@ -871,7 +866,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1021, + "line": 1014, "description": "Search a valid row for the widget represented by `widget_grid_data' in\nthe `upper_rows` array. Iteration starts from row specified in `min_row`.", "itemtype": "method", "name": "get_valid_rows", @@ -900,7 +895,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1099, + "line": 1092, "description": "Get widgets overlapping with the player.", "itemtype": "method", "name": "get_widgets_overlapped", @@ -912,7 +907,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1132, + "line": 1125, "description": "This callback is executed when the player begins to collide with a column.", "itemtype": "method", "name": "on_start_overlapping_column", @@ -931,7 +926,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1144, + "line": 1137, "description": "A callback executed when the player begins to collide with a row.", "itemtype": "method", "name": "on_start_overlapping_row", @@ -950,7 +945,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1156, + "line": 1149, "description": "A callback executed when the the player ends to collide with a column.", "itemtype": "method", "name": "on_stop_overlapping_column", @@ -969,7 +964,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1174, + "line": 1167, "description": "This callback is executed when the player ends to collide with a row.", "itemtype": "method", "name": "on_stop_overlapping_row", @@ -988,7 +983,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1194, + "line": 1187, "description": "Move a widget to a specific row. The cell or cells must be empty.\nIf the widget has widgets below, all of these widgets will be moved also\nif they can.", "itemtype": "method", "name": "move_widget_to", @@ -1007,7 +1002,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1237, + "line": 1230, "description": "Move up the specified widget and all below it.", "itemtype": "method", "name": "move_widget_up", @@ -1032,7 +1027,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1283, + "line": 1276, "description": "Move down the specified widget and all below it.", "itemtype": "method", "name": "move_widget_down", @@ -1056,7 +1051,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1328, + "line": 1321, "description": "Check if the widget can move to the specified row, else returns the\nupper row possible.", "itemtype": "method", "name": "can_go_up_to_row", @@ -1085,7 +1080,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1417, + "line": 1410, "description": "Get widgets below a widget.", "itemtype": "method", "name": "widgets_below", @@ -1104,7 +1099,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1446, + "line": 1439, "description": "Update the array of mapped positions with the new player position.", "itemtype": "method", "name": "set_cells_player_occupies", @@ -1128,7 +1123,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1463, + "line": 1456, "description": "Remove from the array of mapped positions the reference to the player.", "itemtype": "method", "name": "empty_cells_player_occupies", @@ -1140,7 +1135,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1500, + "line": 1493, "description": "Check if it's possible to move a widget to a specific col/row. It takes\ninto account the dimensions (`size_y` and `size_x` attrs. of the grid coords\n object) the widget occupies.", "itemtype": "method", "name": "can_move_to", @@ -1169,7 +1164,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1535, + "line": 1528, "description": "Given the leftmost column returns all columns that are overlapping with the player.", "itemtype": "method", "name": "get_targeted_columns", @@ -1189,7 +1184,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1553, + "line": 1546, "description": "Given the upper row returns all rows that are overlapping with the player.", "itemtype": "method", "name": "get_targeted_rows", @@ -1209,7 +1204,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1570, + "line": 1563, "description": "Get all columns and rows that a widget occupies.", "itemtype": "method", "name": "get_cells_occupied", @@ -1228,10 +1223,10 @@ }, { "file": "src/jquery.gridster.js", - "line": 1598, + "line": 1591, "description": "Iterate over the cells occupied by a widget executing a function for\neach one.", "itemtype": "method", - "name": "for_each_column_occupied", + "name": "for_each_cell_occupied", "params": [ { "name": "el_grid_data", @@ -1252,7 +1247,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1619, + "line": 1612, "description": "Iterate over the columns occupied by a widget executing a function for\neach one.", "itemtype": "method", "name": "for_each_column_occupied", @@ -1276,7 +1271,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1638, + "line": 1631, "description": "Iterate over the rows occupied by a widget executing a function for\neach one.", "itemtype": "method", "name": "for_each_row_occupied", @@ -1300,7 +1295,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1704, + "line": 1697, "description": "Iterate over each widget above the column and row specified.", "itemtype": "method", "name": "for_each_widget_above", @@ -1329,7 +1324,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1720, + "line": 1713, "description": "Iterate over each widget below the column and row specified.", "itemtype": "method", "name": "for_each_widget_below", @@ -1358,7 +1353,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1736, + "line": 1729, "description": "Returns the highest occupied cell in the grid.", "itemtype": "method", "name": "get_highest_occupied_cell", @@ -1370,7 +1365,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1768, + "line": 1761, "description": "Set the current height of the parent grid.", "itemtype": "method", "name": "set_dom_grid_height", @@ -1382,7 +1377,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1781, + "line": 1774, "description": "It generates the neccessary styles to position the widgets.", "itemtype": "method", "name": "generate_stylesheet", @@ -1406,10 +1401,10 @@ }, { "file": "src/jquery.gridster.js", - "line": 1825, + "line": 1818, "description": "Injects the given CSS as string to the head of the document.", "itemtype": "method", - "name": "generate_stylesheet", + "name": "add_style_tag", "params": [ { "name": "css", @@ -1425,7 +1420,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1848, + "line": 1841, "description": "Generates a faux grid to collide with it when a widget is dragged and\ndetect row or column that we want to go.", "itemtype": "method", "name": "generate_faux_grid", @@ -1449,7 +1444,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1884, + "line": 1877, "description": "Get all widgets in the DOM and register them.", "itemtype": "method", "name": "get_widgets_from_DOM", @@ -1461,7 +1456,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1898, + "line": 1891, "description": "Calculate columns and rows to be set based on the configuration\n parameters, grid dimensions, etc ...", "itemtype": "method", "name": "generate_grid_and_stylesheet", diff --git a/docs/files/src_jquery.gridster.js.html b/docs/files/src_jquery.gridster.js.html index 14814b862..ffaf88dc3 100644 --- a/docs/files/src_jquery.gridster.js.html +++ b/docs/files/src_jquery.gridster.js.html @@ -324,7 +324,7 @@ /** * Creates the grid coords object representing the widget a add it to the mapped array of positions * - * @method serialize_changed + * @method register_widget * @return {Array} Returns the instance of the Gridster class. */ fn.register_widget = function($el) { @@ -849,22 +849,15 @@ }; - fn.is_placeholder_in_col = function(col, row) { - return $.inArray(col, this.cells_occupied_by_placeholder.cols) >= 0; - }; - - /** - * Determines if the placeholder is currently over the row and col given. + * Determines if the placeholder is currently over the column given. * - * @method is_placeholder_in + * @method is_placeholder_in_col * @param {Number} col The column to check. - * @param {Number} row The row to check. * @return {Boolean} Returns true or false. */ - fn.is_placeholder_in = function(col, row) { - var c = this.cells_occupied_by_placeholder || []; - return $.inArray(col, c.cols) >= 0 && $.inArray(row, c.rows) >= 0; + fn.is_placeholder_in_col = function(col) { + return $.inArray(col, this.cells_occupied_by_placeholder.cols) >= 0; }; @@ -1692,7 +1685,7 @@ * Iterate over the cells occupied by a widget executing a function for * each one. * - * @method for_each_column_occupied + * @method for_each_cell_occupied * @param {Object} el_grid_data The grid coords object that represents the * widget. * @param {Function} callback The function to execute on each column @@ -1918,7 +1911,7 @@ /** * Injects the given CSS as string to the head of the document. * - * @method generate_stylesheet + * @method add_style_tag * @param {String} css The styles to apply. * @return {Object} Returns the instance of the Gridster class. */ diff --git a/src/jquery.gridster.js b/src/jquery.gridster.js index 0b10a28c4..f541c7e2e 100644 --- a/src/jquery.gridster.js +++ b/src/jquery.gridster.js @@ -231,7 +231,7 @@ /** * Creates the grid coords object representing the widget a add it to the mapped array of positions * - * @method serialize_changed + * @method register_widget * @return {Array} Returns the instance of the Gridster class. */ fn.register_widget = function($el) { @@ -756,22 +756,15 @@ }; - fn.is_placeholder_in_col = function(col, row) { - return $.inArray(col, this.cells_occupied_by_placeholder.cols) >= 0; - }; - - /** - * Determines if the placeholder is currently over the row and col given. + * Determines if the placeholder is currently over the column given. * - * @method is_placeholder_in + * @method is_placeholder_in_col * @param {Number} col The column to check. - * @param {Number} row The row to check. * @return {Boolean} Returns true or false. */ - fn.is_placeholder_in = function(col, row) { - var c = this.cells_occupied_by_placeholder || []; - return $.inArray(col, c.cols) >= 0 && $.inArray(row, c.rows) >= 0; + fn.is_placeholder_in_col = function(col) { + return $.inArray(col, this.cells_occupied_by_placeholder.cols) >= 0; }; @@ -1599,7 +1592,7 @@ * Iterate over the cells occupied by a widget executing a function for * each one. * - * @method for_each_column_occupied + * @method for_each_cell_occupied * @param {Object} el_grid_data The grid coords object that represents the * widget. * @param {Function} callback The function to execute on each column @@ -1825,7 +1818,7 @@ /** * Injects the given CSS as string to the head of the document. * - * @method generate_stylesheet + * @method add_style_tag * @param {String} css The styles to apply. * @return {Object} Returns the instance of the Gridster class. */