+ trace_assert(undo_history);
+
+ int selected = 0;
+ if (color_picker_event(
+ &player_layer->color_picker,
+ event,
+ camera,
+ &selected) < 0) {
+ return -1;
+ }
+
+ if (selected && !color_picker_drag(&player_layer->color_picker)) {
+ PlayerUndoContext context =
+ player_layer_create_undo_context(player_layer);
+ undo_history_push(
+ undo_history,
+ player_layer_undo,
+ &context,
+ sizeof(context));
+ player_layer->prev_color = color_picker_rgba(&player_layer->color_picker);
+ }
+
+ if (!selected &&
+ event->type == SDL_MOUSEBUTTONDOWN &&
+ event->button.button == SDL_BUTTON_LEFT) {
+
+ PlayerUndoContext context =
+ player_layer_create_undo_context(player_layer);
+
+ undo_history_push(
+ undo_history,
+ player_layer_undo,
+ &context, sizeof(context));