Skip to content

Commit 0c42ff6

Browse files
committed
Fix UI layout
1 parent 4add5b5 commit 0c42ff6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Sources/GateEngine/UI/Layout.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public struct Layout {
166166
}
167167
if target == target.view.bottomAnchor {
168168
computed = Value.Computed(
169-
value: targetY + targetHeight.value + vPosition.constant
169+
value: targetY + targetHeight.value - vPosition.constant
170170
)
171171
break
172172
}
@@ -197,24 +197,24 @@ public struct Layout {
197197
fatalError("Layout is not able to handle an unknown horizontal position anchor. This is a bug.")
198198
}
199199
if vPosition.source == view.bottomAnchor {
200-
guard let width = resolveWidth(for: view) else {continue}
200+
guard let height = resolveHeight(for: view) else {continue}
201201
guard let targetY = relativeResolvedY(forTarget: target.view) else {continue}
202202
if target == target.view.topAnchor {
203203
computed = Value.Computed(
204204
value: targetY + vPosition.constant
205205
)
206206
break
207207
}
208-
guard let targetWidth = resolveWidth(for: target.view) else {continue}
208+
guard let targetHeight = resolveHeight(for: target.view) else {continue}
209209
if target == target.view.centerYAnchor {
210210
computed = Value.Computed(
211-
value: targetY + (targetWidth.value / 2) - width.value + vPosition.constant
211+
value: targetY + (targetHeight.value / 2) - height.value + vPosition.constant
212212
)
213213
break
214214
}
215215
if target == target.view.bottomAnchor {
216216
computed = Value.Computed(
217-
value: width.value + targetY + targetWidth.value + vPosition.constant
217+
value: targetY + targetHeight.value - height.value - vPosition.constant
218218
)
219219
break
220220
}

0 commit comments

Comments
 (0)