diff options
author | Gunnar Sletta <gunnar.sletta@nokia.com> | 2011-05-04 10:21:47 +0200 |
---|---|---|
committer | Gunnar Sletta <gunnar.sletta@nokia.com> | 2011-05-04 10:21:47 +0200 |
commit | 16f58282bc5a1f81f7346ac6560df68761ad277d (patch) | |
tree | 38cc24d17ea4d868ee3cffd8ca99e96ac08e76dd /src/imports/particles/particleaffector.cpp | |
parent | 280242a5a14a99cc10857e35da61ac5b894d5f6b (diff) | |
parent | 1b7c1b6ef86d3d56ff01b2eab118062a229b0d19 (diff) |
Merge branch 'qtquick2' of scm.dev.nokia.troll.no:qt/qtdeclarative-staging into qtquick2
Diffstat (limited to 'src/imports/particles/particleaffector.cpp')
-rw-r--r-- | src/imports/particles/particleaffector.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/imports/particles/particleaffector.cpp b/src/imports/particles/particleaffector.cpp index 0d7bab577d..73564a940a 100644 --- a/src/imports/particles/particleaffector.cpp +++ b/src/imports/particles/particleaffector.cpp @@ -43,7 +43,8 @@ #include <QDebug> QT_BEGIN_NAMESPACE ParticleAffector::ParticleAffector(QSGItem *parent) : - QSGItem(parent), m_needsReset(false), m_system(0), m_active(true), m_updateIntSet(false) + QSGItem(parent), m_needsReset(false), m_system(0), m_active(true) + , m_updateIntSet(false), m_shape(new ParticleExtruder(this)), m_signal(false) { connect(this, SIGNAL(systemChanged(ParticleSystem*)), this, SLOT(updateOffsets())); @@ -82,11 +83,16 @@ void ParticleAffector::affectSystem(qreal dt) if(!d || (m_onceOff && m_onceOffed.contains(d->systemIndex))) continue; if(m_groups.isEmpty() || m_groups.contains(d->group)){ - if(width() == 0 || height() == 0 || QRectF(m_offset.x(), m_offset.y(), width(), height()).contains(d->curX(), d->curY())){ + //Need to have previous location for affected. if signal || shape might be faster? + QPointF curPos = QPointF(d->curX(), d->curY()); + if(width() == 0 || height() == 0 + || m_shape->contains(QRectF(m_offset.x(), m_offset.y(), width(), height()),curPos)){ if(affectParticle(d, dt)){ m_system->m_needsReset << d; if(m_onceOff) m_onceOffed << d->systemIndex; + if(m_signal) + emit affected(curPos.x(), curPos.y()); } } } |