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

View File

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

View File

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