Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add prop rows for relative heights #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,18 @@ import { makeMatrixFromItemsIgnore } from "./utils/matrix.js";
export let useTransform = false;
export let items = [];
export let cols = 0;
export let rows = 0;
export let dragDebounceMs = 350;
export let gap = 0;
export let rowHeight = 150;
export let breakpoints;
export let fillEmpty = true;

let yPerPx = rowHeight;
if (rows > 0) {
yPerPx = rowHeight = document.documentElement.clientHeight / rows;
}

let container,
focusedItem,
bound,
Expand All @@ -100,7 +106,6 @@ let container,
getComputedCols,
documentWidth,
resizeNoDynamicCalc,
yPerPx = rowHeight,
initCols = cols,
shadow = {
w: 0,
Expand All @@ -123,6 +128,10 @@ function onResize() {

let w = document.documentElement.clientWidth

if (rows > 0) {
yPerPx = rowHeight = document.documentElement.clientHeight / rows;
}

if(w !== documentWidth) {
documentWidth = w;

Expand Down