fixed bugs in label
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
e8a7fb7246
commit
adbb858fa4
@ -82,11 +82,4 @@ public class NumericField: TextField {
|
|||||||
guard let text, let foundNumber = NumberFormatter().number(from: text) else { return nil }
|
guard let text, let foundNumber = NumberFormatter().number(from: text) else { return nil }
|
||||||
return foundNumber
|
return foundNumber
|
||||||
}
|
}
|
||||||
|
|
||||||
public var numberPublisher: AnyPublisher<NSNumber?, Never> {
|
|
||||||
publisher(for: .editingChanged)
|
|
||||||
.map { _ in self.number ?? nil }
|
|
||||||
.eraseToAnyPublisher()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,8 +31,7 @@ class LabelViewController: BaseViewController<Label> {
|
|||||||
//testing only remove later
|
//testing only remove later
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
var pointSizeRange = Slider().with {
|
var pointSizeRange = Slider().with {
|
||||||
$0.maximumValue = 500
|
$0.minimumValue = 5
|
||||||
$0.minimumValue = 0
|
|
||||||
$0.value = 0
|
$0.value = 0
|
||||||
}
|
}
|
||||||
var lineheightRange = Slider()
|
var lineheightRange = Slider()
|
||||||
@ -55,11 +54,12 @@ class LabelViewController: BaseViewController<Label> {
|
|||||||
#warning("testing only remove later")
|
#warning("testing only remove later")
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
let lineheight = component.useScaledFont ? currentStyle.scaledLineHeight : currentStyle.lineHeight
|
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.value = Float(currentStyle.pointSize)
|
||||||
|
pointSizeRange.maximumValue = Float(baseStyle.pointSize * 1.50)
|
||||||
lineheightRange.value = Float(lineheight)
|
lineheightRange.value = Float(lineheight)
|
||||||
lineheightRange.maximumValue = Float(lineheightRange.value * 1.50)
|
lineheightRange.maximumValue = Float((component.useScaledFont ? baseStyle.scaledLineHeight : lineheight) * 1.50)
|
||||||
lineheightRange.minimumValue = 1
|
lineheightRange.minimumValue = 1
|
||||||
|
|
||||||
topInsetRange.value = Float(currentStyle.edgeInsets.top)
|
topInsetRange.value = Float(currentStyle.edgeInsets.top)
|
||||||
@ -213,7 +213,6 @@ class LabelViewController: BaseViewController<Label> {
|
|||||||
|
|
||||||
func setupModel() {
|
func setupModel() {
|
||||||
component.text = "Helg¹ worldg Hell¹ worldg"
|
component.text = "Helg¹ worldg Hell¹ worldg"
|
||||||
component.textStyle = .featureXLarge
|
|
||||||
|
|
||||||
//setup UI
|
//setup UI
|
||||||
surfacePickerSelectorView.text = component.surface.rawValue
|
surfacePickerSelectorView.text = component.surface.rawValue
|
||||||
@ -222,10 +221,11 @@ class LabelViewController: BaseViewController<Label> {
|
|||||||
textField.text = component.text
|
textField.text = component.text
|
||||||
|
|
||||||
//set the font
|
//set the font
|
||||||
|
component.textStyle = .featureMedium
|
||||||
fontCategory = .feature
|
fontCategory = .feature
|
||||||
fontCategoryPickerSelectorView.text = "Feature"
|
fontCategoryPickerSelectorView.text = fontCategory.rawValue.capitalized
|
||||||
textSize = .xlarge
|
textSize = .medium
|
||||||
textSizePickerSelectorView.text = "XLarge"
|
textSizePickerSelectorView.text = textSize!.rawValue.capitalized
|
||||||
updateLabelStyle()
|
updateLabelStyle()
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -249,7 +249,7 @@ class LabelViewController: BaseViewController<Label> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private var textSize: TextStyle.FontSize? = .large {
|
private var textSize: TextStyle.FontSize? = .medium {
|
||||||
didSet {
|
didSet {
|
||||||
textSizePickerSelectorView.text = textSize?.rawValue ?? ""
|
textSizePickerSelectorView.text = textSize?.rawValue ?? ""
|
||||||
updateLabelStyle()
|
updateLabelStyle()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user