Angular-gridster2: Overlap function still doesn't work with v6.0.1

Created on 8 May 2018  路  6Comments  路  Source: tiberiuzuld/angular-gridster2

Hi @tiberiuzuld,
After you fixed Issue #322, the error disappeared but the overlay function still doesn't work.

The init code of the grid is simple as below:

ngOnInit() {
this.options = {
itemChangeCallback: AppComponent.itemChange,
itemResizeCallback: AppComponent.itemResize,
gridType: 'fit',
displayGrid: "always",
pushItems: false,
swap: false,
draggable: { enabled: true, dropOverItems: true, dropOverItemsCallback: AppComponent.overlapEvent },
minCols: 10,
maxCols: 100,
minRows: 10,
maxRows: 100
};
this.dashboard = [
{ cols: 3, rows: 3, y: 1, x: 1 },
{ cols: 2, rows: 2, y: 3, x: 4 }
];
}

As you can see, I disable swap and pushItems, enable dropOverItems and create callback method accordingly. During the testing I have found that the overlap function never works. Also you can reproduce the issue on drag demo page if you uncheck 'Push Items' and 'check Allow Drop Over Items', then drop one item on top of another one.

The overlay function never works. The item which was dropped over on top of another item will return to its original location. Please kindly help confirm if it's a bug or an enhancement. Thanks a lot.

question

Most helpful comment

Hi @tiberiuzuld,
Got it, thanks a lot.

All 6 comments

Hi @Steven-ZhouMeng ,
It is working as intended, the callback is called when a drag ends over an item, is up to you if you want to remove the item or not.
That is how the functionality was requested when the future was made. https://github.com/tiberiuzuld/angular-gridster2/issues/221

Hi @tiberiuzuld,
Thanks a lot for your feedback. I just want to confirm with you about the overlap function. Currently we want to put one item on top of another item which means "overlay". That means two items are in the same location, one is on top of another one.

I have added some code in the callback method of dropOverItems to implement the overlay function, but the code after the callback in Gridster was executed to return the drag item back to original location.

Please kindly help confirm if it's possible to support overlay function now? Thanks a lot.

It is not possible to have two items at the same location.
This overlap function is just to know when an item is dropped over the other.
Is not to place two items over the others as an overley.

Hi @tiberiuzuld,
Got it, thanks a lot.

@tiberiuzuld I was hoping to use this library to build a game. It has so many great features and would be perfect except that I need to allow players to lay pieces over other pieces. Would you be open to taking pull requests to enable something like this? I'm happy to dig in if you're open to the feature.

Hi @tiberiuzuld , I have a requirement of placing an gridster-item one above another, any plans to add this feature ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

petarGitNik picture petarGitNik  路  3Comments

dhaniksahni picture dhaniksahni  路  4Comments

HighSoftWare96 picture HighSoftWare96  路  4Comments

ddegasperi picture ddegasperi  路  4Comments

dnbo picture dnbo  路  4Comments