         if _value < maxRate {
             if (needsClip) {
                 context.saveGState();
-                context.clip(to: CGRect(x: boundaryX, y: 0, width: allSize.width - spacing - boundaryX, height: starSize.height))
+                context.clip(to: CGRect(x: boundaryX, y: 0, width: _allSize.width - spacing - boundaryX, height: starSize.height))
             }
             for i in (boundaryIndex..<maxRate) {
                 zeroImage.draw(at: CGPoint(x: xOrigin(atIndex: i), y: 0))


    public override func updateConstraints() {
        translatesAutoresizingMaskIntoConstraints = false
        widthAnchor.constraint(equalToConstant: fullImage!.size.width).isActive = true
        heightAnchor.constraint(equalToConstant: fullImage!.size.height).isActive = true
        super.updateConstraints()
    }


import UIKit

public class RateCoreGraphicView: UIView {

    private var _value: RatePoint = .zero {
        didSet {
            setNeedsDisplay()
        }
    }
    private var _allSize: CGSize = .zero

    // MARK: Outlets
    @IBInspectable public var fullImage: UIImage?
    @IBInspectable public var zeroImage: UIImage?
    @IBInspectable public var spacing: CGFloat = 0
