Skip to content

Commit

Permalink
fix(modules): modules public methods typings, calcFitHeight fix
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-rr committed Aug 12, 2022
1 parent 8657c49 commit deb7de8
Show file tree
Hide file tree
Showing 19 changed files with 62 additions and 28 deletions.
2 changes: 1 addition & 1 deletion dist/core/index.js

Large diffs are not rendered by default.

14 changes: 10 additions & 4 deletions dist/cupertino-pane.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* Released under the MIT License
*
* Released on: August 8, 2022
* Released on: August 12, 2022
*/

/******************************************************************************
Expand Down Expand Up @@ -1431,6 +1431,8 @@ class FitHeightModule {
return;
}
// bind to primary instance
// TODO: change binding strategy according to TypeScript
// E.G. Using public module methods from modules
this.instance['calcFitHeight'] = (animated) => __awaiter(this, void 0, void 0, function* () { return this.calcFitHeight(animated); });
// Class to wrapper
this.instance.on('DOMElementsReady', () => {
Expand Down Expand Up @@ -1509,7 +1511,6 @@ class FitHeightModule {
return __awaiter(this, void 0, void 0, function* () {
this.calcHeightInProcess = true;
let images = this.instance.el.querySelectorAll('img');
let height;
// Make element visible to calculate height
this.instance.el.style.height = 'unset';
if (!this.instance.rendered) {
Expand All @@ -1535,7 +1536,12 @@ class FitHeightModule {
}
yield Promise.all(promises);
yield new Promise(resolve => requestAnimationFrame(resolve));
height = Math.round(this.instance.paneEl.getBoundingClientRect().height);
// Calculate heights
const getHeight = (el) => Math.round(el.getBoundingClientRect().height);
let contentElHeight = getHeight(this.instance.el);
let diff = Math.abs(this.contentElHeight - contentElHeight);
let paneElHeight = (!diff) ? getHeight(this.instance.paneEl) : getHeight(this.instance.paneEl) + diff;
this.contentElHeight = getHeight(this.instance.el);
// Hide elements back
if (!this.instance.rendered) {
this.instance.el.style.visibility = 'unset';
Expand All @@ -1546,7 +1552,7 @@ class FitHeightModule {
this.instance.wrapperEl.style.display = 'none';
}
this.calcHeightInProcess = false;
return height;
return paneElHeight;
});
}
}
Expand Down
4 changes: 2 additions & 2 deletions dist/cupertino-pane.esm.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/cupertino-pane.esm.min.js.map

Large diffs are not rendered by default.

14 changes: 10 additions & 4 deletions dist/cupertino-pane.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/cupertino-pane.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/cupertino-pane.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/modules/backdrop.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit deb7de8

Please sign in to comment.