Skip to content

Commit

Permalink
Fix order of draw functions and update snapshot tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yoonieaj committed Jun 4, 2024
1 parent ddddaf3 commit 69dcc0b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions memory-viz/src/memory_model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,9 @@ export class MemoryModel {
box_height += 1.5 * this.item_min_height;
}

this.drawRect(x, y, box_width, box_height, style.box_container);
const SIZE = { x, y, width: box_width, height: box_height };

// A second loop, so that we can position the colon and value boxes correctly.
curr_y = y + this.prop_min_height + this.item_min_height / 2;
for (const k in obj) {
Expand All @@ -549,13 +552,6 @@ export class MemoryModel {
this.getTextLength(idv + 5)
);

this.drawText(
":",
x + box_width / 2,
curr_y + this.item_min_height / 2 + this.font_size / 4,
{ fill: this.text_color }
);

// Draw the rectangle for values.
this.drawRect(
x + box_width / 2 + this.font_size,
Expand All @@ -564,6 +560,13 @@ export class MemoryModel {
this.item_min_height
);

this.drawText(
":",
x + box_width / 2,
curr_y + this.item_min_height / 2 + this.font_size / 4,
{ fill: this.text_color }
);

this.drawText(
idv,
x + box_width / 2 + this.font_size + value_box / 2,
Expand All @@ -574,9 +577,6 @@ export class MemoryModel {
curr_y += this.item_min_height * 1.5;
}

this.drawRect(x, y, box_width, box_height, style.box_container);
const SIZE = { x, y, width: box_width, height: box_height };

this.drawProperties(id, "dict", x, y, box_width, style);

return SIZE;
Expand Down
Loading

0 comments on commit 69dcc0b

Please sign in to comment.