Fix console error log

This commit is contained in:
Paulo Gustavo Veiga 2021-12-14 17:20:41 -08:00
parent a8a601f351
commit 5b74b9cff3

View File

@ -192,11 +192,9 @@ class Designer extends Events {
const dragManager = new DragManager(workspace, this._eventBussDispatcher); const dragManager = new DragManager(workspace, this._eventBussDispatcher);
const topics = designerModel.getTopics(); const topics = designerModel.getTopics();
dragManager.addEvent('startdragging', () => {
// Enable all mouse events. // Enable all mouse events.
for (let i = 0; i < topics.length; i++) { dragManager.addEvent('startdragging', () => {
topics[i].setMouseEventsEnabled(false); topics.forEach((topic) => topic.setMouseEventsEnabled(false));
}
}); });
dragManager.addEvent('dragging', (event, dragTopic) => { dragManager.addEvent('dragging', (event, dragTopic) => {
@ -212,9 +210,7 @@ class Designer extends Events {
}); });
dragManager.addEvent('enddragging', (event, dragTopic) => { dragManager.addEvent('enddragging', (event, dragTopic) => {
for (let i = 0; i < topics.length; i++) { topics.forEach((topic) => topic.setMouseEventsEnabled(true));
topics[i].setMouseEventsEnabled(true);
}
dragTopic.applyChanges(workspace); dragTopic.applyChanges(workspace);
}); });
@ -308,9 +304,7 @@ class Designer extends Events {
onObjectFocusEvent(currentObject, event) { onObjectFocusEvent(currentObject, event) {
// Close node editors .. // Close node editors ..
const topics = this.getModel().getTopics(); const topics = this.getModel().getTopics();
topics.forEach((topic) => { topics.forEach((topic) => topic.closeEditors());
topic.closeEditors();
});
const model = this.getModel(); const model = this.getModel();
const objects = model.getEntities(); const objects = model.getEntities();
@ -666,19 +660,14 @@ class Designer extends Events {
// Building node graph ... // Building node graph ...
const branches = mindmapModel.getBranches(); const branches = mindmapModel.getBranches();
for (let i = 0; i < branches.length; i++) { branches.forEach((branch) => {
// NodeModel -> NodeGraph ... const nodeGraph = this.nodeModelToNodeGraph(branch);
const nodeModel = branches[i];
const nodeGraph = this.nodeModelToNodeGraph(nodeModel);
// Update shrink render state...
nodeGraph.setBranchVisibility(true); nodeGraph.setBranchVisibility(true);
} });
// Connect relationships ...
const relationships = mindmapModel.getRelationships(); const relationships = mindmapModel.getRelationships();
for (let j = 0; j < relationships.length; j++) { relationships.forEach((relationship) => this._relationshipModelToRelationship(relationship));
this._relationshipModelToRelationship(relationships[j]);
}
// Place the focus on the Central Topic // Place the focus on the Central Topic
const centralTopic = this.getModel().getCentralTopic(); const centralTopic = this.getModel().getCentralTopic();
@ -720,16 +709,16 @@ class Designer extends Events {
let children = nodeModel.getChildren().slice(); let children = nodeModel.getChildren().slice();
children = children.sort((a, b) => a.getOrder() - b.getOrder()); children = children.sort((a, b) => a.getOrder() - b.getOrder());
const nodeGraph = this._buildNodeGraph(nodeModel, this.isReadOnly()); const result = this._buildNodeGraph(nodeModel, this.isReadOnly());
nodeGraph.setVisibility(false); result.setVisibility(false);
this._workspace.append(nodeGraph); this._workspace.append(result);
for (let i = 0; i < children.length; i++) { children.forEach((child) => {
const child = children[i]; if ($defined(child)) {
if ($defined(child)) this.nodeModelToNodeGraph(child); this.nodeModelToNodeGraph(child);
} }
});
return nodeGraph; return result;
} }
/** /**