Skip to content

Commit

Permalink
fix(fitHeight): improved algorithm (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-rr committed Jul 8, 2023
1 parent cf74bd7 commit a62a2bd
Show file tree
Hide file tree
Showing 15 changed files with 54 additions and 52 deletions.
4 changes: 2 additions & 2 deletions dist/core/index.js

Large diffs are not rendered by default.

24 changes: 12 additions & 12 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: June 25, 2023
* Released on: July 9, 2023
*/

/******************************************************************************
Expand Down Expand Up @@ -973,12 +973,12 @@ class Breakpoints {
this.instance.moveToBreak(nextBreak[0]);
}
}
// Re-calc height
this.instance.paneEl.style.height = `${this.instance.getPaneHeight()}px`;
this.instance.scrollElementInit();
this.instance.checkOpacityAttr(this.currentBreakpoint);
this.instance.checkOverflowAttr(this.currentBreakpoint);
}
// Re-calc heights and scrolls
this.instance.scrollElementInit();
// Checks
this.instance.checkOpacityAttr(this.currentBreakpoint);
this.instance.checkOverflowAttr(this.currentBreakpoint);
// System event
this.instance.emit('buildBreakpointsCompleted');
});
Expand Down Expand Up @@ -2102,20 +2102,19 @@ class CupertinoPane {
this.updateScreenHeights();
this.drawBaseElements();
yield this.setBreakpoints();
// Necessary Inlines with breakpoints
this.paneEl.style.height = `${this.getPaneHeight()}px`;
// Custom transitions for present/destroy: set styles
Object.assign(this.paneEl.style, (_a = conf === null || conf === void 0 ? void 0 : conf.transition) === null || _a === void 0 ? void 0 : _a.from);
// Show elements
this.wrapperEl.style.display = 'block';
this.contentEl.style.display = 'block';
this.wrapperEl.classList.add('rendered');
this.rendered = true;
// set overflow element
// Init scroll (for some render DOM reasons important keep here for init)
this.scrollElementInit();
this.checkOverflowAttr(this.breakpoints.currentBreakpoint);
// System event
this.emit('rendered');
// Cursor
this.setGrabCursor(true);
// Button destroy
if (this.settings.buttonDestroy) {
this.paneEl.appendChild(this.destroyButtonEl);
Expand All @@ -2135,8 +2134,6 @@ class CupertinoPane {
if (this.settings.freeMode) {
this.settings.lowerThanBottom = false;
}
this.setGrabCursor(true);
this.checkOpacityAttr(this.breakpoints.currentBreakpoint);
/****** Fix android issues *******/
if (this.device.android) {
// Body patch prevent android pull-to-refresh
Expand Down Expand Up @@ -2171,6 +2168,9 @@ class CupertinoPane {
this.screenHeightOffset = window.innerHeight;
}
scrollElementInit() {
if (!this.settings.fitHeight) {
this.paneEl.style.height = `${this.getPaneHeight()}px`; // todo: review ability to remove this line at all
}
let attrElements = this.el.querySelectorAll('[overflow-y]');
if (!attrElements.length || attrElements.length > 1) {
this.overflowEl = this.contentEl;
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.

24 changes: 12 additions & 12 deletions dist/cupertino-pane.js

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.

2 changes: 1 addition & 1 deletion dist/modules/fit-height.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/modules/follower.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/modules/horizontal.js

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

Loading

0 comments on commit a62a2bd

Please sign in to comment.