Added inspectable/designable tags to the MathUILabel.

This commit is contained in:
Michael Griebling
2023-01-16 08:18:04 -05:00
parent 467be71ce4
commit fd09540d11

View File

@@ -47,6 +47,7 @@ public enum MTTextAlignment : UInt {
When created it uses `[MTFontManager defaultFont]` as its font. This can be changed using When created it uses `[MTFontManager defaultFont]` as its font. This can be changed using
the `font` parameter. the `font` parameter.
*/ */
@IBDesignable
class MTMathUILabel : MTView { class MTMathUILabel : MTView {
/** The `MTMathList` to render. Setting this will remove any /** The `MTMathList` to render. Setting this will remove any
@@ -68,6 +69,7 @@ class MTMathUILabel : MTView {
has been set. If latex has not been set, this will return the latex output for the has been set. If latex has not been set, this will return the latex output for the
`mathList` that is set. `mathList` that is set.
@see error */ @see error */
@IBInspectable
var latex = "" { var latex = "" {
didSet { didSet {
self.error = nil self.error = nil
@@ -102,6 +104,7 @@ class MTMathUILabel : MTView {
} }
/** Convenience method to just set the size of the font without changing the fontface. */ /** Convenience method to just set the size of the font without changing the fontface. */
@IBInspectable
var fontSize = MTFontManager.fontManager.kDefaultFontSize { var fontSize = MTFontManager.fontManager.kDefaultFontSize {
didSet { didSet {
self.font = font?.copy(withSize: fontSize) self.font = font?.copy(withSize: fontSize)
@@ -109,6 +112,7 @@ class MTMathUILabel : MTView {
} }
/** This sets the text color of the rendered math formula. The default color is black. */ /** This sets the text color of the rendered math formula. The default color is black. */
@IBInspectable
var textColor:MTColor? = MTColor.black { var textColor:MTColor? = MTColor.black {
didSet { didSet {
self.displayList?.textColor = textColor self.displayList?.textColor = textColor
@@ -120,6 +124,7 @@ class MTMathUILabel : MTView {
`UIEdgeInsetsZero` by default. This is useful if you need some padding between the math and `UIEdgeInsetsZero` by default. This is useful if you need some padding between the math and
the border/background color. sizeThatFits: will have its returned size increased by these insets. the border/background color. sizeThatFits: will have its returned size increased by these insets.
*/ */
@IBInspectable
var contentInsets = MTEdgeInsetsZero { var contentInsets = MTEdgeInsetsZero {
didSet { didSet {
self.invalidateIntrinsicContentSize() self.invalidateIntrinsicContentSize()