angular-gridster2 icon indicating copy to clipboard operation
angular-gridster2 copied to clipboard

Items sometimes overlap after dragging item

Open hannecolaers opened this issue 5 years ago • 8 comments

Hi,

we have an issue in our project that after dragging an item, it sometimes happens that items overlap each other. I've created a simple example to reproduce:

Schermafbeelding 2019-06-17 om 10 13 31

overlapping-tiles

Thanks for looking into it!

hannecolaers avatar Jun 17 '19 08:06 hannecolaers

Could you post the code you used to make that sample? Posting a stackblitz makes looking into these issues much easier.

CollinGraf314 avatar Jun 17 '19 13:06 CollinGraf314

Here you go: https://stackblitz.com/edit/angular-6lsknr?file=src%2Fapp%2Fapp.component.ts

hannecolaers avatar Jun 17 '19 14:06 hannecolaers

Hi @hannecolaers , @CollinGraf314 , I tried to reproduce it in latest version but I couldn't. Anyway you can try to use the class gridster-item-content to fix this kind of issues.

tiberiuzuld avatar Aug 26 '19 19:08 tiberiuzuld

This issue still exists in the latest version. Adding gridster-item-content does help, but if you highlight content with your cursor and then click and drag part of the gridster-item that does not have the gridster-item-content class, then you get the bug again. Interestingly the bug only occurs when you have the mouse moving when you begin your drag. If your mouse is stationary when you begin the drag then the bug does not occur.

Stackblitz: https://stackblitz.com/edit/angular-jstyvl gif: gridster2Bug

Issue is coming from line 237 in the gridsterDraggable.service where lastPosition gets set to undefined by line 235.

image

CollinGraf314 avatar Sep 24 '19 16:09 CollinGraf314

I'm seeing this issue as well. It is actually fairly easy to reproduce on the demo site. https://tiberiuzuld.github.io/angular-gridster2/gridSizes

Set a fixed grid size by setting the min and max values for rows and cols to the same value. Then fill the grid up with items of varying size. Once full, quickly shuffle one of the smaller items around. It doesn't take long for some of the items to start overlapping.

image

image

ashitanojoe avatar Nov 11 '19 06:11 ashitanojoe

@tiberiuzuld any update on this?

gethari avatar Jan 19 '21 11:01 gethari

We are running into this same issue with the following config config

    options: GridsterConfig = {
        gridType: GridType.Fit,
        displayGrid: DisplayGrid.Always,
        pushItems: true,
        draggable: {
            enabled: true,
            stop: this.gridsterDragStopHandler.bind(this)
        },
        resizable: {
            enabled: true,
            stop: this.gridsterResizeStopHandler.bind(this)
        },
        minCols: 2,
        maxCols: 2,
        minRows: 8,
        maxRows: 8,
        maxItemCols: 2,
        minItemCols: 1,
        maxItemRows: 2,
        minItemRows: 1,
        defaultItemCols: 1,
        defaultItemRows: 1,
        enableEmptyCellDrop: true,
        disableScrollHorizontal: true,
        disableScrollVertical: true,
        emptyCellDropCallback: this.gridsterDropHandler.bind(this)
    };

gridster-repro (2)

JelleVisser avatar Jun 17 '21 15:06 JelleVisser