From a31f3ae7b6ba2d3c61874a4413ba0db1437baf6b Mon Sep 17 00:00:00 2001 From: Michael Griebling Date: Wed, 18 Jan 2023 09:20:08 -0500 Subject: [PATCH] Another fix attempt. --- .../SwiftMathRender/MathRender/MTConfig.swift | 1 + .../MathRender/MTMathUILabel.swift | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Sources/SwiftMathRender/MathRender/MTConfig.swift b/Sources/SwiftMathRender/MathRender/MTConfig.swift index 85c698e..d3efa85 100644 --- a/Sources/SwiftMathRender/MathRender/MTConfig.swift +++ b/Sources/SwiftMathRender/MathRender/MTConfig.swift @@ -15,6 +15,7 @@ public typealias MTView = UIView public typealias MTColor = UIColor public typealias MTBezierPath = UIBezierPath public typealias MTLabel = UILabel +public typealias MTEdgeInsets = UIEdgeInsets public typealias MTRect = CGRect let MTEdgeInsetsZero = UIEdgeInsets.zero diff --git a/Sources/SwiftMathRender/MathRender/MTMathUILabel.swift b/Sources/SwiftMathRender/MathRender/MTMathUILabel.swift index 97da921..4da2b3f 100644 --- a/Sources/SwiftMathRender/MathRender/MTMathUILabel.swift +++ b/Sources/SwiftMathRender/MathRender/MTMathUILabel.swift @@ -238,13 +238,9 @@ public class MTMathUILabel : MTView { context.restoreGState() } - #if os(iOS) - override public func layoutSubviews() { _layoutSubviews() } - #endif - func _layoutSubviews() { - if mathList != nil { - _displayList = MTTypesetter.createLineForMathList(mathList, font: font, style: currentStyle) + if _mathList != nil { + _displayList = MTTypesetter.createLineForMathList(_mathList, font: font, style: currentStyle) _displayList!.textColor = textColor var textX = CGFloat(0) switch self.textAlignment { @@ -279,16 +275,20 @@ public class MTMathUILabel : MTView { return size } - override public var intrinsicContentSize: CGSize { _sizeThatFits(CGSizeZero) } + //override public var intrinsicContentSize: CGSize { _sizeThatFits(CGSizeZero) } - #if os(macOS) +#if os(macOS) func setNeedsDisplay() { self.needsDisplay = true } func setNeedsLayout() { self.needsLayout = true } + public override var fittingSize: CGSize { _sizeThatFits(CGSizeZero) } override public var isFlipped: Bool { false } override public func layout() { self._layoutSubviews() super.layout() } - #endif +#else + public override var intrinsicContentSize: CGSize { _sizeThatFits(CGSizeZero) } + override public func layoutSubviews() { _layoutSubviews() } +#endif }