dasher r3631 - in trunk: . Src/DasherCore
- From: pwelche svn gnome org
- To: svn-commits-list gnome org
- Subject: dasher r3631 - in trunk: . Src/DasherCore
- Date: Mon, 2 Mar 2009 10:55:51 +0000 (UTC)
Author: pwelche
Date: Mon Mar 2 10:55:51 2009
New Revision: 3631
URL: http://svn.gnome.org/viewvc/dasher?rev=3631&view=rev
Log:
Fix drifting in zoom by rounding to nearest integer in integer division.
Modified:
trunk/ChangeLog
trunk/Src/DasherCore/DasherModel.cpp
Modified: trunk/Src/DasherCore/DasherModel.cpp
==============================================================================
--- trunk/Src/DasherCore/DasherModel.cpp (original)
+++ trunk/Src/DasherCore/DasherModel.cpp Mon Mar 2 10:55:51 2009
@@ -419,6 +419,10 @@
int iTargetMin(Mousey - ((myint)iMaxY * Mousex) / (2 * (myint)iOX));
int iTargetMax(Mousey + ((myint)iMaxY * Mousex) / (2 * (myint)iOY));
+ // Compute the point C which is thus the center of expansion
+ // (it divides iTargetMin-Max into the same proportions at it divides 0-iMaxY)
+ const dasherint C = (iTargetMin * iMaxY) / (iTargetMin + iMaxY - iTargetMax);
+
// iSteps is the number of update steps we need to get the point
// under the cursor over to the cross hair. Calculated in order to
// keep a constant bit-rate.
@@ -453,8 +457,9 @@
iTargetMax = iNewTargetMax;
}
- iNewMin = (((m_Rootmin - iTargetMin) * (myint)GetLongParameter(LP_MAX_Y)) / (iTargetMax - iTargetMin));
- iNewMax = (((m_Rootmax - iTargetMax) * (myint)GetLongParameter(LP_MAX_Y)) / (iTargetMax - iTargetMin) + (myint)GetLongParameter(LP_MAX_Y));
+ //...and go there in one step, as we've already "stepped" the desired viewport
+ iNewMin = ((m_Rootmin - C) * iMaxY) / (iTargetMax - iTargetMin) + C;
+ iNewMax = ((m_Rootmax - C) * iMaxY) / (iTargetMax - iTargetMin) + C;
}
bool CDasherModel::UpdatePosition(myint miMousex, myint miMousey, unsigned long iTime, Dasher::VECTOR_SYMBOL_PROB* pAdded, int* pNumDeleted) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]