how to raphael.serialize only visible elements?
i would like to serialize only visible elements on my paper.
i have done some research about checking if an element is visible or not andi found an answer on How to know if raphael object is hidden?
i changed raphael.serialize.js file and on line 16 i made this change:
if (node && node.type) {
to
if (node && node.type && node.style.display !== "none") {
but in this way i get null content.
how can i get this working?
update: what i need is to convert a paper to svg. based on: http://www.benbarnett.net/2010/06/04/export-svg-from-raphael-js-to-create-a-pn开发者_开发百科g-bitmap/
i found a soltion. i have notices on git that there are some pulls requests, so after checking in one of them was an anwser for my question. here are details: https://github.com/jspies/raphael.serialize/pull/3/commits
however what is needed to be added is:
if( node.node.style.display == "none" ) break;
under every case of node.type
I'm not familiar with Raphaël, but maybe some of the nodes don't have a style
property.
Try something like:
if (node && node.type && (node.style || {}).display !== "none") {
// ...
}
精彩评论