private void DrawUiProperties()
        {
            void InsertKeyframe(string entityId, string propertyId)
            {
                var entity  = _state.Entities[entityId];
                var propDef = _state.PropertyDefinitions[propertyId];
                var trackId = _state.Animator.GetTrackKey(entityId, propertyId);
                var value   = entity.GetCurrentPropertyValue <object>(propDef);

                _state.Animator.InsertKeyframe(trackId, value);
            }

            ImGui.Text($"{ImGuiEx.IcoMoon.EqualizerIcon} Properties");
            ImGui.BeginChildFrame(3, NVector2.UnitY * 208);
            if (!string.IsNullOrEmpty(selectedEntityId))
            {
                var selectedEntity = _state.Entities[selectedEntityId];

                var tempEntityName = ImGuiEx.SavedInput(String.Empty, selectedEntity.Id);
                ImGui.SameLine();
                if (ImGui.Button("Rename") && !_state.Entities.ContainsKey(tempEntityName))
                {
                    RenameEntity(selectedEntity, tempEntityName);
                    ImGuiEx.ResetSavedInput();
                }

                ImGui.Separator();

                ImGui.Columns(2);
                ImGui.SetColumnWidth(0, 28);
                if (ImGui.Button($"{ImGuiEx.IcoMoon.KeyIcon}##group"))
                {
                    foreach (var propertyId in selectedEntity)
                    {
                        InsertKeyframe(selectedEntityId, propertyId);
                    }
                }
                ImGui.NextColumn();
                ImGui.Text("All properties");
                ImGui.Separator();
                ImGui.NextColumn();

                var keyframeButtonId = 0;
                foreach (var propertyId in selectedEntity)
                {
                    ImGui.PushID(keyframeButtonId++);
                    if (ImGui.Button($"{ImGuiEx.IcoMoon.KeyIcon}"))
                    {
                        InsertKeyframe(selectedEntityId, propertyId);
                    }
                    ImGui.PopID();

                    ImGui.NextColumn();

                    var propDefinition = _state.PropertyDefinitions[propertyId];
                    switch (propertyId)
                    {
                    case POSITION_PROPERTY:
                        Vector2 value = selectedEntity.GetCurrentPropertyValue <Vector2>(propDefinition);

                        var pos = new NVector2(value.X, value.Y);
                        ImGui.DragFloat2(propertyId, ref pos);

                        value.X = pos.X;
                        value.Y = pos.Y;

                        selectedEntity.SetCurrentPropertyValue(propDefinition, value);

                        break;

                    case FRAMEINDEX_PROPERTY:
                        int frameIndex = selectedEntity.GetCurrentPropertyValue <int>(propDefinition);

                        var texture = _state.Textures[selectedEntity.TextureId];
                        int framesX = (int)(texture.Width / texture.FrameSize.X);
                        int framesY = (int)(texture.Height / texture.FrameSize.Y);

                        ImGui.SliderInt(propertyId, ref frameIndex, 0, framesX * framesY - 1);

                        selectedEntity.SetCurrentPropertyValue(propDefinition, frameIndex);
                        break;
                    }

                    ImGui.NextColumn();
                }
            }
            else if (!string.IsNullOrEmpty(selectedTextureId))
            {
                var scale            = 2f;
                var selectedTexture  = _state.Textures[selectedTextureId];
                var currentFrameSize = selectedTexture.FrameSize;
                var currentPivot     = selectedTexture.Pivot;

                ImGui.DragFloat2("Framesize", ref currentFrameSize);
                ImGui.DragFloat2("Pivot", ref currentPivot);

                selectedTexture.FrameSize = currentFrameSize;
                selectedTexture.Pivot     = currentPivot;

                var scaledFrameSize = currentFrameSize * scale;
                var scaledPivot     = currentPivot * scale;

                ImGui.BeginChildFrame(2, NVector2.UnitY * 154f);

                var contentSize = ImGui.GetContentRegionAvail();
                var center      = ImGui.GetCursorScreenPos() + contentSize * 0.5f;
                var frameStart  = center - scaledFrameSize * 0.5f;

                // draw frame size
                var drawList = ImGui.GetWindowDrawList();
                drawList.AddRect(frameStart, frameStart + scaledFrameSize, Color.GreenYellow.PackedValue);

                // horizontal line
                drawList.AddLine(center - NVector2.UnitX * scaledFrameSize * 0.5f,
                                 center + NVector2.UnitX * scaledFrameSize * 0.5f,
                                 Color.ForestGreen.PackedValue);

                // vertical line
                drawList.AddLine(center - NVector2.UnitY * scaledFrameSize * 0.5f,
                                 center + NVector2.UnitY * scaledFrameSize * 0.5f,
                                 Color.ForestGreen.PackedValue);

                // draw pivot
                drawList.AddCircleFilled(frameStart + scaledPivot, 4, Color.White.PackedValue);

                ImGui.EndChildFrame();
            }

            ImGui.EndChildFrame();
        }