@ethlete/core 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -889,7 +889,7 @@ const isElementVisible = (options) => {
|
|
|
889
889
|
};
|
|
890
890
|
const scrollToElement = (options) => {
|
|
891
891
|
let { container } = options;
|
|
892
|
-
const { element, direction, behavior = 'smooth', origin = 'nearest' } = options;
|
|
892
|
+
const { element, direction, behavior = 'smooth', origin = 'nearest', scrollBlockMargin = 0, scrollInlineMargin = 0, } = options;
|
|
893
893
|
if (!element || container === null) {
|
|
894
894
|
return;
|
|
895
895
|
}
|
|
@@ -920,8 +920,8 @@ const scrollToElement = (options) => {
|
|
|
920
920
|
const elementBlockOrigin = origin === 'center' ? elementBlockCenter : origin === 'end' ? elementBlockEnd : elementBlockStart;
|
|
921
921
|
const containerInlineOrigin = origin === 'center' ? containerInlineCenter : origin === 'end' ? containerInlineEnd : containerInlineStart;
|
|
922
922
|
const containerBlockOrigin = origin === 'center' ? containerBlockCenter : origin === 'end' ? containerBlockEnd : containerBlockStart;
|
|
923
|
-
const inlineOffset = elementInlineOrigin - containerInlineOrigin;
|
|
924
|
-
const blockOffset = elementBlockOrigin - containerBlockOrigin;
|
|
923
|
+
const inlineOffset = elementInlineOrigin - containerInlineOrigin - scrollInlineMargin;
|
|
924
|
+
const blockOffset = elementBlockOrigin - containerBlockOrigin - scrollBlockMargin;
|
|
925
925
|
let inlineScroll = direction === 'block' ? undefined : inlineOffset;
|
|
926
926
|
let blockScroll = direction === 'inline' ? undefined : blockOffset;
|
|
927
927
|
if (origin === 'nearest') {
|