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

wrong rowHeight ratio #504

Open
tasiot opened this issue Apr 20, 2018 · 0 comments
Open

wrong rowHeight ratio #504

tasiot opened this issue Apr 20, 2018 · 0 comments

Comments

@tasiot
Copy link

tasiot commented Apr 20, 2018

When using margin and rowHeight as "*1.4" or "/1.4", block don't respect this ratio.
Indeed, rowHeight is calculated by curColWidth but it includes a margin, so ratio is no correctly calculated.

Solution consists to substract margin in curColWidth, calculate curRowHeight and add margin in curRowHeight.

if (gridster.colWidth === 'auto') {
	gridster.curColWidth = (gridster.curWidth + (gridster.outerMargin ? -gridster.margins[0] : gridster.margins[0])) / gridster.columns;
} else {
	gridster.curColWidth = gridster.colWidth;
}
var colWidthNoMargin = gridster.curColWidth - gridster.margins[0];

gridster.curRowHeight = gridster.rowHeight;
if (typeof gridster.rowHeight === 'string') {
	if (gridster.rowHeight === 'match') {
		gridster.curRowHeight = (gridster.curColWidth);
	} else if (gridster.rowHeight.indexOf('*') !== -1) {
		gridster.curRowHeight = (colWidthNoMargin * gridster.rowHeight.replace('*', '').replace(' ', '') + gridster.margins[1]);
	} else if (gridster.rowHeight.indexOf('/') !== -1) {
		gridster.curRowHeight = (colWidthNoMargin / gridster.rowHeight.replace('/', '').replace(' ', '') + gridster.margins[1]);
	}
}
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

No branches or pull requests

1 participant