瀏覽代碼

Fixed TouchScreenButton::shape_centered having no effect

The problem was that the shape_centered depended on TouchScreenButton::texture having a Texture
Muller-Castro 5 年之前
父節點
當前提交
127c2d75ad
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      scene/2d/touch_screen_button.cpp

+ 6 - 2
scene/2d/touch_screen_button.cpp

@@ -325,8 +325,12 @@ void TouchScreenButton::_release(bool p_exiting_tree) {
 }
 
 Rect2 TouchScreenButton::_edit_get_rect() const {
-	if (texture.is_null())
-		return CanvasItem::_edit_get_rect();
+	if (texture.is_null()) {
+		if (shape.is_valid())
+			return shape->get_rect();
+		else
+			return CanvasItem::_edit_get_rect();
+	}
 
 	return Rect2(Size2(), texture->get_size());
 }