mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
fix initial get root rect
This commit is contained in:
parent
103c0fa881
commit
641a11d412
@ -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) {
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -108,4 +108,5 @@ addBuiltinComponentAction({
|
||||
name: 'instance-node-selector',
|
||||
content: InstanceNodeSelector,
|
||||
important: true,
|
||||
condition: 'always'
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user