mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-01 06:07:41 +00:00
fix: negative dx/dy in feOffset (#2515)
# Summary While working on #2514 I've noticed that negative dx/dy were treated as positive. ## Test Plan Add FeOffset filter with negative dx/dy to an element. It should move closer to upper left corner. ## Compatibility | OS | Implemented | | ------- | :---------: | | Android | ✅ |
This commit is contained in:
@@ -44,8 +44,10 @@ class FeOffsetView extends FilterPrimitiveView {
|
||||
float dy = this.mDy != null ? (float) this.relativeOnHeight(this.mDy) : 0;
|
||||
RectF frame = new RectF(0, 0, dx, dy);
|
||||
this.getSvgView().getCtm().mapRect(frame);
|
||||
dx = frame.left < 0 ? frame.left : frame.width();
|
||||
dy = frame.top < 0 ? frame.top : frame.height();
|
||||
|
||||
canvas.drawBitmap(source, frame.width(), frame.height(), null);
|
||||
canvas.drawBitmap(source, dx, dy, null);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user