java - Text editing in JSVGCanvas -
this online svg editing, have text editing, can in jsvgcanvas?
http://svg-edit.googlecode.com/svn-history/r1771/trunk/editor/svg-editor.html
at first jsvgcanvas should display empty svg this:
domimplementation imp = svgdomimplementation.getdomimplementation(); documenttype type = imp.createdocumenttype(svgconstants.svg_public_id, svgconstants.svg_system_id, null); document svgdoc = imp.createdocument(svgdomimplementation.svg_namespace_uri, "svg", type); jsvgcanvas canvas = new svgcanvas(new svguseragentadapter(), true, true); canvas.setdocumentstate(jsvgcanvas.always_dynamic); canvas.setsvgdocument(svgdoc); add mouse , key listeners getting x, y , text. after create text element:
element textelement = svgdoc.createelementns(svgns, "text"); textelement.setattributens(null, "x", x); textelement.setattributens(null, "y", y); textelement.settextcontent(text); svgdoc.getdocumentelement().appendchild(textelement); selection text provided textselectionmanager jsvgcanvas:
canvas.gettextselectionmanager()
Comments
Post a Comment