summaryrefslogtreecommitdiff
path: root/src/sorted.cpp
diff options
context:
space:
mode:
authorFox Caminiti <fox@foxcam.net>2023-02-01 13:11:05 -0500
committerFox Caminiti <fox@foxcam.net>2023-02-01 13:11:05 -0500
commita2c1ceedc6c6b3756f8d9b3b9c29798b5d925447 (patch)
tree8c7e2cb9a6534bf12b5544053ac608ec0dec8dbe /src/sorted.cpp
parentc40fb7c82be088db4166e92f131865f72b975f56 (diff)
sorting and shape updates
Diffstat (limited to 'src/sorted.cpp')
-rw-r--r--src/sorted.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/sorted.cpp b/src/sorted.cpp
index 08d9d3b..03f5b0a 100644
--- a/src/sorted.cpp
+++ b/src/sorted.cpp
@@ -242,11 +242,22 @@ Layer_SortAll(project_state *State, memory *Memory,
sorted_layer_array *LayerEntry = &SortedLayerStart[Idx];
block_layer *Layer = (block_layer *)Memory_Block_AddressAtIndex(Memory, F_Layers, LayerEntry->Block_Layer_Index);
if (Layer->IsSelected) {
+ for (int a = i+1; a < SortedCompStart->LayerCount; a++) {
+ int PrevIdx = a + FauxIncrement - 1;
+ sorted_layer_array *PrevLayerEntry = &SortedLayerStart[PrevIdx];
+ int NextIdx = a + FauxIncrement;
+ sorted_layer_array *NextLayerEntry = &SortedLayerStart[NextIdx];
+ if (NextLayerEntry->SortedOffset == PrevLayerEntry->SortedOffset)
+ NextLayerEntry->SortedOffset -= 1;
+ else
+ break;
+ }
uint8 *Address_Start = (uint8 *)(LayerEntry);
uint8 *Address_End = (uint8 *)(&SortedLayerStart[SortedCompStart->LayerCount + FauxIncrement]) - 1;
Assert(SortedCompStart->CurrentSortIndex != (SortedCompStart->LayerCount + SortedCompStart->FakeLayerCount));
Arbitrary_ShiftData(Address_Start, Address_End, sizeof(sorted_layer_array), 1);
sorted_layer_array *FakeLayerEntry = LayerEntry + 1;
+ FakeLayerEntry->SortedOffset -= 1;
Assert(FakeLayerEntry->Block_Layer_Index == LayerEntry->Block_Layer_Index);
FakeLayerEntry->IsFake = true;
FauxIncrement++;