fix: 修复 toolbar 弹出位置异常

This commit is contained in:
力皓 2020-05-15 10:41:01 +08:00
parent 954a64bf3a
commit b40b9a42c2
3 changed files with 7 additions and 4 deletions

View File

@ -70,7 +70,6 @@ class Toolbar extends Component<{ observed: OffsetObserver }> {
let style: any;
if (observed.top > SPACE_HEIGHT) {
style = {
right: Math.max(-BORDER, observed.right - width - BORDER),
top: -SPACE_HEIGHT,
height: BAR_HEIGHT,
};
@ -78,15 +77,18 @@ class Toolbar extends Component<{ observed: OffsetObserver }> {
style = {
bottom: -SPACE_HEIGHT,
height: BAR_HEIGHT,
right: Math.max(-BORDER, observed.right - width - BORDER),
};
} else {
style = {
height: BAR_HEIGHT,
top: Math.max(MARGIN, MARGIN - observed.top),
right: Math.max(MARGIN, MARGIN + observed.right - width),
};
}
if (observed.width < 140) {
style.left = Math.max(-BORDER, observed.left - width - BORDER);
} else {
style.right = Math.max(-BORDER, observed.right - width - BORDER);
}
const { node } = observed;
const actions: ReactNodeArray = [];
node.componentMeta.availableActions.forEach((action) => {

View File

@ -101,6 +101,7 @@ export default class InstanceNodeSelector extends React.Component<IProps, IState
</div>
}
triggerType="hover"
offset={[0, 2]}
>
<div className="instance-node-selector">{this.renderNodes(node)}</div>
</Popup>

View File

@ -194,7 +194,7 @@ export default function(metadata: TransformedComponentMetadata): TransformedComp
} else {
combined.push({
name: '#advanced',
title: { type: 'i18n', 'zh-CN': '高级', 'en-US': 'Advance' },
title: { type: 'i18n', 'zh-CN': '高级', 'en-US': 'Advanced' },
items: [
{
name: '___condition',