mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-06 10:27:22 +00:00
fix: revert
This commit is contained in:
parent
995785dbc9
commit
dad21e2994
@ -278,6 +278,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
|||||||
}
|
}
|
||||||
|
|
||||||
setupEvents() {
|
setupEvents() {
|
||||||
|
debugger;
|
||||||
// TODO: Thinkof move events control to simulator renderer
|
// TODO: Thinkof move events control to simulator renderer
|
||||||
// just listen special callback
|
// just listen special callback
|
||||||
// because iframe maybe reload
|
// because iframe maybe reload
|
||||||
@ -288,10 +289,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
|||||||
}
|
}
|
||||||
|
|
||||||
setupDragAndClick() {
|
setupDragAndClick() {
|
||||||
const documentModel = this.project.currentDocument;
|
const designer = this.designer;
|
||||||
if (!documentModel) return;
|
|
||||||
const selection = documentModel.selection;
|
|
||||||
const designer = documentModel.designer;
|
|
||||||
const doc = this.contentDocument!;
|
const doc = this.contentDocument!;
|
||||||
|
|
||||||
// TODO: think of lock when edit a node
|
// TODO: think of lock when edit a node
|
||||||
@ -302,17 +300,16 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
|||||||
// fix for popups close logic
|
// fix for popups close logic
|
||||||
document.dispatchEvent(new Event('mousedown'));
|
document.dispatchEvent(new Event('mousedown'));
|
||||||
const documentModel = this.project.currentDocument;
|
const documentModel = this.project.currentDocument;
|
||||||
|
if (this.liveEditing.editing || !documentModel) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const selection = documentModel.selection;
|
||||||
let isMulti = false;
|
let isMulti = false;
|
||||||
if (this.designMode === 'design') {
|
if (this.designMode === 'design') {
|
||||||
isMulti = downEvent.metaKey || downEvent.ctrlKey;
|
isMulti = downEvent.metaKey || downEvent.ctrlKey;
|
||||||
} else if (!downEvent.metaKey) {
|
} else if (!downEvent.metaKey) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.liveEditing.editing) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const selection = documentModel?.selection;
|
|
||||||
// stop response document focus event
|
// stop response document focus event
|
||||||
downEvent.stopPropagation();
|
downEvent.stopPropagation();
|
||||||
downEvent.preventDefault();
|
downEvent.preventDefault();
|
||||||
@ -320,7 +317,6 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
|||||||
// FIXME: dirty fix remove label-for fro liveEditing
|
// FIXME: dirty fix remove label-for fro liveEditing
|
||||||
(downEvent.target as HTMLElement).removeAttribute('for');
|
(downEvent.target as HTMLElement).removeAttribute('for');
|
||||||
|
|
||||||
|
|
||||||
const nodeInst = this.getNodeInstanceFromElement(downEvent.target as Element);
|
const nodeInst = this.getNodeInstanceFromElement(downEvent.target as Element);
|
||||||
const node = nodeInst?.node || documentModel?.rootNode;
|
const node = nodeInst?.node || documentModel?.rootNode;
|
||||||
if (!node?.isValidComponent()) {
|
if (!node?.isValidComponent()) {
|
||||||
@ -334,7 +330,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
|||||||
if (!isShaken(downEvent, e)) {
|
if (!isShaken(downEvent, e)) {
|
||||||
let id = node.id;
|
let id = node.id;
|
||||||
designer.activeTracker.track({ node, instance: nodeInst?.instance });
|
designer.activeTracker.track({ node, instance: nodeInst?.instance });
|
||||||
if (isMulti && !isRootNode(node) && selection?.has(id)) {
|
if (isMulti && !isRootNode(node) && selection.has(id)) {
|
||||||
selection.remove(id);
|
selection.remove(id);
|
||||||
} else {
|
} else {
|
||||||
if (node.isPage() && node.getChildren()?.notEmpty()) {
|
if (node.isPage() && node.getChildren()?.notEmpty()) {
|
||||||
@ -344,7 +340,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
|||||||
?.getId();
|
?.getId();
|
||||||
if (firstChildId) id = firstChildId;
|
if (firstChildId) id = firstChildId;
|
||||||
}
|
}
|
||||||
selection?.select(id);
|
selection.select(id);
|
||||||
|
|
||||||
// dirty code should refector
|
// dirty code should refector
|
||||||
const editor = this.designer?.editor;
|
const editor = this.designer?.editor;
|
||||||
@ -365,15 +361,15 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
|||||||
let ignoreUpSelected = false;
|
let ignoreUpSelected = false;
|
||||||
if (isMulti) {
|
if (isMulti) {
|
||||||
// multi select mode, directily add
|
// multi select mode, directily add
|
||||||
if (!selection?.has(node.id)) {
|
if (!selection.has(node.id)) {
|
||||||
designer.activeTracker.track({ node, instance: nodeInst?.instance });
|
designer.activeTracker.track({ node, instance: nodeInst?.instance });
|
||||||
selection?.add(node.id);
|
selection.add(node.id);
|
||||||
ignoreUpSelected = true;
|
ignoreUpSelected = true;
|
||||||
}
|
}
|
||||||
selection?.remove(documentModel.rootNode.id);
|
selection.remove(documentModel.rootNode.id);
|
||||||
// 获得顶层 nodes
|
// 获得顶层 nodes
|
||||||
nodes = selection?.getTopNodes();
|
nodes = selection.getTopNodes();
|
||||||
} else if (selection?.containsNode(node, true)) {
|
} else if (selection.containsNode(node, true)) {
|
||||||
nodes = selection.getTopNodes();
|
nodes = selection.getTopNodes();
|
||||||
} else {
|
} else {
|
||||||
// will clear current selection & select dragment in dragstart
|
// will clear current selection & select dragment in dragstart
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user