MCPcopy Create free account
hub / github.com/editablejs/editable / edges

Function edges

packages/models/src/interfaces/grid.ts:961–1012  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

959 let [endRow, endCol] = end
960
961 const edges = (): [number, number, number, number] => {
962 const cells = Grid.cells(editor, at, {
963 startRow,
964 startCol,
965 endCol,
966 endRow,
967 })
968 for (const [cell, row, col] of cells) {
969 if (!cell) {
970 break
971 }
972 if (cell.span) {
973 const [sRow, sCol] = cell.span
974 const spanCell = grid.children[sRow].children[sCol]
975 if (!spanCell || spanCell.span) continue
976 if (sCol < startCol) {
977 startCol = sCol
978 return edges()
979 }
980 if (sRow < startRow) {
981 startRow = sRow
982 return edges()
983 }
984 if (spanCell.rowspan > 1 && endRow < spanCell.rowspan - 1 + sRow) {
985 endRow = spanCell.rowspan - 1 + sRow
986 return edges()
987 }
988 if (spanCell.colspan > 1 && endCol < spanCell.colspan - 1 + sCol) {
989 endCol = spanCell.colspan - 1 + sCol
990 return edges()
991 }
992 } else {
993 if (col !== startCol && cell.colspan + col - 1 === startCol) {
994 startCol = col
995 return edges()
996 }
997 if (row !== startRow && cell.rowspan + row - 1 === startRow) {
998 startRow = row
999 return edges()
1000 }
1001 if (cell.rowspan > 1 && endRow < cell.rowspan - 1 + row) {
1002 endRow = cell.rowspan - 1 + row
1003 return edges()
1004 }
1005 if (cell.colspan > 1 && endCol < cell.colspan - 1 + col) {
1006 endCol = cell.colspan - 1 + col
1007 return edges()
1008 }
1009 }
1010 }
1011 return [startRow, startCol, endCol, endRow]
1012 }
1013 ;[startRow, startCol, endCol, endRow] = edges()
1014 return {
1015 start: [startRow, startCol],

Callers 1

grid.tsFile · 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…