I’m implementing a “free-form” line where the user can draw by pressing and holding the mouse.  This is for a whiteboard application.  I sample the mouse locations, get a collection of Points, and then create a “polyline” element from the results and append it to the document (in the RunnableQueue) which should update my JSVGCanvas (set to ALWAYS_DYNAMIC).  This will not update the screen!  I can draw other shapes using the SVGShape class (Ellipse, Rectangle, Line) and they all work fine.  Even drawing after the polyline does not cause the polyline to be rendered.  However, if I save the SVGDocument to a file, then load it, the polyline shows up??

 

In essence, appending a polyline Element to a document does not seem to update the JSVGCanvas while other Element types seem to work.  Any suggestions?

 

SVG Before (Empty Canvas):

<svg contentScriptType="text/ecmascript" fill="none" width="480" xmlns:xlink="http://www.w3.org/1999/xlink" zoomAndPan="magnify" contentStyleType="text/css" height="272" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" version="1.0"></svg>

 

SVG After (Polyline drawn, no updates):

<svg contentScriptType="text/ecmascript" fill="none" width="480" xmlns:xlink="http://www.w3.org/1999/xlink" zoomAndPan="magnify" contentStyleType="text/css" height="272" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" version="1.0">

<polyline stroke-opacity="1" points="23,16 32,26 45,38 67,57 89,76 111,90 145,92 176,84 184,73" stroke="black"></polyline>

</svg>

 

Michael Bishop

Reply via email to