correct cursor movement accross lines & zero width things

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@108 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-12-10 20:51:16 +00:00
parent 2f1b2756ee
commit db917c2b71
6 changed files with 73 additions and 16 deletions
+6 -4
View File
@@ -14,9 +14,11 @@
// ----------------------------------------------------------------------------- : Rounding
// Rounding function for converting doubles to integers
inline int realRound(double d) {
return d > 0 ? d + 0.5 : d - 0.5;
/// Rounding function for converting doubles to integers,
/** Intentionally uses slightly less then 0.5, to give a more consistent result
* when for instance something like "x/2" is used. */
inline int to_int(double d) {
return d > 0 ? d + 0.4999995 : d - 0.4999995;
}
// ----------------------------------------------------------------------------- : Vector2D
@@ -110,7 +112,7 @@ class Vector2D {
}
inline operator wxPoint() const {
return wxPoint(realRound(x), realRound(y));
return wxPoint(to_int(x), to_int(y));
}
// Vector at infinity