plugins/raphael.export.js
authorEdward <edward@roojs.com>
Wed, 9 Jan 2019 08:43:08 +0000 (16:43 +0800)
committerEdward <edward@roojs.com>
Wed, 9 Jan 2019 08:43:08 +0000 (16:43 +0800)
plugins/raphael.export.js

index 29795cf..e0e3ae8 100644 (file)
             Roo.log(style);
             var tags = new Array;
             
-            var text = node.attrs['text'].split('\n');
+            var content = [];
             
-            var test = tag('tspan',
+            map(node.attrs['text'].split('\n'), function (text, iterable, line) {
+                content.push(tag('tspan',
                     {
-                        dy: computeTSpanDy(style.font.size, 1, 2)
+                        x: node.attrs.x,
+                        dy: computeTSpanDy(style.font.size, line + 1, node.attrs['text'].split('\n').length)
                     },
                     null,
-                    escapeXML("test11")
-            );
-            var test2 = tag('tspan',
-                    {
-                        dy: computeTSpanDy(style.font.size, 2, 2)
-                    },
-                    null,
-                    escapeXML("test22")
-            );
+                    escapeXML(text)
+                ))
+            });
             
             tags.push(tag(
                 'text',
                     }
                 ),
                 node.matrix,
-                test + test2
+                content.join("")
             ));
             
 //            map(node.attrs['text'].split('\n'), function (text, iterable, line) {