*/}}
Pārlūkot izejas kodu

Use different lock radius for brushes and erasers

YimingWu 1 gadu atpakaļ
vecāks
revīzija
415fe658e9
2 mainītis faili ar 8 papildinājumiem un 2 dzēšanām
  1. 7 2
      ouroperations.c
  2. 1 0
      ourpaint.h

+ 7 - 2
ouroperations.c

@@ -1692,8 +1692,13 @@ void ourpropagate_Tools(OurPaint* p, laUDF* udf, int force){
 }
 void ourset_CurrentBrush(void* unused, OurBrush* b){
     real r; if(Our->LockRadius) r=Our->CurrentBrush?Our->CurrentBrush->Size:15;
-    Our->CurrentBrush=b; if(b && Our->LockRadius) b->Size=r;
-    if(b->DefaultAsEraser){ Our->Erasing=1; Our->EraserID=b->Binding; }else{ Our->Erasing=0; Our->PenID=b->Binding; }
+    OurBrush* ob=Our->CurrentBrush;
+    if(ob){
+        if(ob->DefaultAsEraser){ Our->SaveEraserSize=ob->Size; }else{ Our->SaveBrushSize=ob->Size; }
+    }
+    Our->CurrentBrush=b;
+    if(b->DefaultAsEraser){ Our->Erasing=1; Our->EraserID=b->Binding; if(Our->LockRadius) b->Size=Our->SaveEraserSize?Our->SaveEraserSize:r; }
+    else{ Our->Erasing=0; Our->PenID=b->Binding; if(Our->LockRadius) b->Size=Our->SaveBrushSize?Our->SaveBrushSize:r; }
     laNotifyUsers("our.tools.current_brush"); laDriverRequestRebuild();
 }
 void ourset_CurrentLayer(void* unused, OurLayer*l){

+ 1 - 0
ourpaint.h

@@ -259,6 +259,7 @@ STRUCTURE(OurPaint){
     OurLayer*    CurrentLayer;
     laListHandle Brushes;
     OurBrush*    CurrentBrush;
+    real SaveBrushSize,SaveEraserSize;
     OurDab* Dabs; int NextDab,MaxDab;
     laListHandle BrushEval;