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

Spreadsheet increase inputsize #100

Open
wants to merge 6 commits into
base: simplystore
Choose a base branch
from

Conversation

Hoxolotl
Copy link

@Hoxolotl Hoxolotl commented Jan 8, 2025

Check the notes at line 498 and 502 in spreadsheet.js. And explain to Govert why that code is there please.

let columnDef = getColumnDefinition(el)
let row = getRow(el)
selector.innerHTML = ''
selector.style.top = Math.max(2, (rect.top - offset.top))+'px'
selector.style.left = (rect.left - offset.left)+'px'
selector.style.width = rect.width+'px'
selector.style.width = Math.max(300, (rect.width))+'px'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do Math.min(spreadsheetSize.width, Math.max(300, rect.width)+'px'
or Math.clamp if that exists

const spreadsheetSize = spreadsheetElement.getBoundingClientRect();
const boxWidth = spreadsheetSize.width/1.618 // golden ratio
const iconSize = 60
const standardBoxWidth = 300 + iconSize
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a const minSize = 300 and use that everywhere

selector.style.left = (extraPadding) +'px'
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please extra code above to a separate function, e.g. calculateOptimalPosition

}
} else {

selector.style.height = 'fit-content'
selector.style.overflow = 'visible'
}
Copy link
Member

@poef poef Jan 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If each branch of if/else has the same code, extract it outside the if/else branches
In addition: maybe add the height and top calculation to the earlier calculateOptimalPosition code and return a new object with { top, left, width, height } properties
Also set a maximum height to spreadsheet.height - select.style.top

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants