Skip to content

Commit

Permalink
Fix transform of polyline and path
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangfitus committed Nov 28, 2023
1 parent 01e8da1 commit f1a5cb6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,8 @@ void Parser::parseObjects(std::string file_name) {
if (attribute.first == "transform") {
for (auto &object_attribute : object.second) {
if (object_attribute.first == "transform") {
object_attribute.second =
attribute.second + " " +
object_attribute.second;
object_attribute.second +=
" " + attribute.second;
}
}
}
Expand Down Expand Up @@ -407,7 +406,6 @@ std::vector< std::string > Parser::getTransformOrder(Attributes attributes) {
}

void Parser::parseSVG() {
printObjects();
for (auto object : objects) {
std::string name = object.first;
Attributes attributes = object.second;
Expand Down Expand Up @@ -509,6 +507,7 @@ void Parser::parsePolyline(Attributes attributes) {
for (auto point : points) {
shape->addPoint(point);
}
shape->setTransforms(getTransformOrder(attributes));
shapes.push_back(shape);
}

Expand All @@ -535,6 +534,7 @@ void Parser::parsePath(Attributes attributes) {
for (auto point : points) {
shape->addPoint(point);
}
shape->setTransforms(getTransformOrder(attributes));
shapes.push_back(shape);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ int main() {
Viewer *viewer = Viewer::getInstance(window, view);
Parser *parser = Parser::getInstance("external/samples/mixed/sample8.svg");
Renderer *renderer = Renderer::getInstance(window);
parser->printObjects();

while (window.isOpen()) {
sf::Event event;

Expand Down

0 comments on commit f1a5cb6

Please sign in to comment.