FIX: Can't edit text

github: 3750
Change-Id: I1caecaa968e60cadcdbe9f7aa67cba141bb88230
This commit is contained in:
zhimin.zeng 2024-03-27 12:02:11 +08:00 committed by Lane.Wei
parent 11d711bc4b
commit 2e426c8f96
1 changed files with 2 additions and 4 deletions

View File

@ -1117,10 +1117,8 @@ bool GLGizmoText::update_text_positions(const std::vector<std::string>& texts)
Polygons polys = union_(temp_polys);
auto point_in_line_rectange = [](const Line &line, const Point &point, double& distance) {
distance = abs((point.x() - line.a.x()) * (line.b.y() - line.a.y()) - (line.b.x() - line.a.x()) * (point.y() - line.a.y()));
bool in_rectange = (std::min(line.a.x(), line.b.x()) - 1000) <= point.x() && point.x() <= (std::max(line.a.x(), line.b.x()) + 1000) &&
(std::min(line.a.y(), line.b.y()) - 1000) <= point.y() && point.y() <= (std::max(line.a.y(), line.b.y()) + 1000);
return in_rectange;
distance = line.distance_to(point);
return distance < line.length() / 2;
};
int index = 0;