mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-04-20 12:28:08 +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,
|
important: true,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'copy',
|
|
||||||
content: {
|
|
||||||
icon: IconClone,
|
|
||||||
title: intlNode('copy'),
|
|
||||||
action(node: Node) {
|
|
||||||
// node.remove();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
important: true,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'hide',
|
name: 'hide',
|
||||||
content: {
|
content: {
|
||||||
@ -356,6 +345,17 @@ const builtinComponentActions: ComponentAction[] = [
|
|||||||
},
|
},
|
||||||
important: true,
|
important: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'copy',
|
||||||
|
content: {
|
||||||
|
icon: IconClone,
|
||||||
|
title: intlNode('copy'),
|
||||||
|
action(node: Node) {
|
||||||
|
// node.remove();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
important: true,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export function removeBuiltinComponentAction(name: string) {
|
export function removeBuiltinComponentAction(name: string) {
|
||||||
|
|||||||
@ -461,14 +461,11 @@ export class DocumentModel {
|
|||||||
return config.checkNestingDown(parent, obj) && this.checkNestingUp(parent, obj);
|
return config.checkNestingDown(parent, obj) && this.checkNestingUp(parent, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ======= compatibles
|
// ======= compatibles for vision
|
||||||
getRoot() {
|
getRoot() {
|
||||||
return this.rootNode;
|
return this.rootNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 兼容vision
|
|
||||||
*/
|
|
||||||
getHistory(): History {
|
getHistory(): History {
|
||||||
return this.history;
|
return this.history;
|
||||||
}
|
}
|
||||||
@ -476,6 +473,10 @@ export class DocumentModel {
|
|||||||
get root() {
|
get root() {
|
||||||
return this.rootNode;
|
return this.rootNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toData() {
|
||||||
|
return this.export(TransformStage.Save);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isDocumentModel(obj: any): obj is DocumentModel {
|
export function isDocumentModel(obj: any): obj is DocumentModel {
|
||||||
|
|||||||
@ -685,6 +685,9 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getRect(): DOMRect | null {
|
getRect(): DOMRect | null {
|
||||||
|
if (this.isRoot()) {
|
||||||
|
return this.document.simulator?.viewport.contentBounds || null;
|
||||||
|
}
|
||||||
return this.document.simulator?.computeRect(this) || null;
|
return this.document.simulator?.computeRect(this) || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -228,7 +228,6 @@ export default class BaseEngine extends PureComponent {
|
|||||||
|
|
||||||
let Comp = components[schema.componentName] || Div;
|
let Comp = components[schema.componentName] || Div;
|
||||||
|
|
||||||
console.info('node schema', schema, engine.props);
|
|
||||||
if (schema.hidden) {
|
if (schema.hidden) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -108,4 +108,5 @@ addBuiltinComponentAction({
|
|||||||
name: 'instance-node-selector',
|
name: 'instance-node-selector',
|
||||||
content: InstanceNodeSelector,
|
content: InstanceNodeSelector,
|
||||||
important: true,
|
important: true,
|
||||||
|
condition: 'always'
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user