mirror of
https://github.com/penpot/penpot.git
synced 2025-12-12 06:24:17 +01:00
🐛 Fix insert shape on empty frame
This commit is contained in:
@@ -1305,8 +1305,12 @@ impl Shape {
|
|||||||
for st in structure {
|
for st in structure {
|
||||||
match st.entry_type {
|
match st.entry_type {
|
||||||
StructureEntryType::AddChild => {
|
StructureEntryType::AddChild => {
|
||||||
let index = usize::min(result.len() - 1, st.index as usize);
|
if result.is_empty() {
|
||||||
result.shift_insert(index, st.id);
|
result.insert(st.id);
|
||||||
|
} else {
|
||||||
|
let index = usize::min(result.len() - 1, st.index as usize);
|
||||||
|
result.shift_insert(index, st.id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
StructureEntryType::RemoveChild => {
|
StructureEntryType::RemoveChild => {
|
||||||
to_remove.insert(&st.id);
|
to_remove.insert(&st.id);
|
||||||
|
|||||||
Reference in New Issue
Block a user