Skip to content

Commit f60de67

Browse files
committed
Lua: fix rendering bounds
1 parent b6832d6 commit f60de67

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

Source/Objects/LuaObject.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ class LuaObject final : public ObjectBase
384384
int x = 0, y = 0, w = 0, h = 0;
385385
pd::Interface::getObjectBounds(patch, gobj.cast<t_gobj>(), &x, &y, &w, &h);
386386

387-
return Rectangle<int>(x, y, gobj->gfx.width + 2, gobj->gfx.height + 2);
387+
return Rectangle<int>(x, y, gobj->gfx.width + 1, gobj->gfx.height + 1);
388388
}
389389

390390
return { };
@@ -396,8 +396,8 @@ class LuaObject final : public ObjectBase
396396
auto* patch = object->cnv->patch.getRawPointer();
397397

398398
pd::Interface::moveObject(patch, gobj.cast<t_gobj>(), b.getX(), b.getY());
399-
gobj->gfx.width = b.getWidth() - 2;
400-
gobj->gfx.height = b.getHeight() - 2;
399+
gobj->gfx.width = b.getWidth() - 1;
400+
gobj->gfx.height = b.getHeight() - 1;
401401
}
402402

403403
sendRepaintMessage();
@@ -875,6 +875,9 @@ class LuaObject final : public ObjectBase
875875
auto const outlineColour = isSelected ? cnv->selectedOutlineCol : cnv->objectOutlineCol;
876876

877877
nvgDrawRoundedRect(nvg, bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight(), nvgColour(currentColour), outlineColour, Corners::objectCornerRadius);
878+
879+
// Make sure subsequent draw calls cannot render over the outline
880+
nvgIntersectRoundedScissor(nvg, bounds.getX() + 0.75f, bounds.getY() + 0.75f, bounds.getWidth() - 1.5f, bounds.getHeight() - 1.5f, Corners::objectCornerRadius);
878881
break;
879882
}
880883
case hash("lua_draw_svg"): {

0 commit comments

Comments
 (0)