Skip to content
Snippets Groups Projects
Commit 68032e11 authored by Julien Malik's avatar Julien Malik
Browse files

BUG: fix histogram widget - we were mixing screen and space coordinates

parent 8769d734
No related branches found
No related tags found
No related merge requests found
...@@ -90,6 +90,13 @@ public: ...@@ -90,6 +90,13 @@ public:
spacePoint[0] = m_RightAsymptote->GetAbcisse(); spacePoint[0] = m_RightAsymptote->GetAbcisse();
double abcisseR = m_Curve->TransformPoint(spacePoint)[0]; double abcisseR = m_Curve->TransformPoint(spacePoint)[0];
spacePoint[0] = m_MinimumAbcisse;
double minScreenAbs = m_Curve->TransformPoint(spacePoint)[0];
spacePoint[0] = m_MaximumAbcisse;
double maxScreenAbs = m_Curve->TransformPoint(spacePoint)[0];
if (widgetId == m_Curve->GetIdentifier() && this->GetIsActive()) if (widgetId == m_Curve->GetIdentifier() && this->GetIsActive())
{ {
switch (event) switch (event)
...@@ -129,8 +136,8 @@ public: ...@@ -129,8 +136,8 @@ public:
if (m_ModifyLeft) if (m_ModifyLeft)
{ {
double tx = x - abcisseL; double newLeftAbcisse = m_MinimumAbcisse
double newLeftAbcisse = m_LeftAsymptote->GetAbcisse() + tx; + (m_MaximumAbcisse - m_MinimumAbcisse) / (maxScreenAbs - minScreenAbs) * (x - minScreenAbs);
if ( newLeftAbcisse < m_RightAsymptote->GetAbcisse() if ( newLeftAbcisse < m_RightAsymptote->GetAbcisse()
&& newLeftAbcisse >= m_MinimumAbcisse) && newLeftAbcisse >= m_MinimumAbcisse)
{ {
...@@ -147,8 +154,8 @@ public: ...@@ -147,8 +154,8 @@ public:
if (m_ModifyRight) if (m_ModifyRight)
{ {
double tx = x - abcisseR; double newRightAbcisse = m_MinimumAbcisse
double newRightAbcisse = m_RightAsymptote->GetAbcisse() + tx; + (m_MaximumAbcisse - m_MinimumAbcisse) / (maxScreenAbs - minScreenAbs) * (x - minScreenAbs);
if (newRightAbcisse > m_LeftAsymptote->GetAbcisse() if (newRightAbcisse > m_LeftAsymptote->GetAbcisse()
&& newRightAbcisse < m_MaximumAbcisse) && newRightAbcisse < m_MaximumAbcisse)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment