Merge pull request #1740 from caternuson/iss1739_insert

Fix shift right in displayio.Group
This commit is contained in:
Scott Shawcroft 2019-04-03 10:18:44 -07:00 committed by GitHub
commit 9bfa625170
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -73,8 +73,8 @@ void common_hal_displayio_group_insert(displayio_group_t* self, size_t index, mp
mp_raise_ValueError(translate("Layer must be a Group or TileGrid subclass."));
}
// Shift everything right.
for (size_t i = index; i < self->size; i++) {
self->children[i + 1] = self->children[i];
for (size_t i = self->size; i > index; i--) {
self->children[i] = self->children[i - 1];
}
self->children[index].native = native_layer;
self->children[index].original = layer;