mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-26 08:04:56 +01:00
Fix save of relationship control points
This commit is contained in:
parent
6c1b753f71
commit
1d2be6a70c
@ -47,17 +47,14 @@ class XMLSerializer_Pela {
|
|||||||
|
|
||||||
// Create branches ...
|
// Create branches ...
|
||||||
const topics = mindmap.getBranches();
|
const topics = mindmap.getBranches();
|
||||||
for (let i = 0; i < topics.length; i++) {
|
topics.forEach((topic) => {
|
||||||
const topic = topics[i];
|
|
||||||
const topicDom = this._topicToXML(document, topic);
|
const topicDom = this._topicToXML(document, topic);
|
||||||
mapElem.appendChild(topicDom);
|
mapElem.appendChild(topicDom);
|
||||||
}
|
});
|
||||||
|
|
||||||
// Create Relationships
|
// Create Relationships
|
||||||
const relationships = mindmap.getRelationships();
|
const relationships = mindmap.getRelationships();
|
||||||
if (relationships.length > 0) {
|
relationships.forEach((relationship) => {
|
||||||
for (let j = 0; j < relationships.length; j++) {
|
|
||||||
const relationship = relationships[j];
|
|
||||||
if (
|
if (
|
||||||
mindmap.findNodeById(relationship.getFromNode()) !== null
|
mindmap.findNodeById(relationship.getFromNode()) !== null
|
||||||
&& mindmap.findNodeById(relationship.getToNode()) !== null
|
&& mindmap.findNodeById(relationship.getToNode()) !== null
|
||||||
@ -66,8 +63,7 @@ class XMLSerializer_Pela {
|
|||||||
const relationDom = XMLSerializer_Pela._relationshipToXML(document, relationship);
|
const relationDom = XMLSerializer_Pela._relationshipToXML(document, relationship);
|
||||||
mapElem.appendChild(relationDom);
|
mapElem.appendChild(relationDom);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
|
||||||
|
|
||||||
return document;
|
return document;
|
||||||
}
|
}
|
||||||
@ -156,9 +152,7 @@ class XMLSerializer_Pela {
|
|||||||
|
|
||||||
// Serialize features ...
|
// Serialize features ...
|
||||||
const features = topic.getFeatures();
|
const features = topic.getFeatures();
|
||||||
for (let i = 0; i < features.length; i++) {
|
features.forEach((feature) => {
|
||||||
const feature = features[i];
|
|
||||||
|
|
||||||
const featureType = feature.getType();
|
const featureType = feature.getType();
|
||||||
const featureDom = document.createElement(featureType);
|
const featureDom = document.createElement(featureType);
|
||||||
const attributes = feature.getAttributes();
|
const attributes = feature.getAttributes();
|
||||||
@ -173,15 +167,15 @@ class XMLSerializer_Pela {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
parentTopic.appendChild(featureDom);
|
parentTopic.appendChild(featureDom);
|
||||||
}
|
});
|
||||||
|
|
||||||
// CHILDREN TOPICS
|
// CHILDREN TOPICS
|
||||||
const childTopics = topic.getChildren();
|
const childTopics = topic.getChildren();
|
||||||
for (let j = 0; j < childTopics.length; j++) {
|
childTopics.forEach((childTopic) => {
|
||||||
const childTopic = childTopics[j];
|
|
||||||
const childDom = this._topicToXML(document, childTopic);
|
const childDom = this._topicToXML(document, childTopic);
|
||||||
parentTopic.appendChild(childDom);
|
parentTopic.appendChild(childDom);
|
||||||
}
|
});
|
||||||
|
|
||||||
return parentTopic;
|
return parentTopic;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,9 +367,8 @@ class XMLSerializer_Pela {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Creating icons and children nodes
|
// Creating icons and children nodes
|
||||||
const children = domElem.childNodes;
|
const children = Array.from(domElem.childNodes);
|
||||||
for (let i = 0; i < children.length; i++) {
|
children.forEach((child) => {
|
||||||
const child = children[i];
|
|
||||||
if (child.nodeType === Node.ELEMENT_NODE) {
|
if (child.nodeType === Node.ELEMENT_NODE) {
|
||||||
if (child.tagName === 'topic') {
|
if (child.tagName === 'topic') {
|
||||||
const childTopic = this._deserializeNode(child, mindmap);
|
const childTopic = this._deserializeNode(child, mindmap);
|
||||||
@ -404,7 +397,8 @@ class XMLSerializer_Pela {
|
|||||||
topic.setText(nodeText);
|
topic.setText(nodeText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
return topic;
|
return topic;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,7 +440,7 @@ class XMLSerializer_Pela {
|
|||||||
static _deserializeRelationship(domElement, mindmap) {
|
static _deserializeRelationship(domElement, mindmap) {
|
||||||
const srcId = Number.parseInt(domElement.getAttribute('srcTopicId'), 10);
|
const srcId = Number.parseInt(domElement.getAttribute('srcTopicId'), 10);
|
||||||
const destId = Number.parseInt(domElement.getAttribute('destTopicId'), 10);
|
const destId = Number.parseInt(domElement.getAttribute('destTopicId'), 10);
|
||||||
const lineType = domElement.getAttribute('lineType');
|
const lineType = Number.parseInt(domElement.getAttribute('lineType'), 10);
|
||||||
const srcCtrlPoint = domElement.getAttribute('srcCtrlPoint');
|
const srcCtrlPoint = domElement.getAttribute('srcCtrlPoint');
|
||||||
const destCtrlPoint = domElement.getAttribute('destCtrlPoint');
|
const destCtrlPoint = domElement.getAttribute('destCtrlPoint');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user