         var cellRect = CGRect.zero
         var shapeLayerWidth: CGFloat = 0
         
-        if let collectionView = segmentioCollectionView, selectedSegmentioIndex != -1 {
+        if let collectionView = segmentioCollectionView, selectedSegmentioIndex != -1,
+            let cellAttributes = collectionView.layoutAttributesForItem(at: IndexPath(row: selectedSegmentioIndex, section: 0)) {
+            cellWidth = segmentWidth(for: IndexPath(row: selectedSegmentioIndex, section: 0))
             collectionViewWidth = collectionView.frame.width
-            cellWidth = segmentWidth(for: IndexPath(row: selectedSegmentioIndex, section: 0))
-            var x: CGFloat = 0
             
-            switch segmentioOptions.segmentPosition {
-            case .fixed:
-                x = floor(CGFloat(selectedSegmentioIndex) * cellWidth - collectionView.contentOffset.x)
-                
-            case .dynamic:
-                for i in 0..<selectedSegmentioIndex {
-                    x += segmentWidth(for: IndexPath(item: i, section: 0))
-                }
-                
-                x -= collectionView.contentOffset.x
-            }
-            
+            let cellFrameInSuperview = collectionView.convert(cellAttributes.frame, to: collectionView.superview)
             cellRect = CGRect(
-                x: x,
+                x: cellFrameInSuperview.minX,
                 y: 0,
                 width: cellWidth,
                 height: collectionView.frame.height

                allItemsCellWidth: itemWitdh,
                pointY: bounds.midY,
                position: segmentioOptions.segmentPosition,
                style: segmentioStyle
            )
            
            moveShapeLayer(

        let itemWitdh = segmentioItems.enumerated().map { (index, _) -> CGFloat in
            return segmentWidth(for: IndexPath(item: index, section: 0))
        }
        
        var isRTL = false
        if #available(iOS 9.0, *) {
            isRTL = UIView.userInterfaceLayoutDirection(for: semanticContentAttribute) == .rightToLeft
        } else {
            // Use the previous technique
            isRTL = UIApplication.shared.userInterfaceLayoutDirection == .rightToLeft
        }
        
        if let indicatorLayer = indicatorLayer, let options = segmentioOptions.indicatorOptions {
            let item = itemInSuperview(ratio: options.ratio)

