diff options
author | Daniel Oberländer <[email protected]> | 2014-05-29 21:37:54 +0200 |
---|---|---|
committer | The Qt Project <[email protected]> | 2014-06-12 17:15:11 +0200 |
commit | 7eb4e701dd361f58edcdf9a74770938d6ffa75b0 (patch) | |
tree | fcc73e629bb7684672bbda5509207cbcb9376367 | |
parent | 56c534ace6ab26fadd616f477be1ec51b93332b6 (diff) |
Fix EllipseShape for Affectors in QtQuick.Particle
EllipseShape was theated like rectangles if set as shape in an Affector
due to an unimplemented containment check (was marked as TODO in source
code). This fix implements the missing check.
Change-Id: I8df1406f147c56e799531fccf4963110c9fdd8ef
Reviewed-by: Alan Alpert (Personal) <[email protected]>
-rw-r--r-- | src/particles/qquickellipseextruder.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/particles/qquickellipseextruder.cpp b/src/particles/qquickellipseextruder.cpp index f4374d8013..6016d5966b 100644 --- a/src/particles/qquickellipseextruder.cpp +++ b/src/particles/qquickellipseextruder.cpp @@ -82,7 +82,13 @@ QPointF QQuickEllipseExtruder::extrude(const QRectF & r) bool QQuickEllipseExtruder::contains(const QRectF &bounds, const QPointF &point) { - return bounds.contains(point);//TODO: Ellipse + if (!bounds.contains(point)) + return false; + + QPointF relPoint(bounds.center() - point); + qreal xa = relPoint.x()/bounds.width(); + qreal yb = relPoint.y()/bounds.height(); + return (xa * xa + yb * yb) < 0.25; } QT_END_NAMESPACE |