Merge pull request #70646 from KoBeWi/relatable_offset
Add `pivot_offset_ratio` property to Control
This commit is contained in:
@ -4205,17 +4205,18 @@ void CanvasItemEditor::_notification(int p_what) {
|
||||
|
||||
Control *control = Object::cast_to<Control>(ci);
|
||||
if (control) {
|
||||
real_t anchors[4];
|
||||
Vector2 pivot;
|
||||
Vector2 pivot = control->get_pivot_offset();
|
||||
Vector2 pivot_ratio = control->get_pivot_offset_ratio();
|
||||
|
||||
pivot = control->get_pivot_offset();
|
||||
real_t anchors[4];
|
||||
anchors[SIDE_LEFT] = control->get_anchor(SIDE_LEFT);
|
||||
anchors[SIDE_RIGHT] = control->get_anchor(SIDE_RIGHT);
|
||||
anchors[SIDE_TOP] = control->get_anchor(SIDE_TOP);
|
||||
anchors[SIDE_BOTTOM] = control->get_anchor(SIDE_BOTTOM);
|
||||
|
||||
if (pivot != se->prev_pivot || anchors[SIDE_LEFT] != se->prev_anchors[SIDE_LEFT] || anchors[SIDE_RIGHT] != se->prev_anchors[SIDE_RIGHT] || anchors[SIDE_TOP] != se->prev_anchors[SIDE_TOP] || anchors[SIDE_BOTTOM] != se->prev_anchors[SIDE_BOTTOM]) {
|
||||
if (pivot != se->prev_pivot || pivot_ratio != se->prev_pivot_ratio || anchors[SIDE_LEFT] != se->prev_anchors[SIDE_LEFT] || anchors[SIDE_RIGHT] != se->prev_anchors[SIDE_RIGHT] || anchors[SIDE_TOP] != se->prev_anchors[SIDE_TOP] || anchors[SIDE_BOTTOM] != se->prev_anchors[SIDE_BOTTOM]) {
|
||||
se->prev_pivot = pivot;
|
||||
se->prev_pivot_ratio = pivot_ratio;
|
||||
se->prev_anchors[SIDE_LEFT] = anchors[SIDE_LEFT];
|
||||
se->prev_anchors[SIDE_RIGHT] = anchors[SIDE_RIGHT];
|
||||
se->prev_anchors[SIDE_TOP] = anchors[SIDE_TOP];
|
||||
|
||||
@ -58,6 +58,7 @@ public:
|
||||
Transform2D prev_xform;
|
||||
Rect2 prev_rect;
|
||||
Vector2 prev_pivot;
|
||||
Vector2 prev_pivot_ratio;
|
||||
real_t prev_anchors[4] = { (real_t)0.0 };
|
||||
|
||||
Transform2D pre_drag_xform;
|
||||
|
||||
Reference in New Issue
Block a user