Merge branch 'bugfix/graphview' into 'develop'

Bugfix/graphview

See merge request BPHV_MIPS/mvm_core_ui!233
This commit is contained in:
Pan, Xinlei (Ryan) 2020-01-27 10:05:01 -05:00
commit 0438f02a08

View File

@ -95,7 +95,7 @@ import UIKit
//create graident layers //create graident layers
guard graphObject.colors.count > 1 else { guard graphObject.colors.count > 1 else {
containLayer.backgroundColor = graphObject.colors.first?.uiColor.cgColor containLayer.backgroundColor = graphObject.colors.first?.cgColor
return containLayer return containLayer
} }
var topGradientHeight : CGFloat = 0.0 var topGradientHeight : CGFloat = 0.0
@ -112,11 +112,11 @@ import UIKit
//if number of colors is even, need to display gradient layer, otherwise make top layer as solid color layer //if number of colors is even, need to display gradient layer, otherwise make top layer as solid color layer
if graphObject.colors.count % 2 == 0 { if graphObject.colors.count % 2 == 0 {
leftColors.removeLast() leftColors.removeLast()
let firstColor = leftColors.last!.uiColor.cgColor let firstColor = leftColors.last!.cgColor
let secondColor = rightColors.first!.uiColor.cgColor let secondColor = rightColors.first!.cgColor
topLayer.colors = [firstColor, secondColor] topLayer.colors = [firstColor, secondColor]
} else { } else {
topLayer.backgroundColor = leftColors.last?.uiColor.cgColor topLayer.backgroundColor = leftColors.last?.cgColor
} }
containLayer.addSublayer(topLayer) containLayer.addSublayer(topLayer)
@ -128,10 +128,10 @@ import UIKit
//count of graidentLayer.colors must be bigger than 1, otherwise set backgroundColor //count of graidentLayer.colors must be bigger than 1, otherwise set backgroundColor
if leftColors.count > 1 { if leftColors.count > 1 {
leftLayer.colors = leftColors.map({ (color) -> CGColor in leftLayer.colors = leftColors.map({ (color) -> CGColor in
return color.uiColor.cgColor return color.cgColor
}) })
} else { } else {
leftLayer.backgroundColor = leftColors.first?.uiColor.cgColor leftLayer.backgroundColor = leftColors.first?.cgColor
} }
containLayer.addSublayer(leftLayer) containLayer.addSublayer(leftLayer)
@ -141,10 +141,10 @@ import UIKit
rightLayer.endPoint = CGPoint(x: 0, y: 1) rightLayer.endPoint = CGPoint(x: 0, y: 1)
if rightColors.count > 1 { if rightColors.count > 1 {
rightLayer.colors = rightColors.map({ (color) -> CGColor in rightLayer.colors = rightColors.map({ (color) -> CGColor in
return color.uiColor.cgColor return color.cgColor
}) })
} else { } else {
rightLayer.backgroundColor = rightColors.first?.uiColor.cgColor rightLayer.backgroundColor = rightColors.first?.cgColor
} }
containLayer.addSublayer(rightLayer) containLayer.addSublayer(rightLayer)