Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Keep limited size after the drop. Otherwise the end result will differ (and error) from the drag result

Henriette Dinger3d991d8a668d
diff --git a/frontend/src/app/modules/grids/areas/grid-widget-area.ts b/frontend/src/app/modules/grids/areas/grid-widget-area.ts
index ba7ca6ee6ed..67e183be173 100644
--- a/frontend/src/app/modules/grids/areas/grid-widget-area.ts
+++ b/frontend/src/app/modules/grids/areas/grid-widget-area.ts
@@ -76,4 +76,11 @@ export class GridWidgetArea extends GridArea {
this.widget.startColumn = this.startColumn;
this.widget.endColumn = this.endColumn;
}
+
+ public copyDimensionsTo(sink:GridWidgetArea) {
+ sink.startRow = this.startRow;
+ sink.startColumn = this.startColumn;
+ sink.endRow = this.endRow;
+ sink.endColumn = this.endColumn;
+ }
}
diff --git a/frontend/src/app/modules/grids/grid/drag-and-drop.service.ts b/frontend/src/app/modules/grids/grid/drag-and-drop.service.ts
index becc9ef07b7..06ad78119bb 100644
--- a/frontend/src/app/modules/grids/grid/drag-and-drop.service.ts
+++ b/frontend/src/app/modules/grids/grid/drag-and-drop.service.ts
@@ -50,6 +50,10 @@ export class GridDragAndDropService implements OnDestroy {
}
let widgetArea = this.draggedArea!;
+ // Set the draggedArea's startRow/startColumn properties
+ // to the drop zone ones.
+ // The dragged Area should keep it's height and width normally but will
+ // shrink if the area would otherwise end outside the grid.
// we cannot use the widget's original area as moving it while dragging confuses cdkDrag
this.copyPositionButRestrict(dropArea, this.placeholderArea);
@@ -91,11 +95,7 @@ export class GridDragAndDropService implements OnDestroy {
return;
}
- // Set the draggedArea's startRow/startColumn properties
- // to the drop zone ones.
- // The dragged Area should keep it's height and width normally but will
- // shrink if the area would otherwise end outside the grid.
- this.copyPositionButRestrict(this.placeholderArea!, this.draggedArea!);
+ this.placeholderArea!.copyDimensionsTo(this.draggedArea!)
if (!this.draggedArea!.unchangedSize) {
this.layout.writeAreaChangesToWidgets();