Commit d69d693a by Orkhan Alikhanov

Using bounds.size instead of frame.size for placeholders

parent 9fae5e1f
......@@ -225,14 +225,15 @@ private extension Editor {
var h = placeholderLabel.sizeThatFits(CGSize(width: w, height: .greatestFiniteMagnitude)).height
h = min(h, bounds.height - inset.top - inset.bottom)
placeholderLabel.bounds.size = CGSize(width: w, height: h)
guard isEditing || !isEmpty || !isPlaceholderAnimated else {
placeholderLabel.transform = CGAffineTransform.identity
placeholderLabel.frame = CGRect(x: leftPadding, y: inset.top, width: w, height: h)
placeholderLabel.frame.origin = CGPoint(x: leftPadding, y: inset.top)
return
}
placeholderLabel.transform = CGAffineTransform(scaleX: placeholderActiveScale, y: placeholderActiveScale)
placeholderLabel.frame.size = CGSize(width: w * placeholderActiveScale, height: h * placeholderActiveScale)
placeholderLabel.frame.origin.y = -placeholderLabel.frame.height + placeholderVerticalOffset
switch placeholderLabel.textAlignment {
......
......@@ -582,14 +582,15 @@ fileprivate extension TextField {
var h = placeholderLabel.sizeThatFits(CGSize(width: w, height: .greatestFiniteMagnitude)).height
h = min(h, bounds.height - textInsets.top - textInsets.bottom)
placeholderLabel.bounds.size = CGSize(width: w, height: h)
guard isEditing || !isEmpty || !isPlaceholderAnimated else {
placeholderLabel.transform = CGAffineTransform.identity
placeholderLabel.frame = CGRect(x: leftPadding, y: textInsets.top, width: w, height: h)
placeholderLabel.frame.origin = CGPoint(x: leftPadding, y: textInsets.top)
return
}
placeholderLabel.transform = CGAffineTransform(scaleX: placeholderActiveScale, y: placeholderActiveScale)
placeholderLabel.frame.size = CGSize(width: w * placeholderActiveScale, height: h * placeholderActiveScale)
placeholderLabel.frame.origin.y = -placeholderLabel.frame.height + placeholderVerticalOffset
switch placeholderLabel.textAlignment {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment