fix: decrease Object Action Bar distance when below portal

pull/7495/head
Peng Xiao 2022-11-28 15:04:27 +08:00 committed by Tienson Qin
parent 0d520265ef
commit 9f66c25240
2 changed files with 2 additions and 2 deletions

View File

@ -29,7 +29,7 @@ const _ContextBar: TLContextBarComponent<Shape> = ({ shapes, offsets, hidden })
const elm = rContextBar.current
if (!elm) return
const size = rSize.current ?? [0, 0]
const [x, y] = getContextBarTranslation(size, { ...offsets, bottom: offsets.bottom - 32 })
const [x, y] = getContextBarTranslation(size, offsets)
elm.style.setProperty('transform', `translateX(${x}px) translateY(${y}px)`)
}, [offsets])

View File

@ -14,7 +14,7 @@ export function getContextBarTranslation(barSize: number[], offset: TLOffset) {
let y = 0
if (offset.top < 116) {
// Show on bottom
y = offset.height / 2 + 72
y = offset.height / 2 + 40
// Too far down, move up
if (offset.bottom < 140) {
y += offset.bottom - 140