include/svx/sdr/contact/viewobjectcontact.hxx | 2 - svx/source/sdr/contact/viewobjectcontact.cxx | 26 +++++++------------------ svx/source/svdraw/sdrhittesthelper.cxx | 27 ++++++++++---------------- 3 files changed, 19 insertions(+), 36 deletions(-)
New commits: commit 8a7b5d8b3af8eab09209ce1748ddc5b5c2feee91 Author: Noel Grandin <[email protected]> AuthorDate: Mon Dec 1 11:14:22 2025 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Mon Dec 1 13:42:59 2025 +0100 tdf#169414 Ghost object remains in original position after object is moved revert commit 1c8b8d1fb80e6445aaeca2f2df6816d223277dbc Author: Noel Grandin <[email protected]> Date: Fri Nov 7 16:38:40 2025 +0200 tdf#168928 Draw object not removed from the view after delete and commit e6a8c40e5051363d5825bd09131b86cf8a2b659b Author: Noel Grandin <[email protected]> Date: Tue Sep 30 14:54:37 2025 +0200 tdf#116975 Laggy behavior when clicking between table cells in impress No idea why this is going wrong, there must be some implicit thing kicking in that I removed. Change-Id: I5da81be9d6a8305163a70a4639ff0229acfb2329 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194864 Reviewed-by: Noel Grandin <[email protected]> Tested-by: Jenkins diff --git a/include/svx/sdr/contact/viewobjectcontact.hxx b/include/svx/sdr/contact/viewobjectcontact.hxx index 26154d80f63f..fa54bd470580 100644 --- a/include/svx/sdr/contact/viewobjectcontact.hxx +++ b/include/svx/sdr/contact/viewobjectcontact.hxx @@ -65,7 +65,6 @@ private: // This bool gets set when the object gets invalidated by ActionChanged() and // can be used from the OC to late-invalidates bool mbLazyInvalidate : 1; - mutable bool mbInvalidateViewOnDestruct : 1; protected: // make redirector a protected friend, it needs to call createPrimitives as default action @@ -98,7 +97,6 @@ public: // get the object size range const basegfx::B2DRange& getObjectRange() const; - bool hasCachedObjectRange() const { return !maObjectRange.isEmpty(); } // React on changes of the object of this ViewContact virtual void ActionChanged(); diff --git a/svx/source/sdr/contact/viewobjectcontact.cxx b/svx/source/sdr/contact/viewobjectcontact.cxx index 94df04ff4758..122813c33420 100644 --- a/svx/source/sdr/contact/viewobjectcontact.cxx +++ b/svx/source/sdr/contact/viewobjectcontact.cxx @@ -155,8 +155,7 @@ ViewObjectContact::ViewObjectContact(ObjectContact& rObjectContact, ViewContact& : mrObjectContact(rObjectContact), mrViewContact(rViewContact), mnActionChangedCount(0), - mbLazyInvalidate(false), - mbInvalidateViewOnDestruct(false) + mbLazyInvalidate(false) { // make the ViewContact remember me mrViewContact.AddViewObjectContact(*this); @@ -167,21 +166,11 @@ ViewObjectContact::ViewObjectContact(ObjectContact& rObjectContact, ViewContact& ViewObjectContact::~ViewObjectContact() { - if (mbInvalidateViewOnDestruct) + // if the object range is empty, then we have never had the primitive range change, so nothing to invalidate + if (!maObjectRange.isEmpty()) { - // used cached object range to limit invalidation - if (!maObjectRange.isEmpty()) - { - // invalidate in view - GetObjectContact().InvalidatePartOfView(maObjectRange); - } - else - { - // we do not currently have cached range information, so just invalidate the whole viewport - const drawinglayer::geometry::ViewInformation2D& rViewInfo2D = GetObjectContact().getViewInformation2D(); - if (!rViewInfo2D.getViewport().isEmpty()) - GetObjectContact().InvalidatePartOfView(rViewInfo2D.getViewport()); - } + // invalidate in view + GetObjectContact().InvalidatePartOfView(maObjectRange); } // delete PrimitiveAnimation @@ -532,8 +521,9 @@ drawinglayer::primitive2d::Primitive2DContainer const & ViewObjectContact::getPr // check for animated stuff const_cast< ViewObjectContact* >(this)->checkForPrimitive2DAnimations(); - const_cast< ViewObjectContact* >(this)->maObjectRange.reset(); - mbInvalidateViewOnDestruct = true; + // always update object range when PrimitiveSequence changes + const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D()); + const_cast< ViewObjectContact* >(this)->maObjectRange = mxPrimitive2DSequence.getB2DRange(rViewInformation2D); } // return current Primitive2DContainer diff --git a/svx/source/svdraw/sdrhittesthelper.cxx b/svx/source/svdraw/sdrhittesthelper.cxx index 2262172465d0..72e41dbc2dc8 100644 --- a/svx/source/svdraw/sdrhittesthelper.cxx +++ b/svx/source/svdraw/sdrhittesthelper.cxx @@ -120,26 +120,21 @@ bool ViewObjectContactPrimitiveHit( bool bTextOnly, drawinglayer::primitive2d::Primitive2DContainer* pHitContainer) { - // Only use the range if we already have it, computing the range can be more expensive - // than running the HitTestProcessor. - if (rVOC.hasCachedObjectRange()) - { - basegfx::B2DRange aObjectRange(rVOC.getObjectRange()); - - if(aObjectRange.isEmpty()) - return false; + basegfx::B2DRange aObjectRange(rVOC.getObjectRange()); - // first do a rough B2DRange based HitTest; do not forget to - // include the HitTolerance if given - if(rLogicHitTolerance.getX() > 0 || rLogicHitTolerance.getY() > 0) - { - aObjectRange.grow(rLogicHitTolerance); - } + if(aObjectRange.isEmpty()) + return false; - if(!aObjectRange.isInside(rHitPosition)) - return false; + // first do a rough B2DRange based HitTest; do not forget to + // include the HitTolerance if given + if(rLogicHitTolerance.getX() > 0 || rLogicHitTolerance.getY() > 0) + { + aObjectRange.grow(rLogicHitTolerance); } + if(!aObjectRange.isInside(rHitPosition)) + return false; + // get primitive sequence sdr::contact::DisplayInfo aDisplayInfo; // have to make a copy of this container here, because it might be changed underneath us
