mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-05 17:57:13 +00:00
fix: 处理选区的 toolkit 位置不对的 bug
This commit is contained in:
parent
7d02aad795
commit
bfc63db78d
@ -66,7 +66,9 @@ class Toolbar extends Component<{ observed: OffsetObserver }> {
|
|||||||
const MARGIN = 1;
|
const MARGIN = 1;
|
||||||
const BORDER = 2;
|
const BORDER = 2;
|
||||||
const SPACE_HEIGHT = BAR_HEIGHT + MARGIN + BORDER;
|
const SPACE_HEIGHT = BAR_HEIGHT + MARGIN + BORDER;
|
||||||
|
const SPACE_MINIMUM_WIDTH = 140; // magic number
|
||||||
let style: any;
|
let style: any;
|
||||||
|
// 计算 toolbar 的上/下位置
|
||||||
if (observed.top > SPACE_HEIGHT) {
|
if (observed.top > SPACE_HEIGHT) {
|
||||||
style = {
|
style = {
|
||||||
top: -SPACE_HEIGHT,
|
top: -SPACE_HEIGHT,
|
||||||
@ -83,10 +85,12 @@ class Toolbar extends Component<{ observed: OffsetObserver }> {
|
|||||||
top: Math.max(MARGIN, MARGIN - observed.top),
|
top: Math.max(MARGIN, MARGIN - observed.top),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (observed.width < 140) {
|
// 计算 toolbar 的左/右位置
|
||||||
|
if (SPACE_MINIMUM_WIDTH > observed.left + observed.width) {
|
||||||
style.left = Math.max(-BORDER, observed.left - width - BORDER);
|
style.left = Math.max(-BORDER, observed.left - width - BORDER);
|
||||||
} else {
|
} else {
|
||||||
style.right = Math.max(-BORDER, observed.right - width - BORDER);
|
style.right = Math.max(-BORDER, observed.right - width - BORDER);
|
||||||
|
style.justifyContent = 'flex-start';
|
||||||
}
|
}
|
||||||
const { node } = observed;
|
const { node } = observed;
|
||||||
const actions: ReactNodeArray = [];
|
const actions: ReactNodeArray = [];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user