From 6cb40e9bc8c5f15a0c5158fe2c65b507221e4b4d Mon Sep 17 00:00:00 2001 From: pommicket Date: Wed, 6 Sep 2023 21:58:04 -0400 Subject: fix error on first page load and broken image --- guide-src/index.html | 2 +- pugl.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/guide-src/index.html b/guide-src/index.html index c755491..0e765b4 100644 --- a/guide-src/index.html +++ b/guide-src/index.html @@ -41,7 +41,7 @@ you’ll get a nice greenish blue color!

.pos is itself a vector, so you can just throw it into the Buffer input: -

+
notice how the output is red on the right side of the screen (where the x component of .pos is high) and green at the top of the screen (where the y component of .pos is high).

diff --git a/pugl.js b/pugl.js index ac0c72e..f5de8b2 100644 --- a/pugl.js +++ b/pugl.js @@ -2350,7 +2350,8 @@ function export_widgets_to_local_storage() { const widget_str = export_widgets(); code_input.value = widget_str; // re-read metadata so that having multiple tabs with pugl open isn't an issue - creation_metadata = JSON.parse(localStorage.getItem(`${APP_ID}-metadata`)); + const new_metadata = JSON.parse(localStorage.getItem(`${APP_ID}-metadata`)); + creation_metadata = new_metadata || {}; localStorage.setItem(`${APP_ID}-${creation_id}-description`, widget_str); creation_metadata[creation_id] = { lastViewed: Date.now(), -- cgit v1.2.3