File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -383,6 +383,19 @@ export default (target: Element, options: Options): CustomScrollAction[] => {
383
383
borderBottom
384
384
: 0
385
385
386
+ const scaleX =
387
+ 'offsetWidth' in frame
388
+ ? ( frame as HTMLElement ) . offsetWidth === 0
389
+ ? 0
390
+ : width / ( frame as HTMLElement ) . offsetWidth
391
+ : 0
392
+ const scaleY =
393
+ 'offsetHeight' in frame
394
+ ? ( frame as HTMLElement ) . offsetHeight === 0
395
+ ? 0
396
+ : height / ( frame as HTMLElement ) . offsetHeight
397
+ : 0
398
+
386
399
if ( scrollingElement === frame ) {
387
400
// Handle viewport logic (document.documentElement or document.body)
388
401
@@ -478,15 +491,15 @@ export default (target: Element, options: Options): CustomScrollAction[] => {
478
491
blockScroll = Math . max (
479
492
0 ,
480
493
Math . min (
481
- scrollTop + blockScroll ,
482
- frame . scrollHeight - height + scrollbarHeight
494
+ scrollTop + blockScroll / scaleY ,
495
+ frame . scrollHeight - height / scaleY + scrollbarHeight
483
496
)
484
497
)
485
498
inlineScroll = Math . max (
486
499
0 ,
487
500
Math . min (
488
- scrollLeft + inlineScroll ,
489
- frame . scrollWidth - width + scrollbarWidth
501
+ scrollLeft + inlineScroll / scaleX ,
502
+ frame . scrollWidth - width / scaleX + scrollbarWidth
490
503
)
491
504
)
492
505
You can’t perform that action at this time.
0 commit comments