mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-29 03:21:13 +00:00
fix: limit tooltip size for left and right location (#8055)
Some checks are pending
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / uitest-workspaces (push) Waiting to run
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions
Some checks are pending
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / uitest-workspaces (push) Waiting to run
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions
Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
parent
4b44eca734
commit
7bdb4de5b2
@ -151,23 +151,30 @@
|
||||
else dir = 'top'
|
||||
} else dir = $tooltip.direction
|
||||
|
||||
if (dir === 'right') {
|
||||
const maxWidth = Math.min(docWidth / 2, docWidth - rectAnchor.right)
|
||||
options.top = rectAnchor.y + rectAnchor.height / 2 + 'px'
|
||||
options.left = `calc(${rectAnchor.right}px + .75rem)`
|
||||
options.maxWidth = `calc(${maxWidth}px - 1.5rem)`
|
||||
options.transform = 'translateY(-50%)'
|
||||
} else if (dir === 'left') {
|
||||
const maxWidth = Math.min(docWidth / 2, docWidth - rectAnchor.x)
|
||||
options.top = rectAnchor.y + rectAnchor.height / 2 + 'px'
|
||||
options.right = `calc(${docWidth - rectAnchor.x}px + .75rem)`
|
||||
options.maxWidth = `calc(${maxWidth}px - 1.5rem)`
|
||||
options.transform = 'translateY(-50%)'
|
||||
} else if (dir === 'bottom') {
|
||||
const left = rectAnchor.x + rectAnchor.width / 2
|
||||
const maxWidth = Math.min(left, docWidth - left)
|
||||
|
||||
if (dir === 'right') {
|
||||
options.top = rectAnchor.y + rectAnchor.height / 2 + 'px'
|
||||
options.left = `calc(${rectAnchor.right}px + .75rem)`
|
||||
options.transform = 'translateY(-50%)'
|
||||
} else if (dir === 'left') {
|
||||
options.top = rectAnchor.y + rectAnchor.height / 2 + 'px'
|
||||
options.right = `calc(${docWidth - rectAnchor.x}px + .75rem)`
|
||||
options.transform = 'translateY(-50%)'
|
||||
} else if (dir === 'bottom') {
|
||||
options.top = `calc(${rectAnchor.bottom}px + .5rem)`
|
||||
options.left = rectAnchor.x + rectAnchor.width / 2 + 'px'
|
||||
options.maxWidth = `calc(${maxWidth * 2}px - 1.5rem)`
|
||||
options.transform = 'translateX(-50%)'
|
||||
} else if (dir === 'top') {
|
||||
const left = rectAnchor.x + rectAnchor.width / 2
|
||||
const maxWidth = Math.min(left, docWidth - left)
|
||||
|
||||
options.bottom = `calc(${docHeight - rectAnchor.y}px + .75rem)`
|
||||
options.left = rectAnchor.x + rectAnchor.width / 2 + 'px'
|
||||
options.maxWidth = `calc(${maxWidth * 2}px - 1.5rem)`
|
||||
|
Loading…
Reference in New Issue
Block a user