aboutsummaryrefslogtreecommitdiffstats
path: root/src/particles/qquickellipseextruder.cpp
diff options
context:
space:
mode:
authorDaniel Oberländer <oberlaender.daniel@gmail.com>2014-05-29 21:37:54 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-06-12 17:15:11 +0200
commit7eb4e701dd361f58edcdf9a74770938d6ffa75b0 (patch)
treefcc73e629bb7684672bbda5509207cbcb9376367 /src/particles/qquickellipseextruder.cpp
parent56c534ace6ab26fadd616f477be1ec51b93332b6 (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) <416365416c@gmail.com>
Diffstat (limited to 'src/particles/qquickellipseextruder.cpp')
-rw-r--r--src/particles/qquickellipseextruder.cpp8
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