Skip to content

Commit

Permalink
add guard
Browse files Browse the repository at this point in the history
  • Loading branch information
Russell Stephens committed Nov 6, 2017
1 parent 5037034 commit 83ed464
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Source/Charts/Components/MarkerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ open class MarkerView: NSUIView, IMarker

open func offsetForDrawing(atPoint point: CGPoint) -> CGPoint
{
var offset = self.offset
guard let chart = chartView else { return self.offset }

let chart = self.chartView
var offset = self.offset

let width = self.bounds.size.width
let height = self.bounds.size.height
Expand All @@ -36,7 +36,7 @@ open class MarkerView: NSUIView, IMarker
{
offset.x = -point.x
}
else if let chart = chart, point.x + width + offset.x > chart.bounds.size.width
else if point.x + width + offset.x > chart.bounds.size.width
{
offset.x = chart.bounds.size.width - point.x - width
}
Expand All @@ -45,7 +45,7 @@ open class MarkerView: NSUIView, IMarker
{
offset.y = -point.y
}
else if let chart = chart, point.y + height + offset.y > chart.bounds.size.height
else if point.y + height + offset.y > chart.bounds.size.height
{
offset.y = chart.bounds.size.height - point.y - height
}
Expand Down

0 comments on commit 83ed464

Please sign in to comment.