Clean up
This commit is contained in:
parent
1c702d5f07
commit
e48e2ff7f0
|
@ -118,7 +118,7 @@
|
|||
{/if}
|
||||
</div>
|
||||
|
||||
<SheetScrollWrapper scrollHorizontally wheelInteractive foo>
|
||||
<SheetScrollWrapper scrollHorizontally wheelInteractive>
|
||||
<div class="row">
|
||||
{#each $visibleColumns as column}
|
||||
{@const cellId = `new-${column.name}`}
|
||||
|
|
|
@ -10,12 +10,10 @@
|
|||
focusedCellId,
|
||||
reorder,
|
||||
selectedRows,
|
||||
visibleColumns,
|
||||
renderedColumns,
|
||||
hoveredRowId,
|
||||
selectedCellMap,
|
||||
focusedRow,
|
||||
hiddenColumnsWidth,
|
||||
columnHorizontalInversionIndex,
|
||||
} = getContext("sheet")
|
||||
|
||||
|
@ -23,8 +21,6 @@
|
|||
$: rowHovered = $hoveredRowId === row._id
|
||||
$: rowFocused = $focusedRow?._id === row._id
|
||||
$: reorderSource = $reorder.sourceColumn
|
||||
$: cols = rowFocused ? $visibleColumns : $renderedColumns
|
||||
$: foo = `margin-left: ${-1 * $hiddenColumnsWidth}px;`
|
||||
</script>
|
||||
|
||||
<div
|
||||
|
|
|
@ -17,19 +17,12 @@
|
|||
export let scrollVertically = false
|
||||
export let scrollHorizontally = false
|
||||
export let wheelInteractive = false
|
||||
export let foo = false
|
||||
|
||||
$: style = generateStyle($scroll, $rowHeight, $hiddenColumnsWidth, foo)
|
||||
$: style = generateStyle($scroll, $rowHeight, $hiddenColumnsWidth)
|
||||
|
||||
const generateStyle = (scroll, rowHeight, hiddenWidths, foo) => {
|
||||
let offsetX, offsetY
|
||||
if (!foo) {
|
||||
offsetX = scrollHorizontally ? -1 * scroll.left + hiddenWidths : 0
|
||||
offsetY = scrollVertically ? -1 * (scroll.top % rowHeight) : 0
|
||||
} else {
|
||||
offsetX = scrollHorizontally ? -1 * scroll.left : 0
|
||||
offsetY = scrollVertically ? -1 * scroll.top : 0
|
||||
}
|
||||
const generateStyle = (scroll, rowHeight, hiddenWidths) => {
|
||||
const offsetX = scrollHorizontally ? -1 * scroll.left + hiddenWidths : 0
|
||||
const offsetY = scrollVertically ? -1 * (scroll.top % rowHeight) : 0
|
||||
return `transform: translate3d(${offsetX}px, ${offsetY}px, 0);`
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue