MCPcopy Index your code
hub / github.com/react-grid-layout/react-grid-layout / modifyLayout

Function modifyLayout

src/core/layout.ts:134–150  ·  view source on GitHub ↗
(
  layout: Layout,
  layoutItem: LayoutItem
)

Source from the content-addressed store, hash-verified

132 * @returns New layout with the item replaced
133 */
134export function modifyLayout(
135 layout: Layout,
136 layoutItem: LayoutItem
137): LayoutItem[] {
138 const newLayout: LayoutItem[] = new Array(layout.length);
139 for (let i = 0; i < layout.length; i++) {
140 const item = layout[i];
141 if (item !== undefined) {
142 if (layoutItem.i === item.i) {
143 newLayout[i] = layoutItem;
144 } else {
145 newLayout[i] = item;
146 }
147 }
148 }
149 return newLayout;
150}
151
152/**
153 * Apply a transformation to a layout item.

Callers 1

withLayoutItemFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…