summaryrefslogtreecommitdiff
path: root/slideshow/source
diff options
context:
space:
mode:
Diffstat (limited to 'slideshow/source')
-rw-r--r--slideshow/source/engine/animationfactory.cxx16
-rw-r--r--slideshow/source/engine/box2dtools.cxx29
-rw-r--r--slideshow/source/inc/box2dtools.hxx10
3 files changed, 45 insertions, 10 deletions
diff --git a/slideshow/source/engine/animationfactory.cxx b/slideshow/source/engine/animationfactory.cxx
index 8068bbfac83e..db141c906a50 100644
--- a/slideshow/source/engine/animationfactory.cxx
+++ b/slideshow/source/engine/animationfactory.cxx
@@ -214,6 +214,7 @@ namespace slideshow::internal
maShapeOrig(),
mnFlags( nFlags ),
mbAnimationStarted( false ),
+ mbAnimationFirstUpdate( true ),
mnAdditive( nAdditive ),
mpBox2DWorld( pBox2DWorld )
{
@@ -324,10 +325,14 @@ namespace slideshow::internal
mpShapeManager->notifyShapeUpdate( mpShape );
if ( mpBox2DWorld->isInitialized() )
{
- mpBox2DWorld->queueShapePathAnimationUpdate( mpShape->getXShape(), mpAttrLayer );
+ mpBox2DWorld->queueShapePathAnimationUpdate( mpShape->getXShape(),
+ mpAttrLayer,
+ mbAnimationFirstUpdate );
}
}
+ if( mbAnimationFirstUpdate ) mbAnimationFirstUpdate = false;
+
return true;
}
@@ -351,6 +356,7 @@ namespace slideshow::internal
::basegfx::B2DPoint maShapeOrig;
const int mnFlags;
bool mbAnimationStarted;
+ bool mbAnimationFirstUpdate;
sal_Int16 mnAdditive;
box2d::utils::Box2DWorldSharedPtr mpBox2DWorld;
};
@@ -587,6 +593,7 @@ namespace slideshow::internal
mnFlags( nFlags ),
maDefaultValue(rDefaultValue),
mbAnimationStarted( false ),
+ mbAnimationFirstUpdate( true ),
meAttrType( eAttrType ),
mpBox2DWorld ( pBox2DWorld )
{
@@ -694,6 +701,8 @@ namespace slideshow::internal
if( mpShape->isContentChanged() )
mpShapeManager->notifyShapeUpdate( mpShape );
+ if( mbAnimationFirstUpdate ) mbAnimationFirstUpdate = false;
+
return true;
}
@@ -708,12 +717,14 @@ namespace slideshow::internal
if( mpBox2DWorld && mpBox2DWorld->isInitialized() )
{
- mpBox2DWorld->queueShapeAnimationUpdate( mpShape->getXShape(), mpAttrLayer, meAttrType );
+ mpBox2DWorld->queueShapeAnimationUpdate( mpShape->getXShape(), mpAttrLayer, meAttrType, mbAnimationFirstUpdate );
}
if( mpShape->isContentChanged() )
mpShapeManager->notifyShapeUpdate( mpShape );
+ if( mbAnimationFirstUpdate ) mbAnimationFirstUpdate = false;
+
return true;
}
@@ -746,6 +757,7 @@ namespace slideshow::internal
const ValueT maDefaultValue;
bool mbAnimationStarted;
+ bool mbAnimationFirstUpdate;
const AttributeType meAttrType;
const box2d::utils::Box2DWorldSharedPtr mpBox2DWorld;
diff --git a/slideshow/source/engine/box2dtools.cxx b/slideshow/source/engine/box2dtools.cxx
index 565467fdb347..5cefff743b2e 100644
--- a/slideshow/source/engine/box2dtools.cxx
+++ b/slideshow/source/engine/box2dtools.cxx
@@ -341,10 +341,13 @@ void box2DWorld::processUpdateQueue(const double fPassedTime)
switch (aQueueElement.meUpdateType)
{
default:
- case BOX2D_UPDATE_POSITION:
+ case BOX2D_UPDATE_POSITION_CHANGE:
setShapePositionByLinearVelocity(aQueueElement.mxShape,
aQueueElement.maPosition, fPassedTime);
break;
+ case BOX2D_UPDATE_POSITION:
+ setShapePosition(aQueueElement.mxShape, aQueueElement.maPosition);
+ break;
case BOX2D_UPDATE_ANGLE:
setShapeAngleByAngularVelocity(aQueueElement.mxShape, aQueueElement.mfAngle,
fPassedTime);
@@ -426,7 +429,7 @@ void box2DWorld::queueDynamicPositionUpdate(
const css::uno::Reference<com::sun::star::drawing::XShape>& xShape,
const basegfx::B2DPoint& rOutPos)
{
- Box2DDynamicUpdateInformation aQueueElement = { xShape, {}, BOX2D_UPDATE_POSITION };
+ Box2DDynamicUpdateInformation aQueueElement = { xShape, {}, BOX2D_UPDATE_POSITION_CHANGE };
aQueueElement.maPosition = rOutPos;
maShapeParallelUpdateQueue.push(aQueueElement);
}
@@ -467,19 +470,29 @@ void box2DWorld::queueShapeVisibilityUpdate(
maShapeParallelUpdateQueue.push(aQueueElement);
}
+void box2DWorld::queueShapePositionUpdate(
+ const css::uno::Reference<com::sun::star::drawing::XShape>& xShape,
+ const basegfx::B2DPoint& rOutPos)
+{
+ Box2DDynamicUpdateInformation aQueueElement = { xShape, {}, BOX2D_UPDATE_POSITION };
+ aQueueElement.maPosition = rOutPos;
+ maShapeParallelUpdateQueue.push(aQueueElement);
+}
+
void box2DWorld::queueShapePathAnimationUpdate(
const css::uno::Reference<com::sun::star::drawing::XShape>& xShape,
- const slideshow::internal::ShapeAttributeLayerSharedPtr& pAttrLayer)
+ const slideshow::internal::ShapeAttributeLayerSharedPtr& pAttrLayer, const bool bIsFirstUpdate)
{
// Workaround for PathAnimations since they do not have their own AttributeType
// - using PosX makes it register a DynamicPositionUpdate -
- queueShapeAnimationUpdate(xShape, pAttrLayer, slideshow::internal::AttributeType::PosX);
+ queueShapeAnimationUpdate(xShape, pAttrLayer, slideshow::internal::AttributeType::PosX,
+ bIsFirstUpdate);
}
void box2DWorld::queueShapeAnimationUpdate(
const css::uno::Reference<com::sun::star::drawing::XShape>& xShape,
const slideshow::internal::ShapeAttributeLayerSharedPtr& pAttrLayer,
- const slideshow::internal::AttributeType eAttrType)
+ const slideshow::internal::AttributeType eAttrType, const bool bIsFirstUpdate)
{
switch (eAttrType)
{
@@ -491,7 +504,11 @@ void box2DWorld::queueShapeAnimationUpdate(
return;
case slideshow::internal::AttributeType::PosX:
case slideshow::internal::AttributeType::PosY:
- queueDynamicPositionUpdate(xShape, { pAttrLayer->getPosX(), pAttrLayer->getPosY() });
+ if (bIsFirstUpdate)
+ queueShapePositionUpdate(xShape, { pAttrLayer->getPosX(), pAttrLayer->getPosY() });
+ else
+ queueDynamicPositionUpdate(xShape,
+ { pAttrLayer->getPosX(), pAttrLayer->getPosY() });
return;
default:
return;
diff --git a/slideshow/source/inc/box2dtools.hxx b/slideshow/source/inc/box2dtools.hxx
index 6bfc9dfd1b7c..ae9daa5fee35 100644
--- a/slideshow/source/inc/box2dtools.hxx
+++ b/slideshow/source/inc/box2dtools.hxx
@@ -41,6 +41,7 @@ enum box2DBodyType
enum box2DNonsimulatedShapeUpdateType
{
+ BOX2D_UPDATE_POSITION_CHANGE,
BOX2D_UPDATE_POSITION,
BOX2D_UPDATE_ANGLE,
BOX2D_UPDATE_SIZE,
@@ -181,6 +182,9 @@ private:
void queueShapeVisibilityUpdate(const css::uno::Reference<css::drawing::XShape>& xShape,
const bool bVisibility);
+ void queueShapePositionUpdate(const css::uno::Reference<css::drawing::XShape>& xShape,
+ const ::basegfx::B2DPoint& rOutPos);
+
public:
box2DWorld(const ::basegfx::B2DVector& rSlideSize);
~box2DWorld();
@@ -250,11 +254,13 @@ public:
void
queueShapeAnimationUpdate(const css::uno::Reference<css::drawing::XShape>& xShape,
const slideshow::internal::ShapeAttributeLayerSharedPtr& pAttrLayer,
- const slideshow::internal::AttributeType eAttrType);
+ const slideshow::internal::AttributeType eAttrType,
+ const bool bIsFirstUpdate);
void queueShapePathAnimationUpdate(
const css::uno::Reference<com::sun::star::drawing::XShape>& xShape,
- const slideshow::internal::ShapeAttributeLayerSharedPtr& pAttrLayer);
+ const slideshow::internal::ShapeAttributeLayerSharedPtr& pAttrLayer,
+ const bool bIsFirstUpdate);
void queueShapeAnimationEndUpdate(const css::uno::Reference<css::drawing::XShape>& xShape,
const slideshow::internal::AttributeType eAttrType);