diff --git a/.mapping.json b/.mapping.json index b358915c3..d9127b223 100644 --- a/.mapping.json +++ b/.mapping.json @@ -9668,6 +9668,8 @@ "client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottomRight_68x37@3x.png":"divkit/public/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottomRight_68x37@3x.png", "client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottom_67x39@2x.png":"divkit/public/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottom_67x39@2x.png", "client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottom_67x39@3x.png":"divkit/public/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottom_67x39@3x.png", + "client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_center_67x43@2x.png":"divkit/public/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_center_67x43@2x.png", + "client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_center_67x43@3x.png":"divkit/public/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_center_67x43@3x.png", "client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_left_74x32@2x.png":"divkit/public/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_left_74x32@2x.png", "client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_left_74x32@3x.png":"divkit/public/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_left_74x32@3x.png", "client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_right_74x32@2x.png":"divkit/public/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_right_74x32@2x.png", diff --git a/client/ios/DivKit/Extensions/DivBase/DivBaseExtensions.swift b/client/ios/DivKit/Extensions/DivBase/DivBaseExtensions.swift index b9424d022..6c8c92184 100644 --- a/client/ios/DivKit/Extensions/DivBase/DivBaseExtensions.swift +++ b/client/ios/DivKit/Extensions/DivBase/DivBaseExtensions.swift @@ -398,6 +398,7 @@ extension DivTooltip.Position { case .bottomRight: return .bottomRight case .bottom: return .bottom case .bottomLeft: return .bottomLeft + case .center: return .center } } } diff --git a/client/ios/DivKit/generated_sources/DivTooltip.swift b/client/ios/DivKit/generated_sources/DivTooltip.swift index 9d0ce259b..a0deac97a 100644 --- a/client/ios/DivKit/generated_sources/DivTooltip.swift +++ b/client/ios/DivKit/generated_sources/DivTooltip.swift @@ -7,14 +7,15 @@ import Serialization public final class DivTooltip { @frozen public enum Position: String, CaseIterable { - case left = "left" + case left case topLeft = "top-left" - case top = "top" + case top case topRight = "top-right" - case right = "right" + case right case bottomRight = "bottom-right" - case bottom = "bottom" + case bottom case bottomLeft = "bottom-left" + case center } public let animationIn: DivAnimation? diff --git a/client/ios/LayoutKit/LayoutKit/Blocks/BlockTooltip+Layout.swift b/client/ios/LayoutKit/LayoutKit/Blocks/BlockTooltip+Layout.swift index 227567994..d46a51327 100644 --- a/client/ios/LayoutKit/LayoutKit/Blocks/BlockTooltip+Layout.swift +++ b/client/ios/LayoutKit/LayoutKit/Blocks/BlockTooltip+Layout.swift @@ -23,6 +23,7 @@ extension CGRect { case .bottomRight: return coordinate(ofCorner: .bottomRight) case .bottom: return CGPoint(x: midX, y: maxY) case .bottomLeft: return coordinate(ofCorner: .bottomLeft) + case .center: return CGPoint(x: midX, y: midY) } } } @@ -38,6 +39,7 @@ extension BlockTooltip.Position { case .bottomRight: return .topLeft case .bottom: return .top case .bottomLeft: return .topRight + case .center: return .center } } } @@ -66,6 +68,8 @@ extension CGRect { origin = coordinate.movingX(by: -0.5 * size.width).movingY(by: -size.height) case .bottomLeft: origin = coordinate.movingY(by: -size.height) + case .center: + origin = coordinate.movingX(by: -0.5 * size.width).movingY(by: -size.height / 2) } self.init(origin: origin, size: size) } diff --git a/client/ios/LayoutKit/LayoutKit/Blocks/BlockTooltip.swift b/client/ios/LayoutKit/LayoutKit/Blocks/BlockTooltip.swift index 136750f31..bb42ad66c 100644 --- a/client/ios/LayoutKit/LayoutKit/Blocks/BlockTooltip.swift +++ b/client/ios/LayoutKit/LayoutKit/Blocks/BlockTooltip.swift @@ -12,6 +12,7 @@ public struct BlockTooltip: Equatable { case bottomRight case bottom case bottomLeft + case center } public let id: String diff --git a/client/ios/LayoutKit/LayoutKit/Tooltips/TooltipFactory.swift b/client/ios/LayoutKit/LayoutKit/Tooltips/TooltipFactory.swift index 17ebc9105..f8a523bf0 100644 --- a/client/ios/LayoutKit/LayoutKit/Tooltips/TooltipFactory.swift +++ b/client/ios/LayoutKit/LayoutKit/Tooltips/TooltipFactory.swift @@ -66,6 +66,11 @@ extension BlockTooltip.Position { cornerTailSize, drawingHandler: { drawCornerTail(style: .topRight, color: color, context: $0) } ) + case .center: + imageHolder = Image.imageOfSize( + cornerTailSize, + drawingHandler: { _ in } + ) } return ImageBlock(imageHolder: imageHolder!) } @@ -130,6 +135,13 @@ extension BlockTooltip.Position { makeTail(color: theme.backgroundColor), ] ) + case .center: + return try! ContainerBlock( + layoutDirection: .vertical, + horizontalChildrenAlignment: .center, + gaps: [0, -1, 0], + children: [makeTail(color: theme.backgroundColor), child] + ) } } } diff --git a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Multiline_topRight_91x133@2x.png b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Multiline_topRight_91x133@2x.png index 0b2b18848..26a14f221 100644 Binary files a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Multiline_topRight_91x133@2x.png and b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Multiline_topRight_91x133@2x.png differ diff --git a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Multiline_topRight_91x133@3x.png b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Multiline_topRight_91x133@3x.png index f91abd166..cd7e247a3 100644 Binary files a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Multiline_topRight_91x133@3x.png and b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Multiline_topRight_91x133@3x.png differ diff --git a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottomLeft_68x37@2x.png b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottomLeft_68x37@2x.png index 61ee79c58..12afc6b51 100644 Binary files a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottomLeft_68x37@2x.png and b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottomLeft_68x37@2x.png differ diff --git a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottomLeft_68x37@3x.png b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottomLeft_68x37@3x.png index 8b35f72e0..73e0ff4e0 100644 Binary files a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottomLeft_68x37@3x.png and b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottomLeft_68x37@3x.png differ diff --git a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottomRight_68x37@2x.png b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottomRight_68x37@2x.png index 67671a4d5..c67b360e8 100644 Binary files a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottomRight_68x37@2x.png and b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottomRight_68x37@2x.png differ diff --git a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottomRight_68x37@3x.png b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottomRight_68x37@3x.png index e96fabe44..e3faed481 100644 Binary files a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottomRight_68x37@3x.png and b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottomRight_68x37@3x.png differ diff --git a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottom_67x39@2x.png b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottom_67x39@2x.png index 927007c63..174c44dd5 100644 Binary files a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottom_67x39@2x.png and b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottom_67x39@2x.png differ diff --git a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottom_67x39@3x.png b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottom_67x39@3x.png index 5506ea022..8c868ea7c 100644 Binary files a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottom_67x39@3x.png and b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_bottom_67x39@3x.png differ diff --git a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_center_67x43@2x.png b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_center_67x43@2x.png new file mode 100644 index 000000000..21846de82 Binary files /dev/null and b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_center_67x43@2x.png differ diff --git a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_center_67x43@3x.png b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_center_67x43@3x.png new file mode 100644 index 000000000..b79d8897c Binary files /dev/null and b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_center_67x43@3x.png differ diff --git a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_left_74x32@2x.png b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_left_74x32@2x.png index 0bd55652c..3f6a429a1 100644 Binary files a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_left_74x32@2x.png and b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_left_74x32@2x.png differ diff --git a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_left_74x32@3x.png b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_left_74x32@3x.png index 4c7356cf3..2d1a9b489 100644 Binary files a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_left_74x32@3x.png and b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_left_74x32@3x.png differ diff --git a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_right_74x32@2x.png b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_right_74x32@2x.png index 87cd92269..2e9a5740e 100644 Binary files a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_right_74x32@2x.png and b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_right_74x32@2x.png differ diff --git a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_right_74x32@3x.png b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_right_74x32@3x.png index f07fc33da..81b884bea 100644 Binary files a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_right_74x32@3x.png and b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_right_74x32@3x.png differ diff --git a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_topLeft_68x37@2x.png b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_topLeft_68x37@2x.png index 1eaf8c549..572569ab7 100644 Binary files a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_topLeft_68x37@2x.png and b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_topLeft_68x37@2x.png differ diff --git a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_topLeft_68x37@3x.png b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_topLeft_68x37@3x.png index bc6442b80..8c1c68891 100644 Binary files a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_topLeft_68x37@3x.png and b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_topLeft_68x37@3x.png differ diff --git a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_topRight_68x37@2x.png b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_topRight_68x37@2x.png index 13fd3cf86..e65d9f0a8 100644 Binary files a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_topRight_68x37@2x.png and b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_topRight_68x37@2x.png differ diff --git a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_topRight_68x37@3x.png b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_topRight_68x37@3x.png index d84c95521..f659a00c7 100644 Binary files a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_topRight_68x37@3x.png and b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_topRight_68x37@3x.png differ diff --git a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_top_67x39@2x.png b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_top_67x39@2x.png index cec61858a..4a322eb28 100644 Binary files a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_top_67x39@2x.png and b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_top_67x39@2x.png differ diff --git a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_top_67x39@3x.png b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_top_67x39@3x.png index 365b1330a..cdab4ee87 100644 Binary files a/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_top_67x39@3x.png and b/client/ios/Tests/reference_snapshots/TooltipFactorySnapshotTests/Orientations_top_67x39@3x.png differ