fixed bugs in label

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-07-21 16:06:44 -05:00
parent e8a7fb7246
commit adbb858fa4
2 changed files with 9 additions and 16 deletions

View File

@ -82,11 +82,4 @@ public class NumericField: TextField {
guard let text, let foundNumber = NumberFormatter().number(from: text) else { return nil }
return foundNumber
}
public var numberPublisher: AnyPublisher<NSNumber?, Never> {
publisher(for: .editingChanged)
.map { _ in self.number ?? nil }
.eraseToAnyPublisher()
}
}

View File

@ -31,8 +31,7 @@ class LabelViewController: BaseViewController<Label> {
//testing only remove later
//------------------------------------
var pointSizeRange = Slider().with {
$0.maximumValue = 500
$0.minimumValue = 0
$0.minimumValue = 5
$0.value = 0
}
var lineheightRange = Slider()
@ -55,11 +54,12 @@ class LabelViewController: BaseViewController<Label> {
#warning("testing only remove later")
//--------------------------------------------------------------
let lineheight = component.useScaledFont ? currentStyle.scaledLineHeight : currentStyle.lineHeight
let lineheightText = component.useScaledFont ? "\(baseStyle.lineHeight.rounded())\nscaled: \(currentStyle.scaledLineHeight)" : "\(baseStyle.lineHeight.rounded())"
let lineheightText = component.useScaledFont ? "\(baseStyle.lineHeight.rounded()) sc\(currentStyle.scaledLineHeight)" : "\(baseStyle.lineHeight.rounded())"
pointSizeRange.value = Float(currentStyle.pointSize)
pointSizeRange.maximumValue = Float(baseStyle.pointSize * 1.50)
lineheightRange.value = Float(lineheight)
lineheightRange.maximumValue = Float(lineheightRange.value * 1.50)
lineheightRange.maximumValue = Float((component.useScaledFont ? baseStyle.scaledLineHeight : lineheight) * 1.50)
lineheightRange.minimumValue = 1
topInsetRange.value = Float(currentStyle.edgeInsets.top)
@ -213,7 +213,6 @@ class LabelViewController: BaseViewController<Label> {
func setupModel() {
component.text = "Helg¹ worldg Hell¹ worldg"
component.textStyle = .featureXLarge
//setup UI
surfacePickerSelectorView.text = component.surface.rawValue
@ -222,10 +221,11 @@ class LabelViewController: BaseViewController<Label> {
textField.text = component.text
//set the font
component.textStyle = .featureMedium
fontCategory = .feature
fontCategoryPickerSelectorView.text = "Feature"
textSize = .xlarge
textSizePickerSelectorView.text = "XLarge"
fontCategoryPickerSelectorView.text = fontCategory.rawValue.capitalized
textSize = .medium
textSizePickerSelectorView.text = textSize!.rawValue.capitalized
updateLabelStyle()
}
@ -249,7 +249,7 @@ class LabelViewController: BaseViewController<Label> {
}
}
private var textSize: TextStyle.FontSize? = .large {
private var textSize: TextStyle.FontSize? = .medium {
didSet {
textSizePickerSelectorView.text = textSize?.rawValue ?? ""
updateLabelStyle()