mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Add some codes, returnes directly if the value is not changed.
Avoid executing the following value-changed logics if the value does not really change.
This commit is contained in:
@@ -105,6 +105,11 @@ Ref<Texture2D> NinePatchRect::get_texture() const {
|
||||
|
||||
void NinePatchRect::set_patch_margin(Side p_side, int p_size) {
|
||||
ERR_FAIL_INDEX((int)p_side, 4);
|
||||
|
||||
if (margin[p_side] == p_size) {
|
||||
return;
|
||||
}
|
||||
|
||||
margin[p_side] = p_size;
|
||||
update();
|
||||
update_minimum_size();
|
||||
@@ -130,6 +135,10 @@ Rect2 NinePatchRect::get_region_rect() const {
|
||||
}
|
||||
|
||||
void NinePatchRect::set_draw_center(bool p_enabled) {
|
||||
if (draw_center == p_enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
draw_center = p_enabled;
|
||||
update();
|
||||
}
|
||||
@@ -139,6 +148,10 @@ bool NinePatchRect::is_draw_center_enabled() const {
|
||||
}
|
||||
|
||||
void NinePatchRect::set_h_axis_stretch_mode(AxisStretchMode p_mode) {
|
||||
if (axis_h == p_mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
axis_h = p_mode;
|
||||
update();
|
||||
}
|
||||
@@ -148,6 +161,10 @@ NinePatchRect::AxisStretchMode NinePatchRect::get_h_axis_stretch_mode() const {
|
||||
}
|
||||
|
||||
void NinePatchRect::set_v_axis_stretch_mode(AxisStretchMode p_mode) {
|
||||
if (axis_v == p_mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
axis_v = p_mode;
|
||||
update();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user