fix hard to find edge case in graph lines: integer division gave a visual bug, but real/float division (which preserves decimal) fixed that bug
This commit is contained in:
@@ -11,8 +11,8 @@ struct
|
|||||||
Vector.concat acc
|
Vector.concat acc
|
||||||
else
|
else
|
||||||
let
|
let
|
||||||
val halfWidth = Real32.fromInt (windowWidth div 2)
|
val halfWidth = Real32.fromInt windowWidth / 2.0
|
||||||
val halfHeight = Real32.fromInt (windowHeight div 2)
|
val halfHeight = Real32.fromInt windowHeight / 2.0
|
||||||
|
|
||||||
val curX = Vector.sub (xClickPoints, pos)
|
val curX = Vector.sub (xClickPoints, pos)
|
||||||
val minusX = (curX - halfWidth - 1.0) / halfWidth
|
val minusX = (curX - halfWidth - 1.0) / halfWidth
|
||||||
@@ -35,14 +35,12 @@ struct
|
|||||||
acc
|
acc
|
||||||
else
|
else
|
||||||
let
|
let
|
||||||
val halfWidth = windowHeight div 2
|
val halfWidth = Real32.fromInt windowWidth / 2.0
|
||||||
val halfWidth = Real32.fromInt halfWidth
|
val halfHeight = Real32.fromInt windowHeight / 2.0
|
||||||
val halfHeight = windowHeight div 2
|
|
||||||
val halfHeight = Real32.fromInt halfHeight
|
|
||||||
|
|
||||||
val curY = Vector.sub (yClickPoints, pos)
|
val curY = Vector.sub (yClickPoints, pos)
|
||||||
val minusY = ~(curY - halfHeight - 1.0) / halfHeight
|
val minusY = (~(curY - halfHeight - 1.0)) / halfHeight
|
||||||
val plusY = ~(curY - halfHeight + 1.0) / halfHeight
|
val plusY = (~(curY - halfHeight + 1.0)) / halfHeight
|
||||||
|
|
||||||
val minX = Vector.sub (xClickPoints, 0)
|
val minX = Vector.sub (xClickPoints, 0)
|
||||||
val minX = (minX - halfWidth) / halfWidth
|
val minX = (minX - halfWidth) / halfWidth
|
||||||
|
|||||||
Reference in New Issue
Block a user