MCPcopy
hub / github.com/glideapps/glide-data-grid / shiftSelection

Function shiftSelection

packages/core/src/data-editor/data-editor.tsx:168–190  ·  view source on GitHub ↗
(input: GridSelection, offset: number)

Source from the content-addressed store, hash-verified

166}
167
168function shiftSelection(input: GridSelection, offset: number): GridSelection {
169 if (input === undefined || offset === 0 || (input.columns.length === 0 && input.current === undefined))
170 return input;
171
172 return {
173 current:
174 input.current === undefined
175 ? undefined
176 : {
177 cell: [input.current.cell[0] + offset, input.current.cell[1]],
178 range: {
179 ...input.current.range,
180 x: input.current.range.x + offset,
181 },
182 rangeStack: input.current.rangeStack.map(r => ({
183 ...r,
184 x: r.x + offset,
185 })),
186 },
187 rows: input.rows,
188 columns: input.columns.offset(offset),
189 };
190}
191
192/**
193 * @category DataEditor

Callers 1

DataEditorImplFunction · 0.85

Calls 1

offsetMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…