Files no longer render name, and also fixed a bug where the very first object can't be edited
This commit is contained in:
parent
b2f2070f95
commit
d19b5c4cb0
2 changed files with 1 additions and 11 deletions
|
|
@ -135,7 +135,7 @@ void EditTool::tool_update() {
|
||||||
|
|
||||||
drawP.compCache.traverse_bvh_run_function(mouseAABB, [&](const std::shared_ptr<DrawingProgramCacheBVHNode>& bvhNode, const std::vector<CollabListType::ObjectInfoPtr>& components) {
|
drawP.compCache.traverse_bvh_run_function(mouseAABB, [&](const std::shared_ptr<DrawingProgramCacheBVHNode>& bvhNode, const std::vector<CollabListType::ObjectInfoPtr>& components) {
|
||||||
for(auto& c : components) {
|
for(auto& c : components) {
|
||||||
if(c->pos > lastPos && c->obj->collides_with_world_coords(drawP.world.drawData.cam.c, cMouseAABB)) {
|
if(c->pos >= lastPos && c->obj->collides_with_world_coords(drawP.world.drawData.cam.c, cMouseAABB)) {
|
||||||
lastSelectedObj = c;
|
lastSelectedObj = c;
|
||||||
lastPos = c->pos;
|
lastPos = c->pos;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,16 +44,6 @@ void FileResourceDisplay::draw(SkCanvas* canvas, const DrawData& drawData, const
|
||||||
canvas->scale(imRect.width() / svgDom->containerSize().width(), imRect.height() / svgDom->containerSize().height());
|
canvas->scale(imRect.width() / svgDom->containerSize().width(), imRect.height() / svgDom->containerSize().height());
|
||||||
svgDom->render(canvas);
|
svgDom->render(canvas);
|
||||||
canvas->restore();
|
canvas->restore();
|
||||||
|
|
||||||
SkFont f = io->get_font(40.0f);
|
|
||||||
SkFontMetrics metrics;
|
|
||||||
f.getMetrics(&metrics);
|
|
||||||
|
|
||||||
float nextText = f.measureText(fileName.c_str(), fileName.length(), SkTextEncoding::kUTF8, nullptr);
|
|
||||||
Vector2f bounds{nextText, - metrics.fAscent + metrics.fDescent};
|
|
||||||
|
|
||||||
SkPaint fontPaint(drawData.main->canvasTheme.toolFrontColor);
|
|
||||||
canvas->drawSimpleText(fileName.c_str(), fileName.length(), SkTextEncoding::kUTF8, imRect.x() + imRect.width() * 0.5f - bounds.x() * 0.5f, imRect.y() + imRect.height() + bounds.y(), f, fontPaint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2f FileResourceDisplay::get_dimensions() const {
|
Vector2f FileResourceDisplay::get_dimensions() const {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue