File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
src/components/tile-manager Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,31 @@ class TilesState {
7272 }
7373 }
7474
75+ /**
76+ * Checks and adjusts tile spans based on the column count of the tile manager.
77+ */
78+ public adjustTileGridPosition ( ) : void {
79+ const columnCount = this . manager . columnCount ;
80+
81+ if ( columnCount > 0 ) {
82+ for ( const tile of this . tiles ) {
83+ let colStart = tile . colStart || 0 ;
84+ let colStartDelta = colStart > 0 ? 1 : 0 ;
85+ const colSpan = tile . colSpan || 0 ;
86+
87+ if ( colStart > columnCount ) {
88+ colStart = 0 ;
89+ colStartDelta = 0 ;
90+ tile . colStart = 0 ;
91+ }
92+
93+ if ( colStart + colSpan > columnCount ) {
94+ tile . colSpan = columnCount - colStart + colStartDelta ;
95+ }
96+ }
97+ }
98+ }
99+
75100 public remove ( tile : IgcTileComponent ) : void {
76101 for ( const each of this . tiles ) {
77102 if ( each . position >= tile . position ) {
Original file line number Diff line number Diff line change @@ -226,6 +226,10 @@ export default class IgcTileManagerComponent extends LitElement {
226226 } ) ;
227227 }
228228
229+ protected override updated ( ) {
230+ this . _tilesState . adjustTileGridPosition ( ) ;
231+ }
232+
229233 protected override firstUpdated ( ) {
230234 this . _tilesState . assignPositions ( ) ;
231235 this . _tilesState . assignTiles ( ) ;
You can’t perform that action at this time.
0 commit comments