mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Adjust label positioning
This commit is contained in:
parent
e5d2e90b1e
commit
07c09c3fb8
@ -391,6 +391,10 @@ final class PieChartComponent: Component {
|
||||
let intersectionOuterBottomRight = lineCircleIntersection(relLabelCenter, relLabelCenter, CGPoint(x: relLabelCenter.x + labelSize.width * 0.5, y: relLabelCenter.y - labelSize.height * 0.5), diameter * 0.5)
|
||||
let intersectionInnerBottomRight = lineCircleIntersection(relLabelCenter, relLabelCenter, CGPoint(x: relLabelCenter.x + labelSize.width * 0.5, y: relLabelCenter.y - labelSize.height * 0.5), innerDiameter * 0.5)
|
||||
|
||||
let horizontalInset: CGFloat = 2.0
|
||||
let intersectionOuterLeft = lineCircleIntersection(relLabelCenter, relLabelCenter, CGPoint(x: relLabelCenter.x + labelSize.width * 0.5, y: relLabelCenter.y), diameter * 0.5) - horizontalInset
|
||||
let intersectionInnerLeft = lineCircleIntersection(relLabelCenter, relLabelCenter, CGPoint(x: relLabelCenter.x + labelSize.width * 0.5, y: relLabelCenter.y), innerDiameter * 0.5) - horizontalInset
|
||||
|
||||
let intersectionLine1TopRight = lineLineIntersection(relLabelCenter, CGPoint(x: relLabelCenter.x + labelSize.width * 0.5, y: relLabelCenter.y + labelSize.height * 0.5), CGPoint(), CGPoint(x: cos(innerStartAngle), y: sin(innerStartAngle)))
|
||||
let intersectionLine1BottomRight = lineLineIntersection(relLabelCenter, CGPoint(x: relLabelCenter.x + labelSize.width * 0.5, y: relLabelCenter.y - labelSize.height * 0.5), CGPoint(), CGPoint(x: cos(innerStartAngle), y: sin(innerStartAngle)))
|
||||
let intersectionLine2TopRight = lineLineIntersection(relLabelCenter, CGPoint(x: relLabelCenter.x + labelSize.width * 0.5, y: relLabelCenter.y + labelSize.height * 0.5), CGPoint(), CGPoint(x: cos(innerEndAngle), y: sin(innerEndAngle)))
|
||||
@ -400,7 +404,9 @@ final class PieChartComponent: Component {
|
||||
intersectionOuterTopRight,
|
||||
intersectionInnerTopRight,
|
||||
intersectionOuterBottomRight,
|
||||
intersectionInnerBottomRight
|
||||
intersectionInnerBottomRight,
|
||||
intersectionOuterLeft,
|
||||
intersectionInnerLeft
|
||||
]
|
||||
|
||||
if angleValue < CGFloat.pi / 2.0 {
|
||||
@ -414,7 +420,7 @@ final class PieChartComponent: Component {
|
||||
|
||||
var minDistance: CGFloat = 1000.0
|
||||
for distance in distances {
|
||||
minDistance = min(minDistance, distance)
|
||||
minDistance = min(minDistance, max(distance, 1.0))
|
||||
}
|
||||
|
||||
let diagonalAngle = atan2(labelSize.height, labelSize.width)
|
||||
|
@ -231,7 +231,22 @@ final class StorageUsageScreenComponent: Component {
|
||||
|
||||
private var selectionState: SelectionState?
|
||||
|
||||
private var isClearing: Bool = false
|
||||
private var isClearing: Bool = false {
|
||||
didSet {
|
||||
if self.isClearing != oldValue {
|
||||
if self.isClearing {
|
||||
if self.keepScreenActiveDisposable == nil {
|
||||
self.keepScreenActiveDisposable = self.component?.context.sharedContext.applicationBindings.pushIdleTimerExtension()
|
||||
}
|
||||
} else {
|
||||
if let keepScreenActiveDisposable = self.keepScreenActiveDisposable {
|
||||
self.keepScreenActiveDisposable = nil
|
||||
keepScreenActiveDisposable.dispose()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var selectedCategories: Set<Category> = Set()
|
||||
private var isOtherCategoryExpanded: Bool = false
|
||||
@ -288,6 +303,7 @@ final class StorageUsageScreenComponent: Component {
|
||||
private var statsDisposable: Disposable?
|
||||
private var messagesDisposable: Disposable?
|
||||
private var cacheSettingsDisposable: Disposable?
|
||||
private var keepScreenActiveDisposable: Disposable?
|
||||
|
||||
override init(frame: CGRect) {
|
||||
self.headerOffsetContainer = UIView()
|
||||
@ -349,6 +365,7 @@ final class StorageUsageScreenComponent: Component {
|
||||
deinit {
|
||||
self.statsDisposable?.dispose()
|
||||
self.messagesDisposable?.dispose()
|
||||
self.keepScreenActiveDisposable?.dispose()
|
||||
}
|
||||
|
||||
func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
|
||||
@ -1784,7 +1801,7 @@ final class StorageUsageScreenComponent: Component {
|
||||
if result.imageItems.isEmpty && result.fileItems.isEmpty && result.musicItems.isEmpty && peerItems.isEmpty {
|
||||
self.selectionState = nil
|
||||
} else {
|
||||
self.selectionState = SelectionState()
|
||||
self.selectionState = nil
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user