Skip to content

Commit

Permalink
Merge pull request #86 from Matthijs-Ridder/feat-adding-hw-to-infobox
Browse files Browse the repository at this point in the history
feat: Updated image_box function to use adapt_range
  • Loading branch information
asalzburger authored Aug 29, 2024
2 parents 6e55ea8 + 702671f commit d2a288f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions core/include/actsvg/core/draw.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ svg::object connected_text(
const style::transform &transform_, const svg::object &object_,
const std::vector<std::string> &highlight_ = {"mouseover", "mouseout"});

/** Draw a image object - connected
/** Draw an image object - connected
*
* @param id_ is the image object id
* @param href_ is the image object href field
Expand All @@ -247,8 +247,8 @@ svg::object connected_text(
*
**/
svg::object image_box(const std::string &id_, const std::string &href_,
const std::string &height_, const std::string &width_,
const std::string &x_, const std::string &y_,
const scalar &height_, const scalar &width_,
const scalar &x_, const scalar &y_,
const svg::object &object_,
const std::vector<std::string> &highlight_,
const std::string &onerror_);
Expand Down
14 changes: 8 additions & 6 deletions core/src/core/draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,8 @@ svg::object connected_text(const std::string &id_, const point2 &p_,
}

svg::object image_box(const std::string &id_, const std::string &href_,
const std::string &height_, const std::string &width_,
const std::string &x_, const std::string &y_,
const scalar &height_, const scalar &width_,
const scalar &x_, const scalar &y_,
const svg::object &object_,
const std::vector<std::string> &highlight_,
const std::string &onerror_) {
Expand All @@ -460,10 +460,10 @@ svg::object image_box(const std::string &id_, const std::string &href_,
svg::object imgb;
imgb._tag = "image";
imgb._attribute_map["href"] = href_;
imgb._attribute_map["height"] = height_;
imgb._attribute_map["width"] = width_;
imgb._attribute_map["x"] = x_;
imgb._attribute_map["y"] = y_;
imgb._attribute_map["height"] = utils::to_string(height_);
imgb._attribute_map["width"] = utils::to_string(width_);
imgb._attribute_map["x"] = utils::to_string(x_);
imgb._attribute_map["y"] = utils::to_string(y_);
imgb._attribute_map["onerror"] = onerror_;

i.add_object(imgb);
Expand Down Expand Up @@ -494,6 +494,8 @@ svg::object image_box(const std::string &id_, const std::string &href_,
i._sub_objects.push_back(off);
}

detail::adapt_range(i, {{x_, y_}, {x_ + width_, y_ + height_}});

return i;
}

Expand Down

0 comments on commit d2a288f

Please sign in to comment.