@@ -171,45 +171,72 @@ export class Content extends Ion implements OnDestroy, OnInit {
171
171
/** @private */
172
172
statusbarPadding : boolean ;
173
173
174
+ /**
175
+ * Content height of the viewable area. This does not include content
176
+ * which is outside the overflow area, or content area which is under
177
+ * headers and footers. Read-only.
178
+ *
179
+ * @return {number }
180
+ */
181
+ get contentHeight ( ) : number {
182
+ return this . _scroll . ev . contentHeight ;
183
+ }
184
+
185
+ /**
186
+ * Content width including content which is not visible on the screen
187
+ * due to overflow. Read-only.
188
+ *
189
+ * @return {number }
190
+ */
191
+ get contentWidth ( ) : number {
192
+ return this . _scroll . ev . contentWidth ;
193
+ }
194
+
174
195
/**
175
196
* A number representing how many pixels the top of the content has been
176
- * adjusted, which could be by either padding or margin.
197
+ * adjusted, which could be by either padding or margin. This adjustment
198
+ * is to account for the space needed for the header.
177
199
*
178
200
* @return {number }
179
201
*/
180
202
contentTop : number ;
181
203
182
204
/**
183
205
* A number representing how many pixels the bottom of the content has been
184
- * adjusted, which could be by either padding or margin.
206
+ * adjusted, which could be by either padding or margin. This adjustment
207
+ * is to account for the space needed for the footer.
185
208
*
186
209
* @return {number }
187
210
*/
188
211
contentBottom : number ;
189
212
190
213
/**
191
- * The height the content, including content not visible
192
- * on the screen due to overflow.
214
+ * Content height including content which is not visible on the screen
215
+ * due to overflow. Read-only .
193
216
*
194
217
* @return {number }
195
218
*/
196
- scrollHeight : number = 0 ;
219
+ get scrollHeight ( ) : number {
220
+ return this . _scroll . ev . scrollHeight ;
221
+ }
197
222
198
223
/**
199
- * The width the content, including content not visible
200
- * on the screen due to overflow.
224
+ * Content width including content which is not visible due to
225
+ * overflow. Read-only .
201
226
*
202
227
* @return {number }
203
228
*/
204
- scrollWidth : number = 0 ;
229
+ get scrollWidth ( ) : number {
230
+ return this . _scroll . ev . scrollWidth ;
231
+ }
205
232
206
233
/**
207
234
* The distance of the content's top to its topmost visible content.
208
235
*
209
236
* @return {number }
210
237
*/
211
238
get scrollTop ( ) : number {
212
- return this . _scroll . getTop ( ) ;
239
+ return this . _scroll . ev . scrollTop ;
213
240
}
214
241
set scrollTop ( top : number ) {
215
242
this . _scroll . setTop ( top ) ;
@@ -221,14 +248,14 @@ export class Content extends Ion implements OnDestroy, OnInit {
221
248
* @return {number }
222
249
*/
223
250
get scrollLeft ( ) : number {
224
- return this . _scroll . getLeft ( ) ;
251
+ return this . _scroll . ev . scrollLeft ;
225
252
}
226
253
set scrollLeft ( top : number ) {
227
254
this . _scroll . setLeft ( top ) ;
228
255
}
229
256
230
257
/**
231
- * If the scrollable area is actively scrolling or not.
258
+ * If the content is actively scrolling or not.
232
259
*
233
260
* @return {boolean }
234
261
*/
@@ -255,7 +282,8 @@ export class Content extends Ion implements OnDestroy, OnInit {
255
282
}
256
283
257
284
/**
258
- * The current, or last known, vertical scroll direction.
285
+ * The current, or last known, vertical scroll direction. Possible
286
+ * string values include `down` and `up`.
259
287
*
260
288
* @return {string }
261
289
*/
@@ -264,7 +292,8 @@ export class Content extends Ion implements OnDestroy, OnInit {
264
292
}
265
293
266
294
/**
267
- * The current, or last known, horizontal scroll direction.
295
+ * The current, or last known, horizontal scroll direction. Possible
296
+ * string values include `right` and `left`.
268
297
*
269
298
* @return {string }
270
299
*/
@@ -564,9 +593,6 @@ export class Content extends Ion implements OnDestroy, OnInit {
564
593
let cacheFooterHeight = this . _ftrHeight ;
565
594
let cacheTabsPlacement = this . _tabsPlacement ;
566
595
let tabsTop = 0 ;
567
-
568
- this . scrollWidth = 0 ;
569
- this . scrollHeight = 0 ;
570
596
this . _pTop = 0 ;
571
597
this . _pRight = 0 ;
572
598
this . _pBottom = 0 ;
@@ -596,11 +622,6 @@ export class Content extends Ion implements OnDestroy, OnInit {
596
622
if ( tagName === 'ION-CONTENT' ) {
597
623
scrollEvent . contentElement = ele ;
598
624
599
- // ******** DOM READ ****************
600
- this . scrollWidth = ele . scrollWidth ;
601
- // ******** DOM READ ****************
602
- this . scrollHeight = ele . scrollHeight ;
603
-
604
625
if ( this . _fullscreen ) {
605
626
// ******** DOM READ ****************
606
627
computedStyle = getComputedStyle ( ele ) ;
@@ -672,6 +693,15 @@ export class Content extends Ion implements OnDestroy, OnInit {
672
693
this . _cBottom += this . _pBottom ;
673
694
}
674
695
696
+ // ******** DOM READ ****************
697
+ const contentDimensions = this . getContentDimensions ( ) ;
698
+ scrollEvent . scrollHeight = contentDimensions . scrollHeight ;
699
+ scrollEvent . scrollWidth = contentDimensions . scrollWidth ;
700
+ scrollEvent . contentHeight = contentDimensions . contentHeight ;
701
+ scrollEvent . contentWidth = contentDimensions . contentWidth ;
702
+ scrollEvent . contentTop = contentDimensions . contentTop ;
703
+ scrollEvent . contentBottom = contentDimensions . contentBottom ;
704
+
675
705
this . _dirty = (
676
706
cachePaddingTop !== this . _pTop ||
677
707
cachePaddingBottom !== this . _pBottom ||
0 commit comments