{"action":"created","comment":{"url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/pulls/comments/59122547","id":59122547,"diff_hunk":"@@ -34,21 +34,67 @@ void LCDimRadial::draw(LcPainter& painter, const LcDrawOptions &options, const l\n     \n     // Draw line\n     EndCaps endCaps;\n-    auto tLinePos = !mouseIsInside\n-      ? mousePos.move(mousePos - lc::geo::Coordinate(definitionPoint().x(), mousePos.y()), te.width + capSize)\n-      : mousePos.move(mousePos - lc::geo::Coordinate(definitionPoint().x(), mousePos.y()), -te.width - capSize);\n-\n-    auto tMText = !mouseIsInside\n-      ? mousePos.move(mousePos - lc::geo::Coordinate(definitionPoint().x(), mousePos.y()), te.width / 2 + capSize / 2)\n-      : mousePos.move(mousePos - lc::geo::Coordinate(definitionPoint().x(), mousePos.y()), -te.width / 2 - capSize / 2);\n-      \n-    painter.move_to(definitionPoint2().x(), definitionPoint2().y());\n-    painter.line_to(mousePos.x(), mousePos.y());\n-    painter.line_to(tLinePos.x(), mousePos.y());\n-    painter.stroke();\n-    endCaps.render(painter, EndCaps::CLOSEDARROW, mousePos.x(), mousePos.y(), definitionPoint2().x(), definitionPoint2().y(), capSize) ;\n-\n-    this->drawText(value, textAngle(), lc::TextConst::AttachmentPoint::Top_center, tMText, painter, options, rect);\n+\n+    const bool textisInside = middleOfText().distanceTo(mousePos) < radiusCircle;\n+    const bool textFitsInside = radiusCircle * 2. > te.width;\n+\n+    if (textisInside && textFitsInside) {\n+        auto tLinePos = (definitionPoint2().x() > mousePos.x())\n+                ? lc::geo::Coordinate(mousePos.x() - (te.width + capSize), mousePos.y())\n+                : lc::geo::Coordinate(mousePos.x() + (te.width + capSize), mousePos.y());\n+        auto tMText = (definitionPoint2().x() > mousePos.x())\n+                ? lc::geo::Coordinate(mousePos.x() - (te.width/2 + capSize/2), mousePos.y() - (te.width/4 + capSize/2))\n+                : lc::geo::Coordinate(mousePos.x() + (te.width/2 + capSize/2), mousePos.y() - (te.width/4 + capSize/2));\n+\n+        if (definitionPoint2().y() <= mousePos.y()) {\n+            tMText = (definitionPoint2().x() > mousePos.x())\n+                    ? lc::geo::Coordinate(mousePos.x() - (te.width/2 + capSize/2), mousePos.y())\n+                    : lc::geo::Coordinate(mousePos.x() + (te.width/2 + capSize/2), mousePos.y());\n+        }\n+\n+        painter.move_to(definitionPoint2().x(), definitionPoint2().y());\n+        painter.line_to(mousePos.x(), mousePos.y());\n+        painter.line_to(tLinePos.x(), mousePos.y());\n+        painter.stroke();\n+        endCaps.render(painter, EndCaps::CLOSEDARROW, mousePos.x(), mousePos.y(), definitionPoint2().x(), definitionPoint2().y(), capSize) ;\n+","path":"lcviewernoqt/drawitems/lcdimradial.cpp","position":51,"original_position":51,"commit_id":"6fcb60bd8f5395288b11fac186e7f82329fd7002","original_commit_id":"6fcb60bd8f5395288b11fac186e7f82329fd7002","user":{"login":"rvt","id":720814,"avatar_url":"https://avatars.githubusercontent.com/u/720814?v=3","gravatar_id":"","url":"https://api.github.com/users/rvt","html_url":"https://github.com/rvt","followers_url":"https://api.github.com/users/rvt/followers","following_url":"https://api.github.com/users/rvt/following{/other_user}","gists_url":"https://api.github.com/users/rvt/gists{/gist_id}","starred_url":"https://api.github.com/users/rvt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rvt/subscriptions","organizations_url":"https://api.github.com/users/rvt/orgs","repos_url":"https://api.github.com/users/rvt/repos","events_url":"https://api.github.com/users/rvt/events{/privacy}","received_events_url":"https://api.github.com/users/rvt/received_events","type":"User","site_admin":false},"body":"dli,\r\n\r\nperhaps we can create some header for that adaptive interface with some generic (wildly guessing).\r\nI wanted to keep our entities (Coordinate etc... etc) out of the painter functions so we don't have potential circular references, or at a minimum that the painter doesn't depend on the geo classes..","created_at":"2016-04-09T22:22:16Z","updated_at":"2016-04-09T22:22:16Z","html_url":"https://github.com/LibreCAD/LibreCAD_3/pull/42#discussion_r59122547","pull_request_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/pulls/42","_links":{"self":{"href":"https://api.github.com/repos/LibreCAD/LibreCAD_3/pulls/comments/59122547"},"html":{"href":"https://github.com/LibreCAD/LibreCAD_3/pull/42#discussion_r59122547"},"pull_request":{"href":"https://api.github.com/repos/LibreCAD/LibreCAD_3/pulls/42"}}},"pull_request":{"url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/pulls/42","id":65886329,"html_url":"https://github.com/LibreCAD/LibreCAD_3/pull/42","diff_url":"https://github.com/LibreCAD/LibreCAD_3/pull/42.diff","patch_url":"https://github.com/LibreCAD/LibreCAD_3/pull/42.patch","issue_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/issues/42","number":42,"state":"open","locked":false,"title":"Update dimradial draw function","user":{"login":"bhattigurjot","id":3900404,"avatar_url":"https://avatars.githubusercontent.com/u/3900404?v=3","gravatar_id":"","url":"https://api.github.com/users/bhattigurjot","html_url":"https://github.com/bhattigurjot","followers_url":"https://api.github.com/users/bhattigurjot/followers","following_url":"https://api.github.com/users/bhattigurjot/following{/other_user}","gists_url":"https://api.github.com/users/bhattigurjot/gists{/gist_id}","starred_url":"https://api.github.com/users/bhattigurjot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhattigurjot/subscriptions","organizations_url":"https://api.github.com/users/bhattigurjot/orgs","repos_url":"https://api.github.com/users/bhattigurjot/repos","events_url":"https://api.github.com/users/bhattigurjot/events{/privacy}","received_events_url":"https://api.github.com/users/bhattigurjot/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-04-09T17:03:42Z","updated_at":"2016-04-09T22:22:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a73a90407ea3120ddf3c64eea4f9aa6b6dfc02ce","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/pulls/42/commits","review_comments_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/pulls/42/comments","review_comment_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/pulls/comments{/number}","comments_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/issues/42/comments","statuses_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/statuses/6fcb60bd8f5395288b11fac186e7f82329fd7002","head":{"label":"bhattigurjot:master","ref":"master","sha":"6fcb60bd8f5395288b11fac186e7f82329fd7002","user":{"login":"bhattigurjot","id":3900404,"avatar_url":"https://avatars.githubusercontent.com/u/3900404?v=3","gravatar_id":"","url":"https://api.github.com/users/bhattigurjot","html_url":"https://github.com/bhattigurjot","followers_url":"https://api.github.com/users/bhattigurjot/followers","following_url":"https://api.github.com/users/bhattigurjot/following{/other_user}","gists_url":"https://api.github.com/users/bhattigurjot/gists{/gist_id}","starred_url":"https://api.github.com/users/bhattigurjot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhattigurjot/subscriptions","organizations_url":"https://api.github.com/users/bhattigurjot/orgs","repos_url":"https://api.github.com/users/bhattigurjot/repos","events_url":"https://api.github.com/users/bhattigurjot/events{/privacy}","received_events_url":"https://api.github.com/users/bhattigurjot/received_events","type":"User","site_admin":false},"repo":{"id":55804607,"name":"LibreCAD_3","full_name":"bhattigurjot/LibreCAD_3","owner":{"login":"bhattigurjot","id":3900404,"avatar_url":"https://avatars.githubusercontent.com/u/3900404?v=3","gravatar_id":"","url":"https://api.github.com/users/bhattigurjot","html_url":"https://github.com/bhattigurjot","followers_url":"https://api.github.com/users/bhattigurjot/followers","following_url":"https://api.github.com/users/bhattigurjot/following{/other_user}","gists_url":"https://api.github.com/users/bhattigurjot/gists{/gist_id}","starred_url":"https://api.github.com/users/bhattigurjot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhattigurjot/subscriptions","organizations_url":"https://api.github.com/users/bhattigurjot/orgs","repos_url":"https://api.github.com/users/bhattigurjot/repos","events_url":"https://api.github.com/users/bhattigurjot/events{/privacy}","received_events_url":"https://api.github.com/users/bhattigurjot/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bhattigurjot/LibreCAD_3","description":"LibreCAD 3 development (GSoC 2016)","fork":true,"url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3","forks_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/forks","keys_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/teams","hooks_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/hooks","issue_events_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/issues/events{/number}","events_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/events","assignees_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/assignees{/user}","branches_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/branches{/branch}","tags_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/tags","blobs_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/git/refs{/sha}","trees_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/statuses/{sha}","languages_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/languages","stargazers_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/stargazers","contributors_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/contributors","subscribers_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/subscribers","subscription_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/subscription","commits_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/commits{/sha}","git_commits_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/git/commits{/sha}","comments_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/comments{/number}","issue_comment_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/issues/comments{/number}","contents_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/contents/{+path}","compare_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/merges","archive_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/downloads","issues_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/issues{/number}","pulls_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/pulls{/number}","milestones_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/milestones{/number}","notifications_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/labels{/name}","releases_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/releases{/id}","deployments_url":"https://api.github.com/repos/bhattigurjot/LibreCAD_3/deployments","created_at":"2016-04-08T19:31:42Z","updated_at":"2016-04-08T19:31:43Z","pushed_at":"2016-04-09T17:03:18Z","git_url":"git://github.com/bhattigurjot/LibreCAD_3.git","ssh_url":"git@github.com:bhattigurjot/LibreCAD_3.git","clone_url":"https://github.com/bhattigurjot/LibreCAD_3.git","svn_url":"https://github.com/bhattigurjot/LibreCAD_3","homepage":"http://librecad.org","size":4877,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"LibreCAD:master","ref":"master","sha":"5d4ce2c757b2094f0820bfb622148cc64685139f","user":{"login":"LibreCAD","id":721219,"avatar_url":"https://avatars.githubusercontent.com/u/721219?v=3","gravatar_id":"","url":"https://api.github.com/users/LibreCAD","html_url":"https://github.com/LibreCAD","followers_url":"https://api.github.com/users/LibreCAD/followers","following_url":"https://api.github.com/users/LibreCAD/following{/other_user}","gists_url":"https://api.github.com/users/LibreCAD/gists{/gist_id}","starred_url":"https://api.github.com/users/LibreCAD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LibreCAD/subscriptions","organizations_url":"https://api.github.com/users/LibreCAD/orgs","repos_url":"https://api.github.com/users/LibreCAD/repos","events_url":"https://api.github.com/users/LibreCAD/events{/privacy}","received_events_url":"https://api.github.com/users/LibreCAD/received_events","type":"Organization","site_admin":false},"repo":{"id":19827343,"name":"LibreCAD_3","full_name":"LibreCAD/LibreCAD_3","owner":{"login":"LibreCAD","id":721219,"avatar_url":"https://avatars.githubusercontent.com/u/721219?v=3","gravatar_id":"","url":"https://api.github.com/users/LibreCAD","html_url":"https://github.com/LibreCAD","followers_url":"https://api.github.com/users/LibreCAD/followers","following_url":"https://api.github.com/users/LibreCAD/following{/other_user}","gists_url":"https://api.github.com/users/LibreCAD/gists{/gist_id}","starred_url":"https://api.github.com/users/LibreCAD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LibreCAD/subscriptions","organizations_url":"https://api.github.com/users/LibreCAD/orgs","repos_url":"https://api.github.com/users/LibreCAD/repos","events_url":"https://api.github.com/users/LibreCAD/events{/privacy}","received_events_url":"https://api.github.com/users/LibreCAD/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/LibreCAD/LibreCAD_3","description":"LibreCAD 3 development (GSoC 2016)","fork":false,"url":"https://api.github.com/repos/LibreCAD/LibreCAD_3","forks_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/forks","keys_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/teams","hooks_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/hooks","issue_events_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/issues/events{/number}","events_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/events","assignees_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/assignees{/user}","branches_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/branches{/branch}","tags_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/tags","blobs_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/git/refs{/sha}","trees_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/statuses/{sha}","languages_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/languages","stargazers_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/stargazers","contributors_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/contributors","subscribers_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/subscribers","subscription_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/subscription","commits_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/commits{/sha}","git_commits_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/git/commits{/sha}","comments_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/comments{/number}","issue_comment_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/issues/comments{/number}","contents_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/contents/{+path}","compare_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/merges","archive_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/downloads","issues_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/issues{/number}","pulls_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/pulls{/number}","milestones_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/milestones{/number}","notifications_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/labels{/name}","releases_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/releases{/id}","deployments_url":"https://api.github.com/repos/LibreCAD/LibreCAD_3/deployments","created_at":"2014-05-15T16:44:30Z","updated_at":"2016-04-03T22:30:42Z","pushed_at":"2016-04-09T17:03:42Z","git_url":"git://github.com/LibreCAD/LibreCAD_3.git","ssh_url":"git@github.com:LibreCAD/LibreCAD_3.git","clone_url":"https://github.com/LibreCAD/LibreCAD_3.git","svn_url":"https://github.com/LibreCAD/LibreCAD_3","homepage":"http://librecad.org","size":5007,"stargazers_count":12,"watchers_count":12,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":6,"forks":16,"open_issues":6,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/LibreCAD/LibreCAD_3/pulls/42"},"html":{"href":"https://github.com/LibreCAD/LibreCAD_3/pull/42"},"issue":{"href":"https://api.github.com/repos/LibreCAD/LibreCAD_3/issues/42"},"comments":{"href":"https://api.github.com/repos/LibreCAD/LibreCAD_3/issues/42/comments"},"review_comments":{"href":"https://api.github.com/repos/LibreCAD/LibreCAD_3/pulls/42/comments"},"review_comment":{"href":"https://api.github.com/repos/LibreCAD/LibreCAD_3/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/LibreCAD/LibreCAD_3/pulls/42/commits"},"statuses":{"href":"https://api.github.com/repos/LibreCAD/LibreCAD_3/statuses/6fcb60bd8f5395288b11fac186e7f82329fd7002"}}}}