Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ gridstack.js API
* example `dragInOptions: { appendTo: 'body', helper: 'clone', handle: '.grid-stack-item-content' }`
* **Note**: if you have multiple grids, it's best to call `GridStack.setupDragIn()` with same params as it only need to be done once.
* **Note2**: instead of 'clone' you can also pass your own function (get passed the event).
- `draggable` - allows to override draggable options - see `DDDragOpt`. (default: `{handle: '.grid-stack-item-content', appendTo: 'body'}`)
- `draggable` - allows to override draggable options - see `DDDragOpt`. (default: `{handle: '.grid-stack-item-content', appendTo: 'body', scroll: true}`)
- `dragOut` to let user drag nested grid items out of a parent or not (default false) See [example](http://gridstackjs.com/demo/nested.html)
- `engineClass` - the type of engine to create (so you can subclass) default to GridStackEngine
- `float` - enable floating widgets (default: `false`) See [example](http://gridstackjs.com/demo/float.html)
Expand Down Expand Up @@ -134,6 +134,7 @@ gridstack.js API
- `handle`?: string - class selector of items that can be dragged. default to '.grid-stack-item-content'
- `appendTo`?: string - default to 'body' (TODO: is this even used anymore ?)
- `pause`?: boolean | number - if set (true | msec), dragging placement (collision) will only happen after a pause by the user. Note: this is Global
- `scroll`?: boolean - default to 'true', enable or disable the scroll when an element is dragged on bottom or top of the grid.

### DDDragInOpt extends DDDragOpt
- `helper`?: string | ((event: Event) => HTMLElement) - helper function when dropping (ex: 'clone' or your own method)
Expand Down
2 changes: 1 addition & 1 deletion src/gridstack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2181,7 +2181,7 @@ export class GridStack {
if (node._temporaryRemoved) return; // handled by dropover
let distance = ui.position.top - node._prevYPix;
node._prevYPix = ui.position.top;
if (!this.opts.disableAutoScroll) {
if (this.opts.draggable.scroll) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!== false
still better in case we fail to init that var (I know it's it in the defaul now). I'll update as I need to a release for work :)

Utils.updateScrollPosition(el, ui.position, distance);
}

Expand Down
7 changes: 2 additions & 5 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const gridDefaults: GridStackOptions = {
cellHeightThrottle: 100,
cellHeightUnit: 'px',
column: 12,
draggable: { handle: '.grid-stack-item-content', appendTo: 'body' },
draggable: { handle: '.grid-stack-item-content', appendTo: 'body', scroll: true },
handle: '.grid-stack-item-content',
itemClass: 'grid-stack-item',
margin: 10,
Expand Down Expand Up @@ -140,9 +140,6 @@ export interface GridStackOptions {
Note: only used by addGrid(), else your element should have the needed class */
class?: string;

/** disallows the scroll when dragging or resizing a widget (default?: false) */
disableAutoScroll?: boolean;

/** disallows dragging of widgets (default?: false) */
disableDrag?: boolean;

Expand Down Expand Up @@ -351,7 +348,7 @@ export interface DDDragOpt {
/** if set (true | msec), dragging placement (collision) will only happen after a pause by the user. Note: this is Global */
pause?: boolean | number;
/** default to `true` */
// scroll?: boolean;
scroll?: boolean;
/** parent constraining where item can be dragged out from (default: null = no constrain) */
// containment?: string;
}
Expand Down