From 9c7376c3604305d0d809283affa6fc6c3618258a Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Wed, 30 Nov 2022 19:45:16 -0800 Subject: [PATCH] Fix contrl point load. --- .../src/components/commands/MoveControlPointCommand.ts | 2 +- .../src/components/persistence/XMLSerializerTango.ts | 5 +++++ .../mindplot/test/unit/export/expected/cdata-support.wxml | 2 +- packages/mindplot/test/unit/export/expected/complex.wxml | 2 +- packages/mindplot/test/unit/export/expected/issue.wxml | 2 +- packages/mindplot/test/unit/export/expected/npe.wxml | 2 +- packages/mindplot/test/unit/export/expected/process.mm | 2 ++ packages/mindplot/test/unit/export/expected/process.wxml | 2 +- packages/web2d/src/components/Point.js | 2 +- 9 files changed, 14 insertions(+), 7 deletions(-) diff --git a/packages/mindplot/src/components/commands/MoveControlPointCommand.ts b/packages/mindplot/src/components/commands/MoveControlPointCommand.ts index ac9ec39f..4c657a76 100644 --- a/packages/mindplot/src/components/commands/MoveControlPointCommand.ts +++ b/packages/mindplot/src/components/commands/MoveControlPointCommand.ts @@ -61,7 +61,7 @@ class MoveControlPointCommand extends Command { default: throw new Error('Illegal state exception'); } - this._controlPoint = { ...oldCtlPoint }; + this._controlPoint = oldCtlPoint ? { ...oldCtlPoint } : null; relationship.redraw(); relationship.setOnFocus(true); diff --git a/packages/mindplot/src/components/persistence/XMLSerializerTango.ts b/packages/mindplot/src/components/persistence/XMLSerializerTango.ts index d5fe827f..0b3de705 100644 --- a/packages/mindplot/src/components/persistence/XMLSerializerTango.ts +++ b/packages/mindplot/src/components/persistence/XMLSerializerTango.ts @@ -497,12 +497,17 @@ class XMLSerializerTango implements XMLMindmapSerializer { const spoint = Point.fromString(srcCtrlPoint); if (spoint) { model.setSrcCtrlPoint(spoint); + } else { + console.error(`srcCtrlPoint could not be parsed: ${srcCtrlPoint}`); } const dpoint = Point.fromString(destCtrlPoint); if (dpoint) { model.setDestCtrlPoint(dpoint); + } else { + console.error(`destCtrlPoint could not be parsed: ${destCtrlPoint}`); } + model.setEndArrow(false); model.setStartArrow(true); return model; diff --git a/packages/mindplot/test/unit/export/expected/cdata-support.wxml b/packages/mindplot/test/unit/export/expected/cdata-support.wxml index 10aa4102..fe1172ed 100644 --- a/packages/mindplot/test/unit/export/expected/cdata-support.wxml +++ b/packages/mindplot/test/unit/export/expected/cdata-support.wxml @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/packages/mindplot/test/unit/export/expected/complex.wxml b/packages/mindplot/test/unit/export/expected/complex.wxml index d03e68a8..722b017d 100644 --- a/packages/mindplot/test/unit/export/expected/complex.wxml +++ b/packages/mindplot/test/unit/export/expected/complex.wxml @@ -48,4 +48,4 @@ Attached below a sample of such screening questions]]> \ No newline at end of file + Again, decrease the learning curve.]]> \ No newline at end of file diff --git a/packages/mindplot/test/unit/export/expected/issue.wxml b/packages/mindplot/test/unit/export/expected/issue.wxml index 54346249..15e23d69 100644 --- a/packages/mindplot/test/unit/export/expected/issue.wxml +++ b/packages/mindplot/test/unit/export/expected/issue.wxml @@ -15,4 +15,4 @@ calculo navegar en internet, base de datos, etc.]]> \ No newline at end of file +escuchar música, ver videos, calcular, comunicarnos con otras personas, etc-]]> \ No newline at end of file diff --git a/packages/mindplot/test/unit/export/expected/npe.wxml b/packages/mindplot/test/unit/export/expected/npe.wxml index 13694870..9f021d19 100644 --- a/packages/mindplot/test/unit/export/expected/npe.wxml +++ b/packages/mindplot/test/unit/export/expected/npe.wxml @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/packages/mindplot/test/unit/export/expected/process.mm b/packages/mindplot/test/unit/export/expected/process.mm index 73dd081d..de5085b4 100644 --- a/packages/mindplot/test/unit/export/expected/process.mm +++ b/packages/mindplot/test/unit/export/expected/process.mm @@ -37,6 +37,8 @@ + + diff --git a/packages/mindplot/test/unit/export/expected/process.wxml b/packages/mindplot/test/unit/export/expected/process.wxml index f172aa52..c6a4f998 100644 --- a/packages/mindplot/test/unit/export/expected/process.wxml +++ b/packages/mindplot/test/unit/export/expected/process.wxml @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/packages/web2d/src/components/Point.js b/packages/web2d/src/components/Point.js index ab445ac0..5fa0ba0f 100644 --- a/packages/web2d/src/components/Point.js +++ b/packages/web2d/src/components/Point.js @@ -44,7 +44,7 @@ Point.fromString = function pointFromString(point) { let result = null; if (point) { const values = point.split(','); - if (values.lenght > 1) { + if (values.length === 2) { const x = Number.parseInt(values[0], 10); const y = Number.parseInt(values[1], 10);