mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-26 06:47:25 +01:00
MG: fixed snap to grid on negative grid
git-svn-id: trunk@1758 -
This commit is contained in:
parent
1673cf67bc
commit
f86cf07edb
@ -792,7 +792,10 @@ begin
|
|||||||
if not EnvironmentOptions.SnapToGrid then exit;
|
if not EnvironmentOptions.SnapToGrid then exit;
|
||||||
GridSizeY:=CleanGridSizeY;
|
GridSizeY:=CleanGridSizeY;
|
||||||
// add half GridSizeY, so that rounding is correct
|
// add half GridSizeY, so that rounding is correct
|
||||||
NearestGridY:=NearestInt.Level+(GridSizeY div 2);
|
if NearestInt.Level>=0 then
|
||||||
|
NearestGridY:=NearestInt.Level+(GridSizeY div 2)
|
||||||
|
else
|
||||||
|
NearestGridY:=NearestInt.Level-(GridSizeY div 2);
|
||||||
// round
|
// round
|
||||||
dec(NearestGridY,NearestGridY mod GridSizeY);
|
dec(NearestGridY,NearestGridY mod GridSizeY);
|
||||||
ImproveNearestInt(NearestInt,NearestGridY);
|
ImproveNearestInt(NearestInt,NearestGridY);
|
||||||
@ -1114,7 +1117,10 @@ begin
|
|||||||
if not EnvironmentOptions.SnapToGrid then exit;
|
if not EnvironmentOptions.SnapToGrid then exit;
|
||||||
GridSizeX:=CleanGridSizeX;
|
GridSizeX:=CleanGridSizeX;
|
||||||
// add half GridSizeX, so that rounding is correct
|
// add half GridSizeX, so that rounding is correct
|
||||||
NearestGridX:=NearestInt.Level+(GridSizeX div 2);
|
if NearestInt.Level>=0 then
|
||||||
|
NearestGridX:=NearestInt.Level+(GridSizeX div 2)
|
||||||
|
else
|
||||||
|
NearestGridX:=NearestInt.Level-(GridSizeX div 2);
|
||||||
// round
|
// round
|
||||||
dec(NearestGridX,NearestGridX mod GridSizeX);
|
dec(NearestGridX,NearestGridX mod GridSizeX);
|
||||||
ImproveNearestInt(NearestInt,NearestGridX);
|
ImproveNearestInt(NearestInt,NearestGridX);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user