Skip to content

Commit 8f1c427

Browse files
committed
fix: set tile col/rowSpan on resizeEnd (checkpoint)
1 parent d910f65 commit 8f1c427

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/components/tile-manager/resize-state.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,6 @@ class TileResizeState {
139139
* based on its new dimensions and starting position.
140140
*/
141141
public calculateResizedGridPosition(rect: DOMRect) {
142-
const { column, row } = this._initialPosition;
143-
144142
const colProps = this.getResizeSpanProps(rect);
145143
const rowProps = this.getResizeSpanProps(rect, true);
146144

@@ -149,10 +147,10 @@ class TileResizeState {
149147
this._resizeUtil.calculateResizedSpan(colProps);
150148
this._position.row.span = this._resizeUtil.calculateResizedSpan(rowProps);
151149

152-
const cssColumn = `${column.start < 0 ? 'auto' : column.start} / span ${this._position.column.span}`;
153-
const cssRow = `${row.start < 0 ? 'auto' : row.start} / span ${this._position.row.span}`;
154-
155-
return { column: cssColumn, row: cssRow };
150+
return {
151+
colSpan: this._position.column.span,
152+
rowSpan: this._position.row.span,
153+
};
156154
}
157155

158156
public calculateActualSize(grid: HTMLElement) {

src/components/tile-manager/tile.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,13 +495,13 @@ export default class IgcTileComponent extends EventEmitterMixin<
495495
private async _handleResizeEnd({
496496
detail: { state },
497497
}: CustomEvent<ResizeCallbackParams>) {
498-
const { column, row } = this._resizeState.calculateResizedGridPosition(
498+
const { colSpan, rowSpan } = this._resizeState.calculateResizedGridPosition(
499499
state.current
500500
);
501501

502502
const { transition } = startViewTransition(() => {
503-
this.style.setProperty('grid-row', row);
504-
this.style.setProperty('grid-column', column);
503+
this.colSpan = colSpan;
504+
this.rowSpan = rowSpan;
505505
});
506506

507507
await transition?.updateCallbackDone;

0 commit comments

Comments
 (0)