Fix scroll to element if it is bigger than client
This commit is contained in:
parent
cdf0a95035
commit
25cdaebed6
@ -484,7 +484,7 @@ export default class Scrollable extends ScrollableBase {
|
|||||||
const clientHeight = this.container.clientHeight;
|
const clientHeight = this.container.clientHeight;
|
||||||
const height = element.scrollHeight;
|
const height = element.scrollHeight;
|
||||||
|
|
||||||
const d = (clientHeight - height) / 2;
|
const d = height >= clientHeight ? 0 : (clientHeight - height) / 2;
|
||||||
offset -= d;
|
offset -= d;
|
||||||
|
|
||||||
this.scrollTo(offset, 'top', smooth);
|
this.scrollTo(offset, 'top', smooth);
|
||||||
@ -558,7 +558,7 @@ export class ScrollableX extends ScrollableBase {
|
|||||||
const clientWidth = this.container.clientWidth;
|
const clientWidth = this.container.clientWidth;
|
||||||
const width = element.scrollWidth;
|
const width = element.scrollWidth;
|
||||||
|
|
||||||
const d = (clientWidth - width) / 2;
|
const d = width >= clientWidth ? 0 : (clientWidth - width) / 2;
|
||||||
offset -= d;
|
offset -= d;
|
||||||
|
|
||||||
this.scrollTo(offset, 'left', smooth, undefined, scrollTime);
|
this.scrollTo(offset, 'left', smooth, undefined, scrollTime);
|
||||||
|
@ -70,6 +70,7 @@
|
|||||||
&-months {
|
&-months {
|
||||||
margin-top: 7px;
|
margin-top: 7px;
|
||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1.5rem;
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-month {
|
&-month {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user