bm-core-ui 2.10.1 → 2.10.3

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.
@@ -5879,15 +5879,19 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
5879
5879
  }
5880
5880
 
5881
5881
  // Then the horizontal X offset
5882
- if (options.withVerticalGravity == BMCollectionViewScrollingGravityHorizontal.Left) {
5882
+ if (options.horizontalGravity == BMCollectionViewScrollingGravityHorizontal.Left) {
5883
5883
  offset.x = rect.origin.x;
5884
5884
  }
5885
- else if (options.withVerticalGravity == BMCollectionViewScrollingGravityHorizontal.Center) {
5885
+ else if (options.horizontalGravity == BMCollectionViewScrollingGravityHorizontal.Center) {
5886
5886
  offset.x = rect.origin.x + rect.size.width / 2 - this.frame.size.width / 2;
5887
5887
  }
5888
- else if (options.withVerticalGravity == BMCollectionViewScrollingGravityHorizontal.Right) {
5888
+ else if (options.horizontalGravity == BMCollectionViewScrollingGravityHorizontal.Right) {
5889
5889
  offset.x = rect.origin.x + rect.size.width - this.frame.size.width;
5890
5890
  }
5891
+
5892
+ // Make sure the offset doesn't exceed the available area
5893
+ offset.y = Math.min(Math.max(0, offset.y), this._size.height - this.frame.size.height);
5894
+ offset.x = Math.min(Math.max(0, offset.x), this._size.width - this.frame.size.width);
5891
5895
 
5892
5896
  // Scroll to the offset point
5893
5897
  if (options.animated) {