Skip to content

Commit e25a00c

Browse files
authored
Merge pull request #1299 from adumesny/typescript
TS: fix for #810 many columns roundoff error
2 parents dd704eb + 08a5281 commit e25a00c

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

doc/CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Change log
4040
- add `getGridItems()` to return list of HTML grid items
4141
- add `{dragIn | dragInOptions}` grid attributes to handle external drag&drop items
4242
- 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)
43+
- fix [1299](https://github.com/gridstack/gridstack.js/pull/1299) many columns round-off error
4344

4445
## 1.1.2 (2020-05-17)
4546

spec/e2e/html/810-many-columns.html

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@
88

99
<link rel="stylesheet" href="../../../demo/demo.css"/>
1010
<link rel="stylesheet" href="810-many-columns.css"/>
11-
12-
<script src="../../../dist/jquery.min.js"></script>
13-
<script src="../../../dist/jquery-ui.min.js"></script>
14-
<script src="../../../src/gridstack.js"></script>
15-
<script src="../../../src/gridstack.jQueryUI.js"></script>
11+
<script src="../../../dist/gridstack.all.js"></script>
1612
</head>
1713
<body>
1814
<div class="container-fluid">
@@ -30,8 +26,7 @@ <h1>Many Columns demo</h1>
3026
let count = 0;
3127
let options = {
3228
column: COLUMNS,
33-
cellHeight: 'auto',
34-
float: false
29+
cellHeight: 'auto'
3530
};
3631
let grid = GridStack.init(options);
3732

src/gridstack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ export class GridStack {
424424
*/
425425
public cellWidth(): number {
426426
// TODO: take margin into account (horizontal_padding in .scss) to make cellHeight='auto' square ? (see 810-many-columns.html)
427-
return Math.round(this.el.offsetWidth / this.opts.column);
427+
return this.el.offsetWidth / this.opts.column;
428428
}
429429

430430
/**

0 commit comments

Comments
 (0)