Browse Source

Fix scroll to element if it is bigger than client

master
morethanwords 4 years ago
parent
commit
25cdaebed6
  1. 4
      src/components/scrollable.ts
  2. 1
      src/scss/partials/popups/_datePicker.scss

4
src/components/scrollable.ts

@ -484,7 +484,7 @@ export default class Scrollable extends ScrollableBase { @@ -484,7 +484,7 @@ export default class Scrollable extends ScrollableBase {
const clientHeight = this.container.clientHeight;
const height = element.scrollHeight;
const d = (clientHeight - height) / 2;
const d = height >= clientHeight ? 0 : (clientHeight - height) / 2;
offset -= d;
this.scrollTo(offset, 'top', smooth);
@ -558,7 +558,7 @@ export class ScrollableX extends ScrollableBase { @@ -558,7 +558,7 @@ export class ScrollableX extends ScrollableBase {
const clientWidth = this.container.clientWidth;
const width = element.scrollWidth;
const d = (clientWidth - width) / 2;
const d = width >= clientWidth ? 0 : (clientWidth - width) / 2;
offset -= d;
this.scrollTo(offset, 'left', smooth, undefined, scrollTime);

1
src/scss/partials/popups/_datePicker.scss

@ -70,6 +70,7 @@ @@ -70,6 +70,7 @@
&-months {
margin-top: 7px;
margin-bottom: 1.5rem;
user-select: none;
}
&-month {

Loading…
Cancel
Save