In the cross visual tool, apply the same roundning rules to the coordinates set on double-click as for the displayed coordinates
Originally committed to SVN as r6089.
This commit is contained in:
parent
25f4e4b426
commit
d9ab41468c
2 changed files with 12 additions and 7 deletions
|
@ -48,15 +48,15 @@ void VisualToolCross::OnDoubleClick() {
|
|||
int t1, t2;
|
||||
if (GetLineMove(*it, p1, p2, t1, t2)) {
|
||||
if (t1 > 0 || t2 > 0)
|
||||
SetOverride(*it, "\\move", wxString::Format("(%s,%s,%d,%d)", (p1 + d).Str(), (p2 + d).Str(), t1, t2));
|
||||
SetOverride(*it, "\\move", wxString::Format("(%s,%s,%d,%d)", Text(p1 + d), Text(p2 + d), t1, t2));
|
||||
else
|
||||
SetOverride(*it, "\\move", wxString::Format("(%s,%s)", (p1 + d).Str(), (p2 + d).Str()));
|
||||
SetOverride(*it, "\\move", wxString::Format("(%s,%s)", Text(p1 + d), Text(p2 + d)));
|
||||
}
|
||||
else
|
||||
SetOverride(*it, "\\pos", (GetLinePosition(*it) + d).PStr());
|
||||
SetOverride(*it, "\\pos", "(" + Text(GetLinePosition(*it) + d) + ")");
|
||||
|
||||
if (Vector2D org = GetLineOrigin(*it))
|
||||
SetOverride(*it, "\\org", (org + d).PStr());
|
||||
SetOverride(*it, "\\org", "(" + Text(org + d) + ")");
|
||||
}
|
||||
|
||||
Commit(_("positioning"));
|
||||
|
@ -77,8 +77,7 @@ void VisualToolCross::Draw() {
|
|||
gl.DrawLines(2, lines, 4);
|
||||
gl.ClearInvert();
|
||||
|
||||
Vector2D t = ToScriptCoords(shift_down ? video_res - mouse_pos : mouse_pos);
|
||||
wxString mouse_text = video_res.X() > script_res.X() ? t.Str() : t.DStr();
|
||||
wxString mouse_text = Text(ToScriptCoords(shift_down ? video_res - mouse_pos : mouse_pos));
|
||||
|
||||
int tw, th;
|
||||
gl_text->SetFont("Verdana", 12, true, false);
|
||||
|
@ -100,3 +99,7 @@ void VisualToolCross::Draw() {
|
|||
|
||||
gl_text->Print(mouse_text, dx, dy);
|
||||
}
|
||||
|
||||
wxString VisualToolCross::Text(Vector2D v) {
|
||||
return video_res.X() > script_res.X() ? v.Str() : v.DStr();
|
||||
}
|
||||
|
|
|
@ -32,9 +32,11 @@ class OpenGLText;
|
|||
/// @brief A crosshair which shows the current mouse position and on double-click
|
||||
/// shifts the selected lines to the clicked point
|
||||
class VisualToolCross : public VisualTool<VisualDraggableFeature> {
|
||||
agi::scoped_ptr<OpenGLText> gl_text;
|
||||
|
||||
void OnDoubleClick();
|
||||
void Draw();
|
||||
agi::scoped_ptr<OpenGLText> gl_text;
|
||||
wxString Text(Vector2D v);
|
||||
public:
|
||||
VisualToolCross(VideoDisplay *parent, agi::Context *context);
|
||||
~VisualToolCross();
|
||||
|
|
Loading…
Reference in a new issue