mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-07 09:20:08 +00:00
Various Fixes
This commit is contained in:
parent
46dccd85f6
commit
c769c4dd74
@ -1073,7 +1073,6 @@ public class TextNode: ASDisplayNode {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// brokenLineRange.length = CTLineGetGlyphCount(coreTextLine) - 1
|
|
||||||
if brokenLineRange.location + brokenLineRange.length > attributedString.length {
|
if brokenLineRange.location + brokenLineRange.length > attributedString.length {
|
||||||
brokenLineRange.length = attributedString.length - brokenLineRange.location
|
brokenLineRange.length = attributedString.length - brokenLineRange.location
|
||||||
}
|
}
|
||||||
@ -1338,7 +1337,7 @@ public class TextNode: ASDisplayNode {
|
|||||||
context.saveGState()
|
context.saveGState()
|
||||||
var clipRects: [CGRect] = []
|
var clipRects: [CGRect] = []
|
||||||
for spoiler in line.spoilerWords {
|
for spoiler in line.spoilerWords {
|
||||||
var spoilerClipRect = spoiler.frame.offsetBy(dx: lineFrame.minX, dy: lineFrame.minY)
|
var spoilerClipRect = spoiler.frame.offsetBy(dx: lineFrame.minX, dy: lineFrame.minY - UIScreenPixel)
|
||||||
spoilerClipRect.size.height += 1.0 + UIScreenPixel
|
spoilerClipRect.size.height += 1.0 + UIScreenPixel
|
||||||
clipRects.append(spoilerClipRect)
|
clipRects.append(spoilerClipRect)
|
||||||
}
|
}
|
||||||
@ -1375,7 +1374,7 @@ public class TextNode: ASDisplayNode {
|
|||||||
context.restoreGState()
|
context.restoreGState()
|
||||||
} else {
|
} else {
|
||||||
for spoiler in line.spoilerWords {
|
for spoiler in line.spoilerWords {
|
||||||
var spoilerClearRect = spoiler.frame.offsetBy(dx: lineFrame.minX, dy: lineFrame.minY)
|
var spoilerClearRect = spoiler.frame.offsetBy(dx: lineFrame.minX, dy: lineFrame.minY - UIScreenPixel)
|
||||||
spoilerClearRect.size.height += 1.0 + UIScreenPixel
|
spoilerClearRect.size.height += 1.0 + UIScreenPixel
|
||||||
clearRects.append(spoilerClearRect)
|
clearRects.append(spoilerClearRect)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -122,7 +122,6 @@ public class InvisibleInkDustNode: ASDisplayNode {
|
|||||||
emitterLayer.emitterSize = CGSize(width: 1, height: 1)
|
emitterLayer.emitterSize = CGSize(width: 1, height: 1)
|
||||||
emitterLayer.emitterShape = CAEmitterLayerEmitterShape(rawValue: "rectangles")
|
emitterLayer.emitterShape = CAEmitterLayerEmitterShape(rawValue: "rectangles")
|
||||||
emitterLayer.setValue(behaviors, forKey: "emitterBehaviors")
|
emitterLayer.setValue(behaviors, forKey: "emitterBehaviors")
|
||||||
// emitterLayer.setValue(0.0322, forKey: "updateInterval")
|
|
||||||
|
|
||||||
emitterLayer.setValue(4.0, forKeyPath: "emitterBehaviors.fingerAttractor.stiffness")
|
emitterLayer.setValue(4.0, forKeyPath: "emitterBehaviors.fingerAttractor.stiffness")
|
||||||
emitterLayer.setValue(false, forKeyPath: "emitterBehaviors.fingerAttractor.enabled")
|
emitterLayer.setValue(false, forKeyPath: "emitterBehaviors.fingerAttractor.enabled")
|
||||||
@ -188,7 +187,7 @@ public class InvisibleInkDustNode: ASDisplayNode {
|
|||||||
|
|
||||||
var scaleAddition = maxFactor * 4.0
|
var scaleAddition = maxFactor * 4.0
|
||||||
var durationAddition = -maxFactor * 0.2
|
var durationAddition = -maxFactor * 0.2
|
||||||
if self.emitterNode.frame.height > 0.0, self.emitterNode.frame.width / self.emitterNode.frame.height < 0.3 {
|
if self.emitterNode.frame.height > 0.0, self.emitterNode.frame.width / self.emitterNode.frame.height < 0.7 {
|
||||||
scaleAddition *= 5.0
|
scaleAddition *= 5.0
|
||||||
durationAddition *= 2.0
|
durationAddition *= 2.0
|
||||||
}
|
}
|
||||||
|
|||||||
@ -252,18 +252,23 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
|
|||||||
}
|
}
|
||||||
|
|
||||||
let string = textWithRanges._tuple.0
|
let string = textWithRanges._tuple.0
|
||||||
let stringLength = (clippedText as NSString).length
|
let stringLength = (string as NSString).length
|
||||||
|
let messageLength = (clippedText as NSString).length
|
||||||
var ranges = textWithRanges._tuple.1
|
var ranges = textWithRanges._tuple.1
|
||||||
let entityOffset = ranges.first(where: { $0.0 == 1 })?.1.location ?? 0
|
let entityOffset = ranges.first(where: { $0.0 == 1 })?.1.location ?? 0
|
||||||
var attributes = peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: [(0, message.author?.id)])
|
var attributes = peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: [(0, message.author?.id)])
|
||||||
for entity in entities {
|
for entity in entities {
|
||||||
if entity.range.startIndex >= stringLength {
|
if entity.range.startIndex >= messageLength {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
let location = entityOffset + entity.range.startIndex
|
||||||
|
let length = max(0, min(entity.range.count, stringLength - location - 1))
|
||||||
|
if length > 0 {
|
||||||
let index = ranges.count
|
let index = ranges.count
|
||||||
ranges.append((ranges.count, NSRange(location: entityOffset + entity.range.startIndex, length: entity.range.count)))
|
ranges.append((ranges.count, NSRange(location: location, length: length)))
|
||||||
attributes[index] = spoilerAttributes(primaryTextColor: primaryTextColor)
|
attributes[index] = spoilerAttributes(primaryTextColor: primaryTextColor)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
attributedString = addAttributesToStringWithRanges((string, ranges), body: bodyAttributes, argumentAttributes: attributes)
|
attributedString = addAttributesToStringWithRanges((string, ranges), body: bodyAttributes, argumentAttributes: attributes)
|
||||||
case .game:
|
case .game:
|
||||||
attributedString = addAttributesToStringWithRanges(strings.Message_AuthorPinnedGame(authorName)._tuple, body: bodyAttributes, argumentAttributes: peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: [(0, message.author?.id)]))
|
attributedString = addAttributesToStringWithRanges(strings.Message_AuthorPinnedGame(authorName)._tuple, body: bodyAttributes, argumentAttributes: peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: [(0, message.author?.id)]))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user