Change name to avoid confusion

This commit is contained in:
Ali 2023-06-26 17:09:04 +03:00
parent aced3ac27c
commit f0809b0aae
2 changed files with 15 additions and 8 deletions

View File

@ -487,9 +487,16 @@ final class StoryItemContentComponent: Component {
}
if let dimensions {
var imageSize = dimensions.aspectFilled(availableSize)
if imageSize.width < availableSize.width && imageSize.width >= availableSize.width - 5.0 {
imageSize.width = availableSize.width
}
if imageSize.height < availableSize.height && imageSize.height >= availableSize.height - 5.0 {
imageSize.height = availableSize.height
}
let apply = self.imageNode.asyncLayout()(TransformImageArguments(
corners: ImageCorners(),
imageSize: dimensions.aspectFilled(availableSize),
imageSize: imageSize,
boundingSize: availableSize,
intrinsicInsets: UIEdgeInsets()
))

View File

@ -182,16 +182,16 @@ public final class StoryItemSetContainerComponent: Component {
}
struct ItemLayout {
var size: CGSize
var containerSize: CGSize
var contentFrame: CGRect
var contentVisualScale: CGFloat
init(
size: CGSize,
containerSize: CGSize,
contentFrame: CGRect,
contentVisualScale: CGFloat
) {
self.size = size
self.containerSize = containerSize
self.contentFrame = contentFrame
self.contentVisualScale = contentVisualScale
}
@ -567,7 +567,7 @@ public final class StoryItemSetContainerComponent: Component {
let point = recognizer.location(in: self)
var direction: NavigationDirection?
if point.x < itemLayout.size.width * 0.25 {
if point.x < itemLayout.containerSize.width * 0.25 {
direction = .previous
} else {
direction = .next
@ -670,7 +670,7 @@ public final class StoryItemSetContainerComponent: Component {
}
self.scrollingCenterX = leftWidth
self.scroller.contentSize = CGSize(width: leftWidth + itemLayout.size.width + rightWidth, height: 1.0)
self.scroller.contentSize = CGSize(width: leftWidth + itemLayout.containerSize.width + rightWidth, height: 1.0)
if !self.initializedOffset {
self.initializedOffset = true
@ -862,7 +862,7 @@ public final class StoryItemSetContainerComponent: Component {
environment: {
itemEnvironment
},
containerSize: itemLayout.size
containerSize: itemLayout.contentFrame.size
)
if let view = visibleItem.view.view {
if visibleItem.contentContainerView.superview == nil {
@ -2048,7 +2048,7 @@ public final class StoryItemSetContainerComponent: Component {
let contentFrame = CGRect(origin: CGPoint(x: 0.0, y: component.containerInsets.top - (contentSize.height - contentVisualHeight) * 0.5), size: contentSize)
let itemLayout = ItemLayout(
size: contentFrame.size,
containerSize: availableSize,
contentFrame: contentFrame,
contentVisualScale: contentVisualScale
)