fix initial get root rect

This commit is contained in:
kangwei 2020-05-05 18:40:58 +08:00
parent 103c0fa881
commit 641a11d412
5 changed files with 20 additions and 16 deletions

View File

@ -331,17 +331,6 @@ const builtinComponentActions: ComponentAction[] = [
},
important: true,
},
{
name: 'copy',
content: {
icon: IconClone,
title: intlNode('copy'),
action(node: Node) {
// node.remove();
},
},
important: true,
},
{
name: 'hide',
content: {
@ -356,6 +345,17 @@ const builtinComponentActions: ComponentAction[] = [
},
important: true,
},
{
name: 'copy',
content: {
icon: IconClone,
title: intlNode('copy'),
action(node: Node) {
// node.remove();
},
},
important: true,
},
];
export function removeBuiltinComponentAction(name: string) {

View File

@ -461,14 +461,11 @@ export class DocumentModel {
return config.checkNestingDown(parent, obj) && this.checkNestingUp(parent, obj);
}
// ======= compatibles
// ======= compatibles for vision
getRoot() {
return this.rootNode;
}
/**
* vision
*/
getHistory(): History {
return this.history;
}
@ -476,6 +473,10 @@ export class DocumentModel {
get root() {
return this.rootNode;
}
toData() {
return this.export(TransformStage.Save);
}
}
export function isDocumentModel(obj: any): obj is DocumentModel {

View File

@ -685,6 +685,9 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
}
getRect(): DOMRect | null {
if (this.isRoot()) {
return this.document.simulator?.viewport.contentBounds || null;
}
return this.document.simulator?.computeRect(this) || null;
}

View File

@ -228,7 +228,6 @@ export default class BaseEngine extends PureComponent {
let Comp = components[schema.componentName] || Div;
console.info('node schema', schema, engine.props);
if (schema.hidden) {
return null;
}

View File

@ -108,4 +108,5 @@ addBuiltinComponentAction({
name: 'instance-node-selector',
content: InstanceNodeSelector,
important: true,
condition: 'always'
});