mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
fix: tip direction
This commit is contained in:
parent
bd49e50295
commit
f51d496860
@ -64,8 +64,17 @@ function resolveDirection(popup: any, target: any, edge: any, bounds: any, prefe
|
||||
return prefer;
|
||||
}
|
||||
|
||||
function resolvePrefer(prefer: any) {
|
||||
function resolvePrefer(prefer: any, targetRect: any, bounds: any) {
|
||||
if (!prefer) {
|
||||
if (targetRect.left - bounds.left < 10) {
|
||||
return { dir: 'right' };
|
||||
} else if (targetRect.top - bounds.top < 10) {
|
||||
return { dir: 'bottom' };
|
||||
} else if (bounds.bottom - targetRect.bottom < 10) {
|
||||
return { dir: 'top' };
|
||||
} else if (bounds.right - targetRect.right < 10) {
|
||||
return { dir: 'left' };
|
||||
}
|
||||
return {};
|
||||
}
|
||||
const force = prefer[0] === '!';
|
||||
@ -105,7 +114,7 @@ export function resolvePosition(popup: any, target: any, arrow: any, bounds: any
|
||||
width: popup.width,
|
||||
};
|
||||
|
||||
const prefers = resolvePrefer(prefer);
|
||||
const prefers = resolvePrefer(prefer, target, bounds);
|
||||
|
||||
const edge = resolveEdge(popup, target, arrow, bounds);
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ export class Title extends Component<{ title: TitleContent; className?: string;
|
||||
typeof title.tip === 'object' && !(isValidElement(title.tip) || isI18nData(title.tip))
|
||||
? title.tip
|
||||
: { children: title.tip };
|
||||
tip = <Tip direction="top" theme="black" {...tipProps} />;
|
||||
tip = <Tip {...tipProps} />;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user