diff --git a/core/2d/CCAnchoredSprite.cpp b/core/2d/CCAnchoredSprite.cpp index fa640e2806..1c93e96bb9 100644 --- a/core/2d/CCAnchoredSprite.cpp +++ b/core/2d/CCAnchoredSprite.cpp @@ -200,7 +200,7 @@ void AnchoredSprite::setAnchorPoint(const Vec2& anchor) updatePoly(); } -const Rect& AnchoredSprite::getTouchRect() +Rect AnchoredSprite::getTouchRect() { Size s = getContentSize(); Size a = _spriteVertexAnchor * s; diff --git a/core/2d/CCAnchoredSprite.h b/core/2d/CCAnchoredSprite.h index 249f2305f1..07b1d345ab 100644 --- a/core/2d/CCAnchoredSprite.h +++ b/core/2d/CCAnchoredSprite.h @@ -140,7 +140,7 @@ public: /* This function will reposition the sprite's vertices itself instead of the node */ virtual void setAnchorPoint(const Vec2& anchor) override; /* Gets the hit area of the anchored sprite, this requires special calculations for shifted vertices and should be used with touch event listeners */ - virtual const Rect& getTouchRect(); + virtual Rect getTouchRect(); protected: virtual void setVertexCoords(const Rect& rect, V3F_C4B_T2F_Quad* outQuad) override;