Skip to content

Commit

Permalink
Fix node position handling
Browse files Browse the repository at this point in the history
  • Loading branch information
luboslenco committed Sep 12, 2024
1 parent f944772 commit 5dd3ce9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions sources/iron_ui_nodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1228,9 +1228,9 @@ void ui_node_canvas_encode(ui_node_canvas_t *canvas) {
armpack_encode_string("type");
armpack_encode_string(canvas->nodes->buffer[i]->type);
armpack_encode_string("x");
armpack_encode_i32(canvas->nodes->buffer[i]->x);
armpack_encode_f32(canvas->nodes->buffer[i]->x);
armpack_encode_string("y");
armpack_encode_i32(canvas->nodes->buffer[i]->y);
armpack_encode_f32(canvas->nodes->buffer[i]->y);
armpack_encode_string("color");
armpack_encode_i32(canvas->nodes->buffer[i]->color);

Expand Down Expand Up @@ -1349,9 +1349,9 @@ uint32_t ui_node_canvas_encoded_size(ui_node_canvas_t *canvas) {
size += armpack_size_string("type");
size += armpack_size_string(canvas->nodes->buffer[i]->type);
size += armpack_size_string("x");
size += armpack_size_i32();
size += armpack_size_f32();
size += armpack_size_string("y");
size += armpack_size_i32();
size += armpack_size_f32();
size += armpack_size_string("color");
size += armpack_size_i32();

Expand Down Expand Up @@ -1433,7 +1433,7 @@ uint32_t ui_node_canvas_encoded_size(ui_node_canvas_t *canvas) {
}

size += armpack_size_string("width");
size += armpack_size_i32();
size += armpack_size_f32();
}

size += armpack_size_string("links");
Expand Down Expand Up @@ -1525,7 +1525,7 @@ char *ui_node_canvas_to_json(ui_node_canvas_t *canvas) {
}
json_encode_end_array();

json_encode_i32("width", canvas->nodes->buffer[i]->width);
json_encode_f32("width", canvas->nodes->buffer[i]->width);
json_encode_end_object();
}
json_encode_end_array();
Expand Down
6 changes: 3 additions & 3 deletions sources/iron_ui_nodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ typedef PACK(struct ui_node {
int id;
char *name;
char *type;
int x; // float x;
int y; // float y;
float x;
float y;
uint32_t color;
ui_node_socket_array_t *inputs;
ui_node_socket_array_t *outputs;
ui_node_button_array_t *buttons;
int width; // float width
float width;
}) ui_node_t;

typedef PACK(struct ui_node_link {
Expand Down

0 comments on commit 5dd3ce9

Please sign in to comment.