Commit Graph
113 Commits
Author SHA1 Message Date
activeworxandvieron d4ec7140f7 feat(resize): Add start/stop/resize callbacks 2013-10-28 23:52:17 +01:00
vieron e19240532d feat(gridster): drag-and-drop widget resizing 2013-10-26 19:52:10 +02:00
vieron 8e58cf8a44 style: some whitespaces, line-breaks... 2013-10-26 19:52:10 +02:00
vieron d0ca62826a chore(draggable): jQuery adapter returns Draggable instance
Draggable instance instead of a jQuery collection.
Why? Becomes a mess if Draggable is instantiated multiple times from
the same HTML element.

BREAKING CHANGES: If you was accessing to Draggable instances through
.data('drag') you should remove the `data` getter. Since now the instance
is returned directly.
2013-10-26 19:52:10 +02:00
vieron 4d9b2a84f1 feat(draggable): new config option to move or not the dragged element 2013-10-26 19:52:10 +02:00
vieron 0f95624925 feat(draggable): CSS selectors support in ignore_dragging config opt 2013-10-26 19:52:10 +02:00
vieron 055cc0e4f6 feat(draggable): pass previous position to the drag callback 2013-10-26 19:52:10 +02:00
vieron 91ca65721c feat(draggable): Don't start new drag if previous one hasn't stopped
Moving 4e6159fb by @atesgoral into draggable.js
2013-10-26 19:52:10 +02:00
vieron 4b1b2b7259 chore(draggable): add default helper config option for clarify 2013-10-26 19:49:31 +02:00
vieron c1668d9ab6 chore(css naming): gs_w to gs-w following CSS naming conventions
BREAKING CHANGE: If you are using `gs_w` classes somewhere, replace
them with `gs-w`
2013-10-26 19:49:31 +02:00
vieron 8dda2410f3 feat(draggable): pass useful data to all drag callbacks
start/stop/drag callbacks receive: element offset, cursor position,
and references to $player and $helper elements.
2013-10-26 19:49:31 +02:00
vieron faa6c5db00 feat(utils): add delay helper to utils 2013-10-26 19:49:31 +02:00
vieron 21fcad9a28 style(generated-css): add line breaks in css declarations 2013-10-26 19:49:31 +02:00
vieron ae02b32b92 fix: fixes and improvements in widget-resizing. Closes #32 2013-10-26 19:49:31 +02:00
Ates Goralandvieron 1ade74e239 fix(gridster): the preview holder should not always use li
Use the same element as the original widget for the preview holder.
Using a <li> can cause a list item bullet to be displayed when widgets
are not necessarily <li> elements.
2013-10-26 19:49:30 +02:00
bastianonmandvieron 31fd8d6ba8 fix(gridster): overlapping widget problem 2013-10-26 19:49:28 +02:00
Ates Goralandvieron 1b13617df2 fix(gridster): Orphan preview holder when dragging is interrupted
After beginning a drag, if the mouse button is released outside of the
screen, and if a subsequent drag operation is begun on another widget
(while the previous widget still follows the mouse around), Draggable
will trigger a new drag start event, causing Gridster to leave the
current widget + its preview holder aside and start dragging the new
widget. This will lead to an orphan preview holder to be left on the
screen.

