MCPcopy
hub / github.com/mathuo/dockview / getRelativeLocation

Function getRelativeLocation

packages/dockview-core/src/gridview/gridview.ts:158–179  ·  view source on GitHub ↗
(
    rootOrientation: Orientation,
    location: number[],
    direction: Position
)

Source from the content-addressed store, hash-verified

156}
157
158export function getRelativeLocation(
159 rootOrientation: Orientation,
160 location: number[],
161 direction: Position
162): number[] {
163 const orientation = getLocationOrientation(rootOrientation, location);
164 const directionOrientation = getDirectionOrientation(direction);
165
166 if (orientation === directionOrientation) {
167 const [rest, _index] = tail(location);
168 let index = _index;
169
170 if (direction === 'right' || direction === 'bottom') {
171 index += 1;
172 }
173
174 return [...rest, index];
175 } else {
176 const index = direction === 'right' || direction === 'bottom' ? 1 : 0;
177 return [...location, index];
178 }
179}
180
181export function getDirectionOrientation(direction: Position): Orientation {
182 return direction === 'top' || direction === 'bottom'

Callers 8

_doAddPanelMethod · 0.90
_doAddGroupMethod · 0.90
_doMoveGroupOrPanelMethod · 0.90
moveTabGroupToGroupMethod · 0.90
_doMoveGroupMethod · 0.90
movePanelMethod · 0.90
addPanelMethod · 0.90
moveGroupMethod · 0.90

Calls 3

tailFunction · 0.90
getLocationOrientationFunction · 0.85
getDirectionOrientationFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…