Browse Source

* Correctly scale inwards

Michaël Van Canneyt 1 year ago
parent
commit
2f4ad88290
1 changed files with 6 additions and 5 deletions
  1. 6 5
      src/wasm/fresnel.wasm.render.pp

+ 6 - 5
src/wasm/fresnel.wasm.render.pp

@@ -167,7 +167,7 @@ begin
   AddP(aRect.Box.TopLeft,True);
   AddP(aRect.Box.TopLeft,True);
   AddP(aRect.Box.BottomRight,True);
   AddP(aRect.Box.BottomRight,True);
   For Corner in TFresnelCSSCorner do
   For Corner in TFresnelCSSCorner do
-    AddP(aRect.Radius[Corner]);
+    AddP(aRect.Radii[Corner]);
   if __fresnel_canvas_roundrect(Canvas,Flags,@RR)<>ECANVAS_SUCCESS then
   if __fresnel_canvas_roundrect(Canvas,Flags,@RR)<>ECANVAS_SUCCESS then
     FLLog(etError,'failed to draw round rectangle on canvas %d',[Canvas]);
     FLLog(etError,'failed to draw round rectangle on canvas %d',[Canvas]);
 end;
 end;
@@ -302,6 +302,7 @@ begin
   end else if Params.BackgroundColorFP.Alpha>alphaTransparent then
   end else if Params.BackgroundColorFP.Alpha>alphaTransparent then
   begin
   begin
     //FLLog(etDebug,'TFresnelRenderer.DrawElBorder drawing background %s',[El.GetPath]);
     //FLLog(etDebug,'TFresnelRenderer.DrawElBorder drawing background %s',[El.GetPath]);
+    __fresnel_canvas_set_linewidth(Canvas,FresnelToWasmLength(Params.Width[ffsLeft],True));
     if Params.HasRadius then
     if Params.HasRadius then
       RoundRect(Params.BackgroundColorFP,Params.BoundingBox,True)
       RoundRect(Params.BackgroundColorFP,Params.BoundingBox,True)
     else
     else
@@ -328,12 +329,12 @@ begin
     With Params do
     With Params do
       begin
       begin
       HalfWidth:=Width[ffsLeft]/2;
       HalfWidth:=Width[ffsLeft]/2;
-      BB.Box.TopLeft.OffSet(-HalfWidth,-HalfWidth);
-      BB.Box.BottomRight.OffSet(HalfWidth,HalfWidth);
+      BB.Box.TopLeft.OffSet(+HalfWidth,+HalfWidth);
+      BB.Box.BottomRight.OffSet(-HalfWidth,-HalfWidth);
       For C in TFresnelCSSCorner do
       For C in TFresnelCSSCorner do
         begin
         begin
-        BB.Radius[C].X:=BB.Radius[C].X+HalfWidth;
-        BB.Radius[C].Y:=BB.Radius[C].Y+HalfWidth;
+        BB.Radii[C].X:=BB.Radii[C].X-HalfWidth;
+        BB.Radii[C].Y:=BB.Radii[C].Y-HalfWidth;
         end
         end
       end;
       end;
     RoundRect(Params.Color[Low(TFresnelCSSSide)],BB,False);
     RoundRect(Params.Color[Low(TFresnelCSSSide)],BB,False);