Thanks to visit codestin.com
Credit goes to github.com

Skip to content

TS: fix for #810 many columns roundoff error #1299

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

Merged
merged 2 commits into from
Jul 5, 2020
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions doc/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Change log
- add `getGridItems()` to return list of HTML grid items
- add `{dragIn | dragInOptions}` grid attributes to handle external drag&drop items
- add `save()` and `restore()` to serialize grids from JSON, saving all attributes (not just w,h,x,y) [1286](https://github.com/gridstack/gridstack.js/issues/1286)
- fix [1299](https://github.com/gridstack/gridstack.js/pull/1299) many columns round-off error

## 1.1.2 (2020-05-17)

Expand Down
9 changes: 2 additions & 7 deletions spec/e2e/html/810-many-columns.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@

<link rel="stylesheet" href="../../../demo/demo.css"/>
<link rel="stylesheet" href="810-many-columns.css"/>

<script src="../../../dist/jquery.min.js"></script>
<script src="../../../dist/jquery-ui.min.js"></script>
<script src="../../../src/gridstack.js"></script>
<script src="../../../src/gridstack.jQueryUI.js"></script>
<script src="../../../dist/gridstack.all.js"></script>
</head>
<body>
<div class="container-fluid">
Expand All @@ -30,8 +26,7 @@ <h1>Many Columns demo</h1>
let count = 0;
let options = {
column: COLUMNS,
cellHeight: 'auto',
float: false
cellHeight: 'auto'
};
let grid = GridStack.init(options);

Expand Down
2 changes: 1 addition & 1 deletion src/gridstack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ export class GridStack {
*/
public cellWidth(): number {
// TODO: take margin into account (horizontal_padding in .scss) to make cellHeight='auto' square ? (see 810-many-columns.html)
return Math.round(this.el.offsetWidth / this.opts.column);
return this.el.offsetWidth / this.opts.column;
}

/**
Expand Down