         let childFrame = CGRect(x: frame.size.width * scaledX, y: 0, width: frame.size.width * scaledWidth, height: frame.size.height)
         image.frame = childFrame
         highlightedImage.frame = childFrame
-        clipping.frame = CGRect(x: 0, y: 0, width: self.frame.size.width * scaledProgressWidth, height: self.frame.size.height)
-        clipping.isHidden = self.progressSamples <= self.zoomStartSamples
+        clipping.frame = CGRect(x: 0, y: 0, width: frame.size.width * scaledProgressWidth, height: frame.size.height)
+        clipping.isHidden = progressSamples <= zoomStartSamples
         print("\(frame) -- \(image.frame)")
     }
 

        addSubview(clipping)
        clipsToBounds = true

        self.setupGestureRecognizers()
        self.addGestureRecognizer(self.tapRecognizer)
    }

    fileprivate func setupGestureRecognizers() {
        //TODO: try to do this in the lazy initializer above
        self.pinchRecognizer = UIPinchGestureRecognizer(target: self, action: #selector(self.handlePinchGesture))
        self.pinchRecognizer.delegate = self
        self.addGestureRecognizer(self.pinchRecognizer)
        self.panRecognizer = UIPanGestureRecognizer(target: self, action: #selector(self.handlePanGesture))
        self.panRecognizer.delegate = self
        self.addGestureRecognizer(self.panRecognizer)
        self.tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.handleTapGesture))
    }

    required public init?(coder aCoder: NSCoder) {
        super.init(coder: aCoder)
        self.setup()
    }

    override init(frame rect: CGRect) {
        super.init(frame: rect)
        self.setup()
    }

    /// If the cached image is insufficient for the current frame


            self.assetTrack = assetTrack
            loadingInProgress = true
            delegate?.waveformViewWillLoad?(self)
            asset.loadValuesAsynchronously(forKeys: ["duration"]) {
                var error: NSError? = nil
                let status = self.asset!.statusOfValue(forKey: "duration", error: &error)
