mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Chart fixes
This commit is contained in:
parent
28e7596534
commit
14510b11bb
@ -170,9 +170,6 @@ class GeneralChartComponentController: ChartThemeContainer {
|
||||
}
|
||||
|
||||
func chartInteractionDidBegin(point: CGPoint, manual: Bool = true) {
|
||||
guard !ignoreInteraction else {
|
||||
return
|
||||
}
|
||||
if manual && !isChartInteracting && detailsVisible {
|
||||
self.hideDetailsView(animated: true)
|
||||
ignoreInteraction = true
|
||||
|
@ -122,9 +122,6 @@ public class GeneralLinesChartController: BaseLinesChartController {
|
||||
}
|
||||
|
||||
public override func chartInteractionDidBegin(point: CGPoint, manual: Bool = true) {
|
||||
guard !ignoreInteraction else {
|
||||
return
|
||||
}
|
||||
if manual && !isChartInteracting && !self.verticalLineRenderer.values.isEmpty {
|
||||
self.cancelChartInteraction()
|
||||
ignoreInteraction = true
|
||||
@ -147,7 +144,7 @@ public class GeneralLinesChartController: BaseLinesChartController {
|
||||
|
||||
let chartValue: CGFloat = CGFloat(closestDate.timeIntervalSince1970)
|
||||
let detailsViewPosition = (chartValue - horizontalRange.lowerBound) / horizontalRange.distance * chartFrame.width + chartFrame.minX
|
||||
self.setDetailsViewModel?(chartDetailsViewModel(closestDate: closestDate, pointIndex: minIndex, loading: false), chartInteractionWasBegin, !chartInteractionWasBegin)
|
||||
self.setDetailsViewModel?(chartDetailsViewModel(closestDate: closestDate, pointIndex: minIndex, loading: false), chartInteractionWasBegin, chartInteractionWasBegin)
|
||||
self.setDetailsChartVisibleClosure?(true, true)
|
||||
self.setDetailsViewPositionClosure?(detailsViewPosition)
|
||||
self.verticalLineRenderer.values = [chartValue]
|
||||
|
@ -149,9 +149,6 @@ public class TwoAxisLinesChartController: BaseLinesChartController {
|
||||
}
|
||||
|
||||
public override func chartInteractionDidBegin(point: CGPoint, manual: Bool = true) {
|
||||
guard !ignoreInteraction else {
|
||||
return
|
||||
}
|
||||
if manual && !isChartInteracting && !self.verticalLineRenderer.values.isEmpty {
|
||||
self.cancelChartInteraction()
|
||||
ignoreInteraction = true
|
||||
@ -176,7 +173,7 @@ public class TwoAxisLinesChartController: BaseLinesChartController {
|
||||
|
||||
let chartValue: CGFloat = CGFloat(closestDate.timeIntervalSince1970)
|
||||
let detailsViewPosition = (chartValue - horizontalRange.lowerBound) / horizontalRange.distance * chartFrame.width + chartFrame.minX
|
||||
self.setDetailsViewModel?(chartDetailsViewModel(closestDate: closestDate, pointIndex: minIndex, loading: false), chartInteractionWasBegin, !chartInteractionWasBegin)
|
||||
self.setDetailsViewModel?(chartDetailsViewModel(closestDate: closestDate, pointIndex: minIndex, loading: false), chartInteractionWasBegin, chartInteractionWasBegin)
|
||||
self.setDetailsChartVisibleClosure?(true, true)
|
||||
self.setDetailsViewPositionClosure?(detailsViewPosition)
|
||||
self.verticalLineRenderer.values = [chartValue]
|
||||
|
@ -253,9 +253,9 @@ public class PercentPieChartController: BaseChartController {
|
||||
var lowIndex = max(0, index - range / 2)
|
||||
var highIndex = min(currentCollection.axisValues.count - 1, index + range / 2)
|
||||
if lowIndex == 0 {
|
||||
highIndex = lowIndex + (range - 1)
|
||||
highIndex = min(currentCollection.axisValues.count - 1, lowIndex + (range - 1))
|
||||
} else if highIndex == currentCollection.axisValues.count - 1 {
|
||||
lowIndex = highIndex - (range - 1)
|
||||
lowIndex = max(0, highIndex - (range - 1))
|
||||
}
|
||||
|
||||
let newValues = currentCollection.chartValues.map { chart in
|
||||
|
@ -152,9 +152,6 @@ public class TwoAxisStepBarsChartController: BaseLinesChartController {
|
||||
}
|
||||
|
||||
public override func chartInteractionDidBegin(point: CGPoint, manual: Bool = true) {
|
||||
guard !ignoreInteraction else {
|
||||
return
|
||||
}
|
||||
if manual && !isChartInteracting && !self.verticalLineRenderer.values.isEmpty {
|
||||
self.cancelChartInteraction()
|
||||
ignoreInteraction = true
|
||||
@ -193,7 +190,7 @@ public class TwoAxisStepBarsChartController: BaseLinesChartController {
|
||||
|
||||
let chartValue: CGFloat = CGFloat(closestDate.timeIntervalSince1970)
|
||||
let detailsViewPosition = (chartValue - horizontalRange.lowerBound) / horizontalRange.distance * chartFrame.width + chartFrame.minX + barOffset
|
||||
self.setDetailsViewModel?(chartDetailsViewModel(closestDate: closestDate, pointIndex: minIndex, loading: false), chartInteractionWasBegin, !chartInteractionWasBegin)
|
||||
self.setDetailsViewModel?(chartDetailsViewModel(closestDate: closestDate, pointIndex: minIndex, loading: false), chartInteractionWasBegin, chartInteractionWasBegin)
|
||||
self.setDetailsChartVisibleClosure?(true, true)
|
||||
self.setDetailsViewPositionClosure?(detailsViewPosition)
|
||||
self.verticalLineRenderer.values = [chartValue]
|
||||
|
@ -57,20 +57,20 @@ class BaseChartRenderer: ChartViewRenderer {
|
||||
return
|
||||
}
|
||||
if animated {
|
||||
let function: TimeFunction
|
||||
if let timeFunction = timeFunction {
|
||||
function = timeFunction
|
||||
} else if self.verticalRange.current.distance > 0 && verticalRange.distance > 0 {
|
||||
if self.verticalRange.current.distance / verticalRange.distance > exponentialAnimationTrashold {
|
||||
function = .easeIn
|
||||
} else if verticalRange.distance / self.verticalRange.current.distance > exponentialAnimationTrashold {
|
||||
function = .easeOut
|
||||
} else {
|
||||
function = .linear
|
||||
}
|
||||
} else {
|
||||
function = .linear
|
||||
}
|
||||
let function: TimeFunction = .easeInOut
|
||||
// if let timeFunction = timeFunction {
|
||||
// function = timeFunction
|
||||
// } else if self.verticalRange.current.distance > 0 && verticalRange.distance > 0 {
|
||||
// if self.verticalRange.current.distance / verticalRange.distance > exponentialAnimationTrashold {
|
||||
// function = .easeIn
|
||||
// } else if verticalRange.distance / self.verticalRange.current.distance > exponentialAnimationTrashold {
|
||||
// function = .easeOut
|
||||
// } else {
|
||||
// function = .linear
|
||||
// }
|
||||
// } else {
|
||||
// function = .linear
|
||||
// }
|
||||
|
||||
self.verticalRange.animate(to: verticalRange, duration: .defaultDuration, timeFunction: function)
|
||||
} else {
|
||||
|
@ -302,7 +302,7 @@ open class ItemListControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
||||
let _ = strongSelf.contentScrollingEnded?(strongSelf.listNode)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let previousState = Atomic<ItemListNodeState?>(value: nil)
|
||||
self.transitionDisposable.set(((state
|
||||
|> map { presentationData, stateAndArguments -> ItemListNodeTransition in
|
||||
|
@ -464,7 +464,7 @@ public func channelStatsController(context: AccountContext, peerId: PeerId, cach
|
||||
}
|
||||
messagesPromise.set(.single(nil) |> then(messageView))
|
||||
|
||||
let longLoadingSignal: Signal<Bool, NoError> = .single(false) |> then(.single(true) |> delay(1.5, queue: Queue.mainQueue()))
|
||||
let longLoadingSignal: Signal<Bool, NoError> = .single(false) |> then(.single(true) |> delay(2.0, queue: Queue.mainQueue()))
|
||||
|
||||
let previousData = Atomic<ChannelStats?>(value: nil)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user