Skip to content

Commit

Permalink
Merge pull request #66 from nativescript-community/fix/ios-bitmap-shadow
Browse files Browse the repository at this point in the history
fix(ui-canvas): Canvas iOS bitmaps incorrect shadow offset
  • Loading branch information
farfromrefug authored Dec 13, 2024
2 parents 4305a8d + a28331d commit 860234d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ui-canvas/canvas.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1813,7 +1813,10 @@ export class Canvas implements ICanvas {

if (paint.shadowLayer) {
const s = paint.shadowLayer;
CGContextSetShadowWithColor(ctx, CGSizeMake(s.dx, s.dy), s.radius, s.color.ios.CGColor);
// Bitmaps have their coordinate system flipped vertically, however shadow offsets ignore this and must be handled manually
const offsetY = this.mIsBitmap ? -s.dy : s.dy;

CGContextSetShadowWithColor(ctx, CGSizeMake(s.dx, offsetY), s.radius, s.color.ios.CGColor);
} else {
CGContextSetShadow(ctx, CGSizeZero, 0);
}
Expand Down

0 comments on commit 860234d

Please sign in to comment.