From 7eb4e701dd361f58edcdf9a74770938d6ffa75b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Oberl=C3=A4nder?= Date: Thu, 29 May 2014 21:37:54 +0200 Subject: 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> --- src/particles/qquickellipseextruder.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/particles') 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 -- cgit v1.2.3