A quick solution is to ignore drag start without receiving a drag stop.
2013-10-26 17:43:54 +02:00
Michal Stefanowandvieron 5bfbc5c0b5 fix(gridster): remove_widget Returns the instance of the Gridster Class
Following same pattern as remove_all_widgets --> remove_widget also
return *this* (as per inlined comment documentation)
2013-10-26 17:43:54 +02:00
vieron c0c12d0c38 gridster/fix: calculating container_width correctly
Thanks @badtant for the notice (https://github.com/ducksboard/gridster.js/commit/3d755fd793e7e74cbdc56d9a86143f4ebf779a98#commitcomment-3423763)
2013-06-14 12:03:06 +02:00
vieron f749c13e4a updated dist 2013-06-13 15:36:40 +02:00
vieron 0a3315d3cb max_cols: to disable max_col option set to null instead of '-1'.
Default is null.
2013-06-13 15:22:27 +02:00
vieron b4ac8dc0bd drag/touch: don't prevent default when start dragging in touch device 2013-06-13 12:14:06 +02:00
vieron e1a5b4ed52 gridster/fix: using comparators in sort methods.
Sort method by default orders alphabetically, but we are sorting numbers
and this means that: 40 < 6. And we not expect this result.
2013-06-13 12:01:47 +02:00
vieron 4c02e4c1ed Reverting some changes in commit 6302b98
Check to avoid generation of duplicated stylesheet-tags shouldn't have
been removed from Gridster. It's useful when calling multiple times 
`generate_stylesheet` method once Gridster is initializated. We use it
at ducksboard to generate a TVmode version of the grid with bigger widgets.

Refactored the way stylesheet tags are removed. When created I push them 
to a jQuery collection which is removed when `destroy` method is executed.
2013-06-13 11:43:37 +02:00
vieron 3d755fd793 Pass container width to draggable instance. Relative to 5569caa687 2013-06-13 11:43:37 +02:00
vieron 2aa9b55433 namespaced events instead of caching callbacks 2013-06-13 11:43:37 +02:00
Dustin Moore eca38b6272 Merge pull request #165 from matiangul/master
Fix is_empty method
2013-05-14 08:42:10 -07:00
Dustin Moore 52dc36ead9 Merge pull request #169 from tuvokki/master
Fix for Issue #158
2013-05-14 07:50:05 -07:00
Wouter Roosendaal 826120bdb1 resize_widget function with callback parameter
Is it possible to add a callback to the resize_widget function, that is
called when the resizing of a widget is finished? This may help to
update the widget content properly.
2013-05-13 16:14:47 +02:00
matiangul fca830007a Fixed is_empty method 2013-05-04 11:05:00 +02:00
Dustin Moore d56f6d80a3 Merge pull request #152 from rfink/master
Fix for issue #46
2013-04-24 08:13:30 -07:00
Wouter Roosendaal 5569caa687 Add max_cols setting
Right now the number of columns is calculated by dividing the available
space by the necessary space. I want to have an option to limit the
number of calculated columns, without changing the width of the div my
grid lives in.

In order to limit the number of calculated columns max_cols is set to a
number. To have 'unlimited' columns set the value of max_cols to -1 (as
ids done in the default settings). This provides the arbitrary useful
functionality to set the max number of columns to 0. Any sideeffect
caused by this are mitigated by checking that the max_cols is larger
than the min_cols setting.
2013-04-11 14:18:54 +02:00
Ryan Fink 6302b988d1 Fix for not removing stylesheets on destroy 2013-04-09 12:27:04 +00:00
Dustin Moore b58f1454a5 Merge pull request #125 from brokenseal/master
Possible solution to memory leak #124
2013-04-02 07:52:59 -07:00
Davide Callegari 7f3f679cb6 Fixed a minor issue when trying to destroy a non existing drag_api 2013-02-15 16:50:35 +01:00
Davide Callegari 233129b183 Bound leftover callbacks are one of the main causes of memory leaks, let's remove them inside the destroy method 2013-02-15 15:25:09 +01:00
Davide Callegari ac2908e1a2 Added a destroy method on the Gridster class 2013-02-15 14:30:20 +01:00
Davide Callegari 36bec0bb14 Fixed a couple of errors in the methods definition
Added my own IDE filed in the .gitignore file
2013-02-15 14:29:54 +01:00
Daniel Beauchamp ce391ae13e Fix inverted arguments for a collision callback
The start and stop callbacks on this line seem to be backwards.
2012-11-01 01:47:07 -03:00
vieron 55edd11ef8 gridster: new method remove_all_widgets
Remove multiple widgets without chaining callbacks was not possible so I've added a new argument to remove_widget method named `silent` which if it's value is true, widgets below the removed will not move up.

Also added the method remove_all_widgets.

Fixes #63
2012-10-20 01:37:41 +02:00
Philip Manavopoulosandvieron 552df22e1c Allow for an optional drag handle to be specified
When defining the gridster, you can now define a draggable.handle selector:

For example:

    $("#widgets").gridster({
        widget_margins: [10, 10],
        widget_base_dimensions: [565, 400],
		draggable: {
			stop: function(event, ui) {
				console.log('save new columns');
			},
			handle: '.title'
		}
    });

If handle is omitted (or left blank), it works as it did previously. If a value is specified, then dragging only starts if the element which was clicked matches the selector specified.

Added by @vieron:
Closes #29
2012-10-20 00:12:10 +02:00
vieron 68f1d6279c Avoid dynamic column generation.
Using add_faux_col each time a new widget is added to the grid caused the widget was always positioned in the first row on the right. Related to #60.
2012-10-15 15:47:31 +02:00
vieron 5411836c88 events/onselectstart: Don't prevent default behaviour on form fields
Fixes #56.
2012-10-07 21:36:58 +02:00
vieron 5a3c382c8b Immediate children selection for widgets. Fixes #52. 2012-10-07 21:12:38 +02:00
vieron cd5c936939 gridster extra methods
Some new methods we need at Ducksboard to implement TV mode.

Two new distributions of Gridster are generated with grunt:
    - jquery.gridster.with-extras.js
    - jquery.gridster.with-extras.min.js
2012-10-07 21:12:38 +02:00
vieron 7dbbc105c1 add_faux_cell: create parent array if doesn't exists 2012-10-07 21:12:38 +02:00
vieron 82b8778762 if not passed, use default namespace for generating stylessheets 2012-10-07 21:12:38 +02:00
vieron 7fc97d0f79 Allow to extend gridster out of the scope 2012-10-07 21:12:38 +02:00
vieron 0b1c9899d0 some code style corrections/improvements 2012-10-07 21:12:38 +02:00
vieron c4fee63b96 ability to specify a max row as limit in can_move_to method 2012-10-03 15:40:16 +02:00