mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-15 18:58:11 +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;
|
return prefer;
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolvePrefer(prefer: any) {
|
function resolvePrefer(prefer: any, targetRect: any, bounds: any) {
|
||||||
if (!prefer) {
|
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 {};
|
return {};
|
||||||
}
|
}
|
||||||
const force = prefer[0] === '!';
|
const force = prefer[0] === '!';
|
||||||
@ -105,7 +114,7 @@ export function resolvePosition(popup: any, target: any, arrow: any, bounds: any
|
|||||||
width: popup.width,
|
width: popup.width,
|
||||||
};
|
};
|
||||||
|
|
||||||
const prefers = resolvePrefer(prefer);
|
const prefers = resolvePrefer(prefer, target, bounds);
|
||||||
|
|
||||||
const edge = resolveEdge(popup, target, arrow, 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))
|
typeof title.tip === 'object' && !(isValidElement(title.tip) || isI18nData(title.tip))
|
||||||
? title.tip
|
? title.tip
|
||||||
: { children: title.tip };
|
: { children: title.tip };
|
||||||
tip = <Tip direction="top" theme="black" {...tipProps} />;
|
tip = <Tip {...tipProps} />;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user