Skip to content

Commit

Permalink
fix in svg to html export
Browse files Browse the repository at this point in the history
  • Loading branch information
Artanidos committed Oct 18, 2018
1 parent 18c8bd7 commit f03ec0d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
15 changes: 5 additions & 10 deletions Widgets/vectorgraphic.cpp
Expand Up @@ -62,9 +62,12 @@ Vectorgraphic::Vectorgraphic(QByteArray arr, AnimationScene *scene)
setRect(0, 0, m_svg->boundingRect().width(), m_svg->boundingRect().height());
}

QString Vectorgraphic::getHtml(QString, QString)
QString Vectorgraphic::getHtml(QString id, QString)
{
return QString(m_data);
QString svg = QString(m_data);
int start = svg.indexOf("<svg");
int end = svg.lastIndexOf("</svg>");
return "<svg id=\"" + id + "\" style=\"transform: scale(" + QString::number(xscale()) +"," + QString::number(yscale()) + "); transform-origin: 0px 0px;\"" + svg.mid(start + 4, end - start + 2);
}

QDomElement Vectorgraphic::getXml(QDomDocument doc)
Expand All @@ -87,14 +90,6 @@ QDomElement Vectorgraphic::getXml(QDomDocument doc)
return ele;
}

QString Vectorgraphic::getInnerSvg()
{
QString svg = QString(m_data);
int start = svg.indexOf("<", svg.indexOf("<svg") + 1);
int end = svg.lastIndexOf("</svg>");
return "<g transform=\"scale(" + QString::number(xscale()) +"," + QString::number(yscale()) + ")\">" + svg.mid(start, end - start) + "</g>";
}

QStringList Vectorgraphic::getPropertyList()
{
QStringList list;
Expand Down
1 change: 0 additions & 1 deletion Widgets/vectorgraphic.h
Expand Up @@ -53,7 +53,6 @@ class WIDGETSSHARED_EXPORT Vectorgraphic : public AnimationItem
QDomElement getXml(QDomDocument);
bool hasBrushAndPen() {return false;}

QString getInnerSvg();
QStringList getPropertyList() Q_DECL_OVERRIDE;

signals:
Expand Down
1 change: 1 addition & 0 deletions todo.txt
Expand Up @@ -21,3 +21,4 @@

- effects like shadow

- ask to save animation closing the pogram or loading / new

0 comments on commit f03ec0d

Please sign in to comment.