Skip to content

Commit c1869c4

Browse files
committed
Add toDictionaryProp method for AAButtonTheme
1 parent f9eee4e commit c1869c4

File tree

3 files changed

+44
-3
lines changed

3 files changed

+44
-3
lines changed

AAInfographics/AAOptionsModel/AAButtonTheme.swift

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,47 @@ public class AAButtonTheme: AAObject {
181181
return self
182182
}
183183

184+
/*
185+
public func toDictionaryProp() -> [String: Any]? {
186+
var dic = [String: Any]()
187+
if let fill = fill {
188+
dic["fill"] = fill
189+
}
190+
if let stroke = stroke {
191+
dic["stroke"] = stroke
192+
}
193+
if let strokeWidth = strokeWidth {
194+
dic["stroke-width"] = strokeWidth
195+
}
196+
return dic
197+
}
198+
*/
199+
public func toDictionaryProp() -> [String: Any]? {
200+
var dic = [String: Any]()
201+
if let fill = fill {
202+
dic["fill"] = fill
203+
}
204+
if let padding = padding {
205+
dic["padding"] = padding
206+
}
207+
if let r = r {
208+
dic["r"] = r
209+
}
210+
if let states = states {
211+
dic["states"] = states.toDic() as Any
212+
}
213+
if let stroke = stroke {
214+
dic["stroke"] = stroke
215+
}
216+
if let strokeWidth = strokeWidth {
217+
dic["stroke-width"] = strokeWidth
218+
}
219+
if let style = style {
220+
dic["style"] = style.toDic() as Any
221+
}
222+
return dic
223+
}
224+
184225
public override init() {
185226

186227
}

AAInfographics/AAOptionsModel/AAChart.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ public class AAMouseWheel: AAObject {
449449
public class AAResetButton: AAObject {
450450
public var position: AAPosition?
451451
public var relativeTo: String?
452-
public var theme: AAButtonTheme?
452+
public var theme: [String: Any]?
453453

454454
@discardableResult
455455
public func position(_ prop: AAPosition?) -> AAResetButton {
@@ -465,7 +465,7 @@ public class AAResetButton: AAObject {
465465

466466
@discardableResult
467467
public func theme(_ prop: AAButtonTheme?) -> AAResetButton {
468-
theme = prop
468+
theme = prop?.toDictionaryProp()
469469
return self
470470
}
471471

AAInfographicsDemo/Demo/AdditionalContent2/AABaseChartVC.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ class AABaseChartVC: UIViewController {
261261
.theme(AAButtonTheme()
262262
.fill(AAColor.yellow)
263263
.stroke(AAColor.green)
264-
// .strokeWidth(6)
264+
.strokeWidth(3)
265265
.r(3)
266266
.states(AAButtonThemeStates()
267267
.hover(AAButtonThemeStatesHover()

0 commit comments

Comments
 (0)