Various fixes

This commit is contained in:
Ilya Laktyushin
2022-12-24 14:34:08 +04:00
parent e4d1ccac5f
commit 8f30bf0fb5
4 changed files with 10 additions and 17 deletions

View File

@@ -258,7 +258,7 @@ final class DrawingTextEntityView: DrawingEntityView, UITextViewDelegate {
self.textView.minimumZoomScale = 1.0
self.textView.maximumZoomScale = 1.0
self.textView.keyboardAppearance = .dark
self.textView.autocorrectionType = .default
self.textView.autocorrectionType = .no
self.textView.spellCheckingType = .no
super.init(context: context, entity: entity)

View File

@@ -996,7 +996,7 @@ private class DrawingSlice {
self.rect = rect
self.path = NSTemporaryDirectory() + "/drawing_\(uuid.hashValue).slice"
DrawingSlice.queue.async {
DrawingSlice.queue.after(2.0) {
let image = UIImage(cgImage: image)
if let data = image.pngData() as? NSData {
try? data.write(toFile: self.path)

View File

@@ -198,7 +198,7 @@ final class PenTool: DrawingElement {
let minRenderArrowLength = max(10.0, max(drawingSize.width, drawingSize.height) * 0.02)
self.renderLineWidth = lineWidth
self.renderMinLineWidth = isEraser || isBlur ? lineWidth : minLineWidth + (lineWidth - minLineWidth) * 0.3
self.renderMinLineWidth = isEraser || isBlur ? lineWidth : minLineWidth + (lineWidth - minLineWidth) * 0.2
self.renderArrowLength = max(minRenderArrowLength, lineWidth * 3.0)
self.renderArrowLineWidth = max(minLineWidth * 1.8, lineWidth * 0.75)
@@ -235,13 +235,7 @@ final class PenTool: DrawingElement {
return
}
let filterDistance: CGFloat
if point.velocity > 1200.0 {
filterDistance = 25.0
} else {
filterDistance = 15.0
}
let filterDistance: CGFloat = 20.0
if let previousPoint, point.location.distance(to: previousPoint) < filterDistance, state == .changed, self.segments.count > 1 {
return
}
@@ -252,14 +246,13 @@ final class PenTool: DrawingElement {
velocity = 1000.0
}
var effectiveRenderLineWidth = max(self.renderMinLineWidth, min(self.renderLineWidth - (velocity / 150.0), self.renderLineWidth))
var effectiveRenderLineWidth = max(self.renderMinLineWidth, min(self.renderLineWidth - (velocity / 100.0), self.renderLineWidth))
if let previousRenderLineWidth = self.previousRenderLineWidth {
effectiveRenderLineWidth = effectiveRenderLineWidth * 0.2 + previousRenderLineWidth * 0.8
}
self.previousRenderLineWidth = effectiveRenderLineWidth
let rect = append(point: Point(position: point.location, width: effectiveRenderLineWidth))
if let currentRenderView = self.currentRenderView as? RenderView, let rect = rect {
currentRenderView.draw(element: self, rect: rect)
}
@@ -461,7 +454,7 @@ final class PenTool: DrawingElement {
let segmentDistance: CGFloat = 6.0
let distance = midPoint1.distance(to: midPoint2)
let numberOfSegments = min(128, max(floor(distance / segmentDistance), 32))
let numberOfSegments = min(48, max(floor(distance / segmentDistance), 24))
let step = 1.0 / numberOfSegments
for t in stride(from: 0, to: 1, by: step) {

View File

@@ -1379,7 +1379,7 @@ private func editingItems(data: PeerInfoScreenData?, state: PeerInfoState, chatL
}))
let setText: String
if user.photo.first?.isPersonal == true {
if user.photo.first?.isPersonal == true || state.updatingAvatar != nil {
setText = presentationData.strings.UserInfo_ChangeCustomPhoto(compactName).string
} else {
setText = presentationData.strings.UserInfo_SetCustomPhoto(compactName).string
@@ -3117,7 +3117,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
let firstName = strongSelf.headerNode.editingContentNode.editingTextForKey(.firstName) ?? ""
let lastName = strongSelf.headerNode.editingContentNode.editingTextForKey(.lastName) ?? ""
if peer.firstName != firstName || peer.lastName != lastName {
if (peer.firstName ?? "") != firstName || (peer.lastName ?? "") != lastName {
if firstName.isEmpty && lastName.isEmpty {
if strongSelf.hapticFeedback == nil {
strongSelf.hapticFeedback = HapticFeedback()
@@ -7179,7 +7179,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
confirmationAction = nil
}
let mixin = TGMediaAvatarMenuMixin(context: legacyController.context, parentController: emptyController, hasSearchButton: true, hasDeleteButton: hasDeleteButton, hasViewButton: false, personalPhoto: strongSelf.isSettings, isVideo: currentIsVideo, saveEditedPhotos: false, saveCapturedMedia: false, signup: false, forum: isForum, title: title, isSuggesting: mode == .suggest)!
let mixin = TGMediaAvatarMenuMixin(context: legacyController.context, parentController: emptyController, hasSearchButton: true, hasDeleteButton: hasDeleteButton, hasViewButton: false, personalPhoto: strongSelf.isSettings, isVideo: currentIsVideo, saveEditedPhotos: false, saveCapturedMedia: false, signup: false, forum: isForum, title: title, isSuggesting: [.custom, .suggest].contains(mode))!
mixin.stickersContext = paintStickersContext
let _ = strongSelf.currentAvatarMixin.swap(mixin)
mixin.requestSearchController = { [weak self] assetsController in