瀏覽代碼

adjust curve point limits

Johann ELSASS 5 年之前
父節點
當前提交
f456530509
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      lazpaint/dialog/color/uadjustcurves.pas

+ 6 - 0
lazpaint/dialog/color/uadjustcurves.pas

@@ -622,6 +622,10 @@ begin
   result := -1;
   curve := SelectedCurve;
   if curve = nil then exit;
+  if xBmp < FPoint0.x then xBmp := FPoint0.x;
+  if xBmp > FPoint1.x then xBmp := FPoint1.x;
+  if yBmp > FPoint0.y then yBmp := FPoint0.y;
+  if yBmp < FPoint1.y then yBmp := FPoint1.y;
   pointList := curve.GetVariable('Points');
   pointCount := curve.GetListCount(pointList);
   minDist := sqr(ScaleX(20,96)+0.0);
@@ -657,6 +661,8 @@ begin
     if (pt1.x <= xBmp-1) and (pt2.x >= xBmp+1) then
     begin
       coord := BitmapToCoord(xBmp,yBmp);
+      if coord.y < 0 then coord.y := 0;
+      if coord.y > 1 then coord.y := 1;
       curve.AppendPoint(pointList, curve.GetPoint2DAt(pointList, pointCount-1));
       for j := pointCount-1 downto i do curve.AssignPointAt(pointList, j+1, curve.GetPoint2DAt(pointList, j));
       curve.AssignPointAt(pointList, i, coord);