Last active
December 18, 2020 20:45
-
-
Save jscalo/4f6c4ba40672abcedbb5316a42218c88 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private var firstSampleToPlotIdx: Int { | |
get { | |
let idx = Int(-viewPort.xTrans * viewPort.screenScale) | |
return (0..<dataProvider.summarySampleCnt).clamp(idx) | |
} | |
} | |
private var samplesToPlotInVisibleCnt: Int { | |
get { | |
return viewPort.visibleXAxisUnits | |
} | |
} | |
private func updatePlot() { | |
guard let samples = dataProvider.summarySamples else { | |
return | |
} | |
let endIdx = (0..<samples.count).clamp(firstSampleToPlotIdx+samplesToPlotInVisibleCnt) | |
let samplesToPlot = Array(samples[firstSampleToPlotIdx..<endIdx]) | |
layers.forEach() { | |
$0.isHidden = true | |
} | |
updateLines(samples: samplesToPlot, yMidline: bounds.height / 2) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment