do not add items twice to their canvas parent!
This commit is contained in:
parent
ef64c7ba19
commit
c91c028c37
@ -99,7 +99,7 @@ public:
|
|||||||
void ungrab ();
|
void ungrab ();
|
||||||
|
|
||||||
void unparent ();
|
void unparent ();
|
||||||
void reparent (Item *);
|
void reparent (Item *, bool already_added = false);
|
||||||
|
|
||||||
/** @return Parent group, or 0 if this is the root group */
|
/** @return Parent group, or 0 if this is the root group */
|
||||||
Item* parent () const {
|
Item* parent () const {
|
||||||
|
@ -410,7 +410,7 @@ Item::unparent ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Item::reparent (Item* new_parent)
|
Item::reparent (Item* new_parent, bool already_added)
|
||||||
{
|
{
|
||||||
if (new_parent == _parent) {
|
if (new_parent == _parent) {
|
||||||
return;
|
return;
|
||||||
@ -429,7 +429,9 @@ Item::reparent (Item* new_parent)
|
|||||||
|
|
||||||
find_scroll_parent ();
|
find_scroll_parent ();
|
||||||
|
|
||||||
_parent->add (this);
|
if (!already_added) {
|
||||||
|
_parent->add (this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -862,7 +864,7 @@ Item::add (Item* i)
|
|||||||
/* XXX should really notify canvas about this */
|
/* XXX should really notify canvas about this */
|
||||||
|
|
||||||
_items.push_back (i);
|
_items.push_back (i);
|
||||||
i->reparent (this);
|
i->reparent (this, true);
|
||||||
invalidate_lut ();
|
invalidate_lut ();
|
||||||
_bounding_box_dirty = true;
|
_bounding_box_dirty = true;
|
||||||
}
|
}
|
||||||
@ -873,7 +875,7 @@ Item::add_front (Item* i)
|
|||||||
/* XXX should really notify canvas about this */
|
/* XXX should really notify canvas about this */
|
||||||
|
|
||||||
_items.push_front (i);
|
_items.push_front (i);
|
||||||
i->reparent (this);
|
i->reparent (this, true);
|
||||||
invalidate_lut ();
|
invalidate_lut ();
|
||||||
_bounding_box_dirty = true;
|
_bounding_box_dirty = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user