From 59bf0365c8a897861aeb1c54819920d543c7255b Mon Sep 17 00:00:00 2001 From: Rex Date: Fri, 17 Jun 2022 14:46:03 +0800 Subject: [PATCH] Update hitarea when changing frame --- src/gameobjects/components/Size.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gameobjects/components/Size.js b/src/gameobjects/components/Size.js index 33dcd107c..5b324898e 100644 --- a/src/gameobjects/components/Size.js +++ b/src/gameobjects/components/Size.js @@ -125,6 +125,14 @@ var Size = { this.width = frame.realWidth; this.height = frame.realHeight; + var input = this.input; + + if (input && !input.customHitArea) + { + input.hitArea.width = this.width; + input.hitArea.height = this.height; + } + return this; },