Skip to content

Commit

Permalink
Allow for drawing images with negative coords. Remove redundant check
Browse files Browse the repository at this point in the history
  • Loading branch information
danngreen committed Nov 14, 2023
1 parent dc50094 commit 7be589f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions firmware/src/VCV_adaptor/helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ T *createElementWidget(math::Vec pos, MetaModule::Coords coord_ref, std::string_
{
auto *o = new T;
if (coord_ref == MetaModule::Coords::TopLeft) {
if (o->background->box.pos.x != 0.f)
pos.x += o->background->box.pos.x;
if (o->background->box.pos.y != 0.f)
pos.y += o->background->box.pos.y;
pos.x += o->background->box.pos.x;
pos.y += o->background->box.pos.y;
}
pos.x = MetaModule::ModuleInfoBase::to_mm(pos.x);
pos.y = MetaModule::ModuleInfoBase::to_mm(pos.y);
Expand Down
4 changes: 2 additions & 2 deletions firmware/src/gui/elements/draw_img.hh
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ draw_image(float x, float y, Coords coord_ref, const lv_img_dsc_t *img, lv_obj_t
lv_img_set_antialias(obj, true);
lv_obj_set_align(obj, LV_ALIGN_TOP_LEFT);

uint16_t pos_x = std::round(x);
uint16_t pos_y = std::round(y);
int16_t pos_x = std::round(x);
int16_t pos_y = std::round(y);
lv_obj_set_pos(obj, pos_x, pos_y);
lv_img_set_pivot(obj, width / 2.f, height / 2.f);

Expand Down

0 comments on commit 7be589f

Please sign in to comment.