@@ -325,8 +325,9 @@ export class Content extends Ion {
325
325
* @param {number } [duration] Duration of the scroll animation in milliseconds. Defaults to `300`.
326
326
* @returns {Promise } Returns a promise which is resolved when the scroll has completed.
327
327
*/
328
- scrollTo ( x : number , y : number , duration : number = 300 ) : Promise < any > {
329
- return this . _scroll . scrollTo ( x , y , duration ) ;
328
+ scrollTo ( x : number , y : number , duration : number = 300 , done ?: Function ) : Promise < any > {
329
+ console . debug ( `content, scrollTo started, y: ${ y } , duration: ${ duration } ` ) ;
330
+ return this . _scroll . scrollTo ( x , y , duration , done ) ;
330
331
}
331
332
332
333
/**
@@ -336,6 +337,7 @@ export class Content extends Ion {
336
337
* @returns {Promise } Returns a promise which is resolved when the scroll has completed.
337
338
*/
338
339
scrollToTop ( duration : number = 300 ) {
340
+ console . debug ( `content, scrollToTop, duration: ${ duration } ` ) ;
339
341
return this . _scroll . scrollToTop ( duration ) ;
340
342
}
341
343
@@ -352,6 +354,7 @@ export class Content extends Ion {
352
354
* @param {number } top
353
355
*/
354
356
setScrollTop ( top : number ) {
357
+ console . debug ( `content, setScrollTop, top: ${ top } ` ) ;
355
358
this . _scroll . setTop ( top ) ;
356
359
}
357
360
@@ -361,6 +364,7 @@ export class Content extends Ion {
361
364
* @returns {Promise } Returns a promise which is resolved when the scroll has completed.
362
365
*/
363
366
scrollToBottom ( duration : number = 300 ) {
367
+ console . debug ( `content, scrollToBottom, duration: ${ duration } ` ) ;
364
368
return this . _scroll . scrollToBottom ( duration ) ;
365
369
}
366
370
@@ -411,26 +415,23 @@ export class Content extends Ion {
411
415
* {number} dimensions.scrollLeft scroll scrollLeft
412
416
* {number} dimensions.scrollRight scroll scrollLeft + scrollWidth
413
417
*/
414
- getContentDimensions ( ) {
415
- let _scrollEle = this . _scrollEle ;
416
- let parentElement = _scrollEle . parentElement ;
418
+ getContentDimensions ( ) : ContentDimensions {
419
+ const scrollEle = this . _scrollEle ;
420
+ const parentElement = scrollEle . parentElement ;
417
421
418
422
return {
419
- contentHeight : parentElement . offsetHeight ,
420
- contentTop : parentElement . offsetTop ,
421
- contentBottom : parentElement . offsetTop + parentElement . offsetHeight ,
423
+ contentHeight : parentElement . offsetHeight - this . contentTop - this . contentBottom ,
424
+ contentTop : this . contentTop ,
425
+ contentBottom : this . contentBottom ,
422
426
423
427
contentWidth : parentElement . offsetWidth ,
424
428
contentLeft : parentElement . offsetLeft ,
425
- contentRight : parentElement . offsetLeft + parentElement . offsetWidth ,
426
429
427
- scrollHeight : _scrollEle . scrollHeight ,
428
- scrollTop : _scrollEle . scrollTop ,
429
- scrollBottom : _scrollEle . scrollTop + _scrollEle . scrollHeight ,
430
+ scrollHeight : scrollEle . scrollHeight ,
431
+ scrollTop : scrollEle . scrollTop ,
430
432
431
- scrollWidth : _scrollEle . scrollWidth ,
432
- scrollLeft : _scrollEle . scrollLeft ,
433
- scrollRight : _scrollEle . scrollLeft + _scrollEle . scrollWidth ,
433
+ scrollWidth : scrollEle . scrollWidth ,
434
+ scrollLeft : scrollEle . scrollLeft ,
434
435
} ;
435
436
}
436
437
@@ -443,7 +444,7 @@ export class Content extends Ion {
443
444
addScrollPadding ( newPadding : number ) {
444
445
assert ( typeof this . _scrollPadding === 'number' , '_scrollPadding must be a number' ) ;
445
446
if ( newPadding > this . _scrollPadding ) {
446
- console . debug ( ' content addScrollPadding' , newPadding ) ;
447
+ console . debug ( ` content, addScrollPadding, newPadding: ${ newPadding } , this._scrollPadding: ${ this . _scrollPadding } ` ) ;
447
448
448
449
this . _scrollPadding = newPadding ;
449
450
this . _scrollEle . style . paddingBottom = ( newPadding > 0 ) ? newPadding + 'px' : '' ;
@@ -456,13 +457,15 @@ export class Content extends Ion {
456
457
*/
457
458
clearScrollPaddingFocusOut ( ) {
458
459
if ( ! this . _inputPolling ) {
460
+ console . debug ( `content, clearScrollPaddingFocusOut begin` ) ;
459
461
this . _inputPolling = true ;
460
462
461
463
this . _keyboard . onClose ( ( ) => {
464
+ console . debug ( `content, clearScrollPaddingFocusOut _keyboard.onClose` ) ;
462
465
this . _inputPolling = false ;
463
466
this . _scrollPadding = - 1 ;
464
467
this . addScrollPadding ( 0 ) ;
465
- } , 200 , Infinity ) ;
468
+ } , 200 , 3000 ) ;
466
469
}
467
470
}
468
471
@@ -641,3 +644,18 @@ function parsePxUnit(val: string): number {
641
644
function cssFormat ( val : number ) : string {
642
645
return ( val > 0 ? val + 'px' : '' ) ;
643
646
}
647
+
648
+ export interface ContentDimensions {
649
+ contentHeight : number ;
650
+ contentTop : number ;
651
+ contentBottom : number ;
652
+
653
+ contentWidth : number ;
654
+ contentLeft : number ;
655
+
656
+ scrollHeight : number ;
657
+ scrollTop : number ;
658
+
659
+ scrollWidth : number ;
660
+ scrollLeft : number ;
661
+ }
0 commit comments