Skip to content

Commit

Permalink
#543 warn about opacity = 0
Browse files Browse the repository at this point in the history
  • Loading branch information
circular17 committed Jun 2, 2024
1 parent dba418c commit ebeb99b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lazpaint/tools/utool.pas
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ TToolClass = class of TGenericTool;
tpmReturnValides, tpmBackspaceRemoveLastPoint, tpmRightClickFinishShape, tpmHoldKeyRestrictRotation,
tpmHoldKeysScaleMode, tpmCurveModeHint, tpmBlendOpBackground,
tpmRightClickForSource, tpmNothingToBeDeformed, tpmRightClickForTransformCenter,
tpmLayerEmpty);
tpmLayerEmpty, tpmOpacity0);

TOnToolChangedHandler = procedure(sender: TToolManager; ANewToolType: TPaintToolType) of object;
TOnPopupToolHandler = procedure(sender: TToolManager; APopupMessage: TToolPopupMessage; AKey: Word; AAlways: boolean) of object;
Expand Down Expand Up @@ -774,6 +774,7 @@ function ToolPopupMessageToStr(AMessage: TToolPopupMessage; AKey: Word = 0): str
tpmNothingToBeDeformed: result := rsNothingToBeDeformed;
tpmRightClickForTransformCenter: result := rsRightClickForTransformCenter;
tpmLayerEmpty: result := rsEmptyLayer;
tpmOpacity0: result := rsOpacity + ' = 0';
else
result := '';
end;
Expand Down
21 changes: 16 additions & 5 deletions lazpaint/tools/utoolbasic.pas
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ function TToolPen.ContinueDrawing(toolDest: TBGRABitmap; originF, destF: TPointF

function TToolPen.DoToolDown(toolDest: TBGRABitmap; pt: TPoint; ptF: TPointF;
rightBtn: boolean): TRect;
var
b: TUniversalBrush;
begin
if ssSnap in ShiftState then ptF := PointF(pt.X,pt.Y);
if not penDrawing then
Expand All @@ -359,11 +361,20 @@ function TToolPen.DoToolDown(toolDest: TBGRABitmap; pt: TPoint; ptF: TPointF;
shiftClickingRight := rightBtn;
end else
begin
toolDest.PenStyle := psSolid;
penDrawing := true;
penDrawingRight := rightBtn;
result := StartDrawing(toolDest,ptF,rightBtn);
penOrigin := ptF;
b := GetUniversalBrush(rightBtn);
if b.DoesNothing then
begin
Manager.ToolPopup(tpmOpacity0, 0, true);
result := EmptyRect;
end
else
begin
toolDest.PenStyle := psSolid;
penDrawing := true;
penDrawingRight := rightBtn;
result := StartDrawing(toolDest,ptF,rightBtn);
penOrigin := ptF;
end;
end;
end else
result := EmptyRect;
Expand Down

0 comments on commit ebeb99b

Please sign in to comment